Hi,
I am writing a function that writes to a csv file for every call.
However, for the subsequent calls, I want to append the data to the existing
csv file without appending the column names again.
I tried searching in the previous posts, but I am stuck with different
errors.
Here is what I am doing (dataF is a data-frame):-
outputFilePath <- paste(getwd(), "/", "outputModel.csv", sep="");
counter <- 1
for (userid in userids){
dataF <- getUserData(userid)
if(counter == 1){
write.csv(dataF, file = outputFilePath, append=F)
}else{
write.csv(dataF, file = outputFilePath, append=T,col.names=NA)
}
counter <- counter + 1
}
I tried setting col.names = F (In append=T), but no good.
Can anyone throw light on the correct usage.
Thanks in advance.
Regards,
Harsh Yadav
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.