subset(x, subset, select, drop = FALSE, ...)
&多条件查询
select 显示指定列
selectresult=subset(df1,name=="aa" & sex=="f",select=c(age,sex))
负号排除指定列
selectresult=subset(df1,name=="aa" & sex=="f",select=c(-age,-sex))
例1:从快递帐单表中抽取目的地是辽宁的行
例2:提取目的地是辽宁省,计费重量小于1的数据并且不显示备注
select 显示指定列
selectresult=subset(df1,name=="aa" & sex=="f",select=c(age,sex))
负号排除指定列
selectresult=subset(df1,name=="aa" & sex=="f",select=c(-age,-sex))
网友评论