2018-11-07
閱讀量:
1279
【新手向】關(guān)于select參數(shù)的問題
第一個(gè)select可以運(yùn)行出來,但第二個(gè)select總是說“Error in select(newds1, i1, i2, female, drinkstat) : 參數(shù)沒有用(i1, i2, female, drinkstat)”,不知為何。
options(digits = 3)
options(width = 72)
ds=read.csv("http://www.amherst.edu/~nhorton/r2/datasets/help.csv")
library(dplyr)
newds=select(ds, cesd, female, i1, i2, id, treat, f1a, f1b, f1c, f1d,
? ?? ?? ?? ? f1e, f1f, f1g, f1h, f1i, f1j, f1k, f1l, f1m, f1n, f1o, f1p, f1q, f1r,
? ?? ?? ?? ? f1s, f1t)
library(memisc)
newds=mutate(newds,drinkstat=
? ?? ?? ?? ?? ?cases(
? ?? ?? ?? ?? ???"abstinent"=i1==0,
? ?? ?? ?? ?? ???"moderate"=(i1>0&i1<=1&i2<=3&female==1)|
? ?? ?? ?? ?? ?? ? (i1>0&i1<=2&i2<=4&female==0),
? ?? ?? ?? ?? ???"highrisk"=((i1>1|i2>3)&female==1)|
? ?? ?? ?? ?? ?? ? ((i1>2|i2>4)&female==0)
? ?? ?? ?? ?? ?))
tmpds=select(newds,i1,i2,female,drinkstat)
可以嘗試如下:
##因?yàn)橄到y(tǒng)無法辨別select這個(gè)函數(shù)屬于哪個(gè)程序包
dplyr::select






評(píng)論(0)


暫無數(shù)據(jù)
CDA考試動(dòng)態(tài)
CDA報(bào)考指南
推薦帖子
0條評(píng)論
0條評(píng)論
0條評(píng)論