I just wanted the post the results of the emails I been sending/getting. The
following command will create the graphs and save them to the location of
your choice. The names are graph1.png, graph2.png etc.
for(i in 1:4) {
png( file=paste(C:/Insert file location/graph,i,.png, sep=) )
I have 4 columns and 56 rows of made up data that I want to plot as a series
of bar graphs. The idea is to create one bar graph for each of the 4 columns
using a for loop. I tried the following command in RStudio and when I type x
in the console I get just the 4th graph instead of all four graphs.
Hi,
You actually did the loop correctly. The problem is that the graphs
were created very quickly so you only see the last one. One way
around this is to make R wait for user input. You can turn this on
and off for a particular device using:
par(ask = TRUE)
See ?par for details on this.
To
On Jul 12, 2011, at 3:21 PM, wwreith wrote:
I have 4 columns and 56 rows of made up data that I want to plot as
a series
of bar graphs. The idea is to create one bar graph for each of the 4
columns
using a for loop. I tried the following command in RStudio and when
I type x
in the console
On Tue, Jul 12, 2011 at 2:01 PM, Reith, William [USA]
reith_will...@bah.com wrote:
Do I need to define x in any way before I do the loop?
No, you should not need to define x explicitly. Just pass the data
frame you want to qplot. David was absolutely right though that
inside a loop, you should
5 matches
Mail list logo