Hi all, I try to exceute a function "myfun" that should use as input "input1.csv" and "input2.csv" .
Then I try to save the output dat33 on a csv file (on per each time I execute input1..input 2 and so on). So my problem is how to finally obtain several csv file with "ggt1.csv", "ggt2.csv". The program creates ggt1.csv but BUT when runs "myfun" by second time (It is supossed with input2.csv" it appears: Warning messages: 1: In if (file == "") file <- stdout() else if (is.character(file)) { : the condition has length > 1 and only the first element will be used 2: In file(file, ifelse(append, "a", "w")) : only first element of 'description' argument used 3: In if (file == "") file <- stdout() else if (is.character(file)) { : the condition has length > 1 and only the first element will be used 4: In file(file, ifelse(append, "a", "w")) : only first element of 'description' argument used Do you understand what the message says? files <- paste('input', 1:2, '.csv', sep = '') myfun <- function(d) { dat <- read.csv(d, header = TRUE) dat33<-dat+4 n<-ncol(dat33) m<-nrow(dat33) write.csv(dat33, file =write.csv(dat33, file =paste('ggt', 1:2, '.csv', sep = ' ')) } lout<- lapply(files, myfun) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.