# 选取数据框中的元素 --------------------------------------------------------------- patientdata[c('diabetes','status')] patientdata[1:2] patientdata[,1:2] patientdata$age table(patientdata$diabetes,patientdata$status) summary(mtcars$mpg) plot(mtcars$mpg,mtcars$wt) attach(mtcars) summary(mpg) plot(mpg,wt) detach(mtcars) mpg = c(25,36,47) attach(mtcars) plot(mpg,wt) with(mtcars,{ print(summary(mpg)) plot(mpg,disp) # plot(mpg,wt) }) with(mtcars,{ local_var <- summary(mpg) global_var <<- summary(mpg) }) local_var global_var patientdata patientdata<- data.frame(patientID,age,diabetes,status,row.names = patientID) patientdata View(patientdata)
来源:博客园
作者:dogfaraway
链接:https://www.cnblogs.com/dogfaraway/p/11505948.html