[R] Histograms of lots of variables

jim holtman jholtman at gmail.com
Mon Apr 16 23:56:38 CEST 2007


I forgot that win.metafile can only output one graph.  This will write
separate files:

lapply(3:20, function(.ind){
    win.metafile(filename=paste("file.", .ind, ".wmf", sep=''))
    hist(dataframe[[.ind]], main=paste("dataframe[[", .ind, "]]",
sep=''), xlab="")
    dev.off()
})


On 4/16/07, mtb954 at gmail.com <mtb954 at gmail.com> wrote:
> Hi R-helpers,
>
> I wish to produce frequency histograms of all of the variables in my
> dataframe (except some identifying variables).
>
> I have tried
>
> >hist(dataframe[,3:20])
>
> to produce histograms of the 3rd through 20th variables in my dataframe, but
> R doesn't like that.
>
> Could anyone provide a suggestion?
>
> Also, once I produce the histograms, I'd like to save them as graphic files
> on my computer. How would I do that using code (rather than Right-click |
> Save as metafile, which would be tedious for dozens of histograms).
>
> Thanks, Mark
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list