[R] manipulate all files in folder
Christian Schulz
ozric at web.de
Fri Jan 10 12:52:03 CET 2003
many thanks, but how it's
possible set my data.frames to get
this as
tmpdata[1] etc.
regards,christian
test <- function(dir) {
+ tmpdata <- data.frame(##here's the problem?##)
+ for(fn in list.files(dir, full.names = TRUE)) {
+ tmpdata[fn] <- read.spss(fn, use.value.labels=F,
to.data.frame=T)
+ }
+ return(tmpdata)
+ }
>>test("c:/Project/allbus/Data")
[1] c:/Project/allbus/Data/fuzzyHermes.sav
[2] c:/Project/allbus/Data/hermesKunden.sav
[3] c:/Project/allbus/Data/hermesTertius.sav
[4] c:/Project/allbus/Data/hermesWettbewerb.sav
<0 rows> (or 0-length row.names)
Warning messages:
1: replacement data has 2297 rows to replace 0 rows in:
"[<-.data.frame"(*tmp*, fn, value = read.spss(fn, use.value.labels = F,
2: provided 8 variables to replace 1 variables in: "[<-.data.frame"(*tmp*,
fn, value = read.spss(fn, use.value.labels = F,
3: replacement data has 2297 rows to replace 0 rows in:
"[<-.data.frame"(*tmp*, fn, value = read.spss(fn, use.value.labels = F,
4: provided 192 variables to replace 1 variables in: "[<-.data.frame"(*tmp*,
fn, value = read.spss(fn, use.value.labels = F,
5: replacement data has 2297 rows to replace 0 rows in:
"[<-.data.frame"(*tmp*, fn, value = read.spss(fn, use.value.labels = F,
6: provided 25 variables to replace 1 variables in: "[<-.data.frame"(*tmp*,
fn, value = read.spss(fn, use.value.labels = F,
7: replacement data has 430 rows to replace 0 rows in:
"[<-.data.frame"(*tmp*, fn, value = read.spss(fn, use.value.labels = F,
8: provided 191 variables to replace 1 variables in: "[<-.data.frame"(*tmp*,
fn, value = read.spss(fn, use.value.labels = F,
>>ls()
[1] "last.warning" "test"
> test <- function(dir) {
> for(fn in list.files(dir, full.names = TRUE)) {
> tmpdata <- read.spss(fn, use.value.labels=F, to.data.frame=T)
> ....
> }
> }
More information about the R-help
mailing list