[R] How to solve: error in file(file, "rt") : invalid 'description' argument

Boris Steipe boris.steipe at utoronto.ca
Wed Apr 29 21:02:16 CEST 2015


If you google for "invalid 'description' argument" it should be pretty clear what's going on - most likely your DirPath_Matrix is not a single item.

B.


On Apr 28, 2015, at 7:02 PM, catherine peters <catherine.h.peters at googlemail.com> wrote:

> Hi thank you in advance for your assistance. 
> 
> I am using the following section of script: 
> 
> DirPath_folder 
> <-Sys.glob(file.path("/Users/catpeters/Documents/R_working_directory/1_Data_MC_Sorted")) 
> 
> for (folder in 1: length(DirPath_folder)) { 
> 
> # ## EVERY Control and Impact # 
> DirPath_Matrix <-Sys.glob(file.path(DirPath_folder[folder], 
> "*Markov_Matrix_Month.txt")) 
> 
> data <- read.table(DirPath_Matrix, header = TRUE, sep = ";") 
> 
> if (folder ==1) { DATA_ALL1 <- data } else { DATA_ALL1 <- rbind(DATA_ALL1, 
> data) } 
> 
> if (folder == length(DirPath_folder)) { 
> setwd("/Users/catpeters/Documents/R_working_directory/1_Data_MC_Sorted") 
> write.table(DATA_ALL1 ,"Matrix_Markov_ALL_MONTH_RB.txt" , col.names=TRUE, 
> row.names=FALSE, sep=";") write.table(DATA_ALL1 
> ,"Matrix_Markov_ALL_MONTH_RB.csv" , col.names=TRUE, row.names=FALSE, 
> sep=";") } } 
> 
> There seems to be a problem with: data <- read.table(DirPath_Matrix, header 
> = TRUE, sep = ";"). When run it returns the Error in file(file, "rt") : 
> invalid 'description' argument. This has worked previously and I'm not sure 
> where the error is. 
> 
> Thanks again 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.



More information about the R-help mailing list