a=c("Bob","Fred","Barb","Sue","Jeff")
b=c(21,18,18,24,20)
c=c(70,67,64,66,72)
d=c(180,156,128,118,202)
e=c("Cauc","Af.Am","Af.Am","Cauc","Asain")
f=c("Jr","Fr","Fr","Sr","So")
g=c(1080,1210,840,1340,880)
student.info=data.frame(name=a,age=b,hgt=c,wgt=d,race=e,year=f,SAT=g)
data
## name age
## 1 Bob 21
## 2 Fred 18
## 3 Barb 18
## 4 Sue 24
## 5 Jeff 20
class(data)
## [1] "data.frame"
names(data)
## [1] "name" "age"
str(data)
## 'data.frame': 5 obs. of 2 variables:
## $ name: Factor w/ 5 levels "Barb","Bob","Fred",..: 2 3 1 5 4
## $ age : num 21 18 18 24 20
summary(data)
## name age
## Barb:1 Min. :18.0
## Bob :1 1st Qu.:18.0
## Fred:1 Median :20.0
## Jeff:1 Mean :20.2
## Sue :1 3rd Qu.:21.0
## Max. :24.0
When the “class” command is entered is tells us its a dataframe. When the “names” command is entered it tells us the titles of the top row when the “str” command is entered it tells us about the objects,variables and factors in the data frame. when the “summary” command it gave us info. on the 1st and 3rd quartiles and the mean.