Summarizes the common method to view the data:
function | Features |
---|---|
tail() | View the trailer |
head() | View header |
dim() | View Data Dimensions |
str() | Give each field name and type |
levels() | View all given level field |
table() | The tabulated variables, where each group was observed |
summary() | See generally distributed data, gives the minimum value, quantile information |
names() | View the data field name |
- dim()
dim(mtcars)
[1] 32 11
- str()
str(mtcars)
'data.frame': 32 obs. of 11 variables:
$ mpg : num 21 21 22.8 21.4 18.7 18.1 14.3 24.4 22.8 19.2 ...
$ cyl : num 6 6 4 6 8 6 8 4 4 6 ...
$ disp: num 160 160 108 258 360 ...
$ hp : num 110 110 93 110 175 105 245 62 95 123 ...
$ drat: num 3.9 3.9 3.85 3.08 3.15 2.76 3.21 3.69 3.92 3.92 ...
- summary()
summary(mtcars)
mpg cyl
Min. :10.40 Min. :4.000
1st Qu.:15.43 1st Qu.:4.000
Median :19.20 Median :6.000
Mean :20.09 Mean :6.188
3rd Qu.:22.80 3rd Qu.:8.000
Max. :33.90 Max. :8.000
- names()
names(mtcars)
[1] "mpg" "cyl" "disp" "hp" "drat" "wt"
[7] "qsec" "vs" "am" "gear" "carb"
- table ()
using the data table to view the data field newloanstatus
table(data$newLoanStatus)
normalloan problemloan #可以看到正常贷款和问题贷款计数
94855 17015
- levels ()
using the View level data levels of data creditlevel
levels(data$creditlevel)
[1] "AA" "A" "B" "C" "D" "E" "HR"