Try this:
jpeg("UserDA%02dT.jpg")
sapply(1:10, function(x)plot(rnorm(100)))
dev.off()
On 20/12/2007, Daniel Jegelka <jegelka at cbs.mpg.de>
wrote:> Hello, i only got a small problem.
>
> i try to create automatic new dataframes, or png?s. the main problem i
> got is:
>
> how can i create automatic a new name for a file (read out by simply
> "for") -
> i tried to use "(paste...) but theres an errormessage, about a wrong
> declination. R told it is as.character, but need as.Real.
>
> Should i use another method than "paste"?
>
> i tried as this:
> png("User-", paste(subject, ".png", sep = "
"))
>
> ^^ as png file, example: User-DA5T.png <- but if i create one, they are
> empty.
>
> Would anybody help me please?
>
> thx Daniel
>
>
>
>
> Prog:
> files <- list.files(
> path = "/SCR/STATISTIK",
> pattern = ".*t_simple\.txt",
> all.files = TRUE,
> full.names = TRUE,
> recursive = TRUE )
> list(files)
> anz <- nrow(files)
> print(anz)
>
> for (file in files) {
>
> lines <- readLines(file)
> name <- lines[1]
> print(name)
> #png("/SCR/STATISTIK/all-user-names.png")
> #name <- as.character(name)
> #barplot(name)
> #dev.off()
> for (line in lines[-1]) {
> liste <- unlist(strsplit((line), " "))
> subject <- as.character(liste[1])
> if (length(liste) < 2 ) {
> data <- 0
> }
> else {
> data <- as.numeric(liste[-1])
> }
> #png(paste[subject],".png")
> dev.set()
> boxplot(data[subject], ylim=c(400,1500))
> dev.off()
> datalist <- data.frame(data)
> names(datalist) <- subject
> print(datalist)
> png("/SCR/STATISTIK/datalist.png", width=1024,
height=768)
>
> plot(datalist)
> dev.off()}}
> #png("/SCR/all-show.png")
> #boxplot(datalist, main="Proband - ", col=
"blue", ylab> "reactiontime in milliseconds", xlab=
"name")
> #dev.off()
> #dev.set()
> #Datenmatrix <- cbind(datalist)
> #print(Datenmatrix)
> #dev.off()
> #plot(datalist)
> #dev.off()
>
> #einlesen <- datalist
> #print(einlesen)
> #Monate,storage, type="l", ylab="Datenvolumen [B]",
xlab="Alter [M]",
> main="Altersverteilung", col="blue", ylog=TRUE,
xpd=TRUE
> #print(x)
>
> #
> # alle kritischen Befehle wurden wohl von Felix "behoben" :( -
aber
> danke :)
> #
> (rbind(User)) -> ueber
> print(ueber)
> list(ueber)
> x <- ncol(ueber)
> print(x)
> y <- nrow(ueber)
> print(y)
> #{# for (i in 1:x)
> # {fileseq <- (unlist(strsplit((a[i]),
" "))[-1])
> # print(zeilen <- list(fileseq))
> # zeilen[i]<- zeilen
> # print(fileseq)}
> # for (j in 1:17)
> # {fileline <-
as.logical(unlist((zeilen), " "))
> # fileline[j] <- list(fileline)
> # print(fileline[j])}
> #}
>
> #
> #
>
> #
>
> #list(ueber)
> #fix(ueber)
> #dim(ueber)
> #names(ueber)
> #ausgabe der userdaten in R
> #ueber$Sephal.Length
> #ueber$Sepal.Width
> #ausgabe der userdaten in einem ?bersichtpopup
>
> #anzahl der Zeilen, die "files" besitzt
>
> #
> #daten der einzelnen datein in den Speicher schreiben
> #file <- unlist(files), NA = TRUE
> #print(file)
> #meinetabelle <- read.table(file, header=FALS)
> #a <- read.table(file=stdin(User),header=FALSE)
> #meinetabelle <- read.table(, sep=?\t?, header=FALSE)
> #simul<-data.frame(times=c(0, anz),simul=c(3,4,5,6))
> #mget(files, envir = , mode = "any",
> # inherits = TRUE)
>
>
> #
> #read.table(files)
> #
> #
>
>
> #date(inbox)
> #attach(files, pos == anz, name = deparse(substitute(files)),
> #warn.conflicts = TRUE)
>
> #step(anz, scope, scale = 1,
> # direction = c("forward"),
> # trace = 1, keep = NULL, steps = anz, k = 1)
> #test <- as.numeric(unlist(strsplit((a[i]), " "))[-1])
> #print(nrow(test))
>
> ______________________________________________
> R-help at 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.
>
>
--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O