r - Write table different directory -


i trying write multiple files in different directory 1 r script contained. if write them in same directory works in different 1 not produce output.. here code

list    <- split(dataink, list(dataink$name), drop = true) filenames <- paste("~/dir", names(list), ".dat") filenames <- sapply(filenames,gsub,pattern=" .dat",replacement=".dat") mapply(write.table, list, file = filenames,col.names = false, row.names = false, sep = "\t", quote = false) 

many thanks!

i guess filenames not defined.

replace

filenames <- paste("~/dir", names(list), ".dat") 

by

filenames <- paste0("~/dir/",names(list), ".dat") 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -