Define data
baseball <- data.frame(wins=c(15,14,11,10,4,9,0,6),homeruns=c(7,3,5,3,1,4,2,3))
what are the column names?
names(baseball)
## [1] "wins" "homeruns"
what are the first 5 rows?
head(baseball,5)
## wins homeruns
## 1 15 7
## 2 14 3
## 3 11 5
## 4 10 3
## 5 4 1
How many rows are there?
nrow(baseball)
## [1] 8
How many columns are there?
ncol(baseball)
## [1] 2
Better, what are the dimensions?
dim(baseball)
## [1] 8 2
More details, what is the structure?
str(baseball)
## 'data.frame': 8 obs. of 2 variables:
## $ wins : num 15 14 11 10 4 9 0 6
## $ homeruns: num 7 3 5 3 1 4 2 3