列にある3つの可能な値のいずれかに基づいて新しい列を作成する必要があります。 これらはルールです: If it has c somewhere in it, the new column should be assigned "third"
If it has b, but not c somewhere in it, the new column should be assigned "sec
列ID、x、it、stでこのように見える約180の異なるデータフレームがあるとします。今度は、すべてのデータフレームに対して新しい値がst-1となるようにst列を変更したいと考えています。したがって、例えば最初の9行のこのデータフレームの出力はNAのままであり、10行目以降は11.0になります。 #get list with all dataframes
dflist <- list(incid
私はすべての数値でなければならないdfを持っていますが、それらはすべて文字としてタイプされています。 There were 50 or more warnings (use warnings() to see the first 50)
が、私は警告を無視することができますが、私は問題がどこにあるかを見つけるしたいと思います: sapply(df, as.numeric)
警告がスローされ
m = data.frame(c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10),
c("Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge","A","Lozenge",