Difference between revisions of "R: data"

From OnnoWiki
Jump to navigation Jump to search
Line 16: Line 16:
 
  # Number of columns (variables)
 
  # Number of columns (variables)
 
  ncol(mtcars)
 
  ncol(mtcars)
 +
 +
 +
data("iris")
 +
head(iris)
 +
 +
data("ToothGrowth")
 +
head(ToothGrowth)
 +
 +
data("PlantGrowth")
 +
head(PlantGrowth)
 +
 +
data("USArrests")
 +
head(USArrests)

Revision as of 10:08, 28 November 2019

data()
# Loading
data(mtcars)
# Print the first 6 rows
head(mtcars, 6)
# 1. Loading 
data("mtcars")
# 2. Print
head(mtcars)
summary(mtcars)
# Number of rows (observations)
nrow(mtcars)
# Number of columns (variables)
ncol(mtcars)


data("iris")
head(iris)
data("ToothGrowth")
head(ToothGrowth)
data("PlantGrowth")
head(PlantGrowth)
data("USArrests")
head(USArrests)