From: Peter Dalgaard (p.dalgaard@biostat.ku.dk)
Date: Tue 30 Dec 2003 - 12:29:10 EST
Message-id: <x2k74fnleh.fsf@biostat.ku.dk>
Murray Jorgensen <maj@stats.waikato.ac.nz> writes:
> Greetings all. Any help with the following would be appreciated.
>
> I want to create a data frame for each file in a directory. The following
> code does not work but it may show what I am trying to do:
>
> carmakes <- c('BMW','Chrysler','Citroen','Fiat','Ford','Holden','Honda',
> 'Mercedes','MG','Mitsubishi','Nissan','Peugeot','Renault','Subaru','Toyota',
> 'VW')
> for (brand in carmakes) {
> fyle <- paste("c:/data/cars03/",brand,".txt",sep="")
> brand <- read.table(fyle, header = TRUE, sep = "\t",na.strings =
> c("-","POA"), colClasses=c("character",rep("numeric",7)),
> comment.char = "#")
> }
>
> I need something like an unquote() function that will allow the "brand" on
> the LHS of the assignment to be treated as an object name instead of a
> character string.
>
> Murray
assign(brand, read.table(blablabla))
(Overlooked by many, but I would have expected that you'd been around
for long enough to have noticed it....)
-- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
This archive was generated by hypermail 2.1.3 : Thu 01 Jan 2004 - 09:21:04 EST