If your final goal is to write the csv files, and only the csv files, then
then this (not tested) should do it.
for (i in unique(appended$dp) ) {
tmp <- subset(appended, dp==i & sampled==0)
write.table(tmp,
file= file.path('output', paste0('set',i,'.csv')),
sep=',',
row.names=FALSE
On Dec 10, 2012, at 1:03 PM, john-usace wrote:
Hi,
This question should be simple to answer. I am a new R user.
I have a data.frame called appended. I would like to break it into 7
smaller
datasets based on the value of a categorical variable dp (which has
values
1:7). I would like to nam
Hello,
Try the following.
set <- list()
for (i in 1:7) {
set[[i]] <- appended[which(appended$dp == i & appended$sampled == 0), ]
fl <- paste0("output/set", i, ".csv")
write.table(set[[i]], file = fl, sep = ",", row.name=F)
}
Hope this helps,
Rui Barradas
Em 10-12-2012 21:03, joh
Hi,
This question should be simple to answer. I am a new R user.
I have a data.frame called appended. I would like to break it into 7 smaller
datasets based on the value of a categorical variable dp (which has values
1:7). I would like to name the smaller datasets set1, set2, set3,,set7.
I d
4 matches
Mail list logo