It's a FAQ.
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f
--
David.
On Nov 17, 2009, at 7:14 AM, Tal Galili wrote:
I know how you feel,
I came a cross the same problem once, which took sometime to find a
solution
for.
What you need to do is put the hist into a variable and then plot
it, for
example:
library(lattice)
for(i in 8:153){
hist.to.plot <- histogram(~ data[,i] | data[,2],
data
=
data
,,ylab
=
"Frequency
",xlim=c(1,5),xlab="Score",ylim=c(0,100)),main=paste(colnames(data)
[i],sep="")
plot(hist.to.plot)
}
Cheers,
Tal
----------------------------------------------
My contact information:
Tal Galili
E-mail: tal.gal...@gmail.com
Phone number: 972-52-7275845
FaceBook: Tal Galili
My Blogs:
http://www.talgalili.com (Web and general, Hebrew)
http://www.biostatistics.co.il (Statistics, Hebrew)
http://www.r-statistics.com/ (Statistics,R, English)
On Tue, Nov 17, 2009 at 7:09 AM, ychu066 <ychu...@aucklanduni.ac.nz>
wrote:
tried but still doesnt work ...
very weird ...
ychu066 wrote:
here is the codes that i tried.....
png(paste("hist",i,".png",sep="")
+ library(lattice)
Error: unexpected symbol in:
"png(paste("hist",i,".png",sep="")
library"
for(i in 8:153){
+ histogram(~ data[,i] | data[,2],
data=data,ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100)))
Error: unexpected ')' in:
"for(i in 8:153){
histogram(~ data[,i] | data[,2],
data=data,ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100)))"
}
Error: unexpected '}' in "}"
dev.off()
Error in dev.off() : cannot shut down device 1 (the null device)
ychu066 wrote:
still doesnt work ...
Karl Ove Hufthammer wrote:
On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 <ychu066
@aucklanduni.ac.nz> wrote:
And I also want to save each histogram in each separate pdf
file using
the
following codes ?.
png("hist.png[i]")
dev.off()
Try png(paste("hist",i,".png",sep="") instead.
--
Karl Ove Hufthammer
______________________________________________
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.
--
View this message in context:
http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26384489.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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.
[[alternative HTML version deleted]]
______________________________________________
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.
______________________________________________
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.