Please guide,
I'm exporting data in '.csv' format in the Windows user directory, I
have full access to. The write operation happens within a for loop.
Each iteration exports data in csv format in the user directory. The
issue is that the data gets exported for all the 9 iterations but
fails for 10th iteration giving below error message.
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file './/posts_H<U+1ED9>i nh<U+1EEF>ng ngu<U+1EDD>i
d<U+1ED3>ng hành cùng line_752518568125567.csv': Invalid argument
Called from: file(file, ifelse(append, "a", "w"))
The export directory path is current directory with 'name' extracted as below:
my.file1: .//likes_H<U+1ED9>i nh<U+1EEF>ng ngu<U+1EDD>i d<U+1ED3>ng
hành cùng line_752518568125567.csv
my.file2: .//posts_H<U+1ED9>i nh<U+1EEF>ng ngu<U+1EDD>i d<U+1ED3>ng
hành cùng line_752518568125567.csv
I wondering if the error is due to the the complicated filename ?
Below is the line of code I have used within loop to export data.
my.file1 <- file.path('./', paste0('likes','_',name,'_',grp_id,'.csv'))
my.file2 <- file.path('./', paste0('posts','_',name,'_',grp_id,'.csv'))
write.csv(posts_frame, file=my.file2, row.names = F)
write.csv(likes_frame, file = my.file1, row.names = F)
Regards,
Sunny
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
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.