Hi,

I'm trying to read data from a collection of CSV files for processing and graphing. All of my files begin with "modrate" and end with ".csv". I think I have the regex working but I am stumped at trying to get read.table to work within an if statement.

This works:

> filepattern="modrate*"
> files <- list.files(pattern=filepattern)
> data <- read.table(files[1], header=TRUE, sep=",")

But I cannot get this to work:

> for (i in seq(along=files)) {
+ data <- read.table(files[i], header=TRUE, sep=",")
+ }
Error in make.names(col.names, unique = TRUE) :
  invalid multibyte string at '<ff><d8><ff><e0>'

I'm sure I'm making a newbie mistake here. I'm using R version 2.9.2 (2009-08-24) on Mac OS X, and didn't find anything about this in the help archives (though, as I'm new to this, I may not have searched in the best way). Any advice? Thanks.

Kind regards,
Cynthia
______________________________________________
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.

Reply via email to