Interpreting the data frame
> final_score
student math science
1 Jane 70 90
2 Dora 90 30
3 Beth 50 80
4 Park 100 100
> typeof(final_score)
[1] "list" #list consists of 3 components which have 4 elements.
#data frame is a kind of lists
> class(final_score)
[1] "data.frame"
summary(), str() ----------------------identify data frame's structure
> summary(final_score)
student math science
Length:4 Min. : 50.0 Min. : 30.0
Class :character 1st Qu.: 65.0 1st Qu.: 67.5
Mode :character Median : 80.0 Median : 85.0
Mean : 77.5 Mean : 75.0
3rd Qu.: 92.5 3rd Qu.: 92.5
Max. :100.0 Max. :100.0
> str(final_score)
'data.frame': 4 obs. of 3 variables:
$ student: chr "Jane" "Dora" "Beth" "Park"
$ math : num 70 90 50 100
$ science: num 90 30 80 100
View()-------------------------- View data frame
> View(final_score)
names(),ncol(),length(),nrow(),dim() --------identify components of data frame
> names(final_score) #names of variables (columns)
[1] "student" "math" "science"
> ncol(final_score) #number of variables (columns)
[1] 3
> length(final_score) #number of variables (columns)
[1] 3
> nrow(final_score) #number of rows
[1] 4
> dim(final_score) #number of rows, columns
[1] 4 3
> final_score["student"] #the way to identify all the cases of each variable.
student
1 Jane
2 Dora
3 Beth
4 Park
> final_score$student # dollar sign '$' is used to refer to a variable in data frame
[1] "Jane" "Dora" "Beth" "Park"
'R' 카테고리의 다른 글
(R) ifelse() (0) | 2020.07.23 |
---|---|
(R) make a summary - group_by(),summarise() (0) | 2020.07.22 |
R reorder() -reorder columns in ascending order, descending order when setting aes() (0) | 2020.07.21 |
(R) geom_col() VS geom_bar() (0) | 2020.07.20 |
(R) data.frame function / Way to make data frame 데이터 프레임 만들기 R (0) | 2020.07.16 |