Displaying 1 result from an estimated 1 matches for "c_num".
Did you mean:
xc_num
2009 Nov 09
2
Outputing multilple subsets
...subsets and output
these multilple datasets. But errors appeared in my loops. See example.
######
a<-c(1:10)
b<-c(rep(1,3),rep(2,3),rep(3,4))
c<-data.frame(a,b) #c is the example data
num<-c(unique(b))
# I hope to get the subsets c_1.csv,c_2.csv and c_3.csv
#Errors
for (i in num) {
c_num<-c[c$b==num,]
write.csv(c_num,file="c:/c_num.csv")
}
Warning messages:
1: In c$b == num :
longer object length is not a multiple of shorter object length
2: In c$b == num :
longer object length is not a multiple of shorter object length
3: In c$b == num :
longer object length...