please post more questions and comments. Example of syntax highlighting:
help('sink'); # can be used to record output to a file. Use split=TRUE to display output on screen as well
I learned how to use R about a year ago for some research.
Here are some useful pointers:
1) If you are looking for a nice IDE for R, try out StatET. It is a plugin for eclipse.
2) If you are looking for a good book to learn R, try R in a Nutshell.
A lot of learn how to use R books are for people new to programming. This book assumes you know how to program and really goes into specifics.
3) If you are looking for some good R coding conventions, see http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html.
In a comment on the other thread, I posted a website for color maps, particularly colorblind-safe color maps. This is important for ggplot2 because the color maps can be changed to any of the ones listed on the website Color Brewer.
last_plot() + scale_color_brewer('Name of color map from website')
This will generate the plot and then change the color map and regenerate the plot. If you don’t want to do the first rendering (since you are changing the color map anyway), you can do:
myPlot <- qplot(...)
myPlot + scale_color_brewer(...)
and the figure will render on the second command.
how does one go about creating multiple figures (not multiple plots on one figure)?
trying to have multiple plots appear separately or in addition to and not overwrite pre-existing plot. kind of like using “figure()” in matlab to create a new figure space.
You have to create multiple graphics devices. A graphics device can be a figure on the screen (x11() or linux, quartz() on mac etc) or a file device like pdf() or png() which saves the figure to a file in that format. To create multiple devices see http://cran.r-project.org/doc/manuals/R-intro.html#Multiple-graphics-devices for an explanation. For example in linux you would have multiple calls to x11() function to create multiple screen drivers and then alternate between them (see the above link). Also, note the function ggsave that let’s you easily save ggplot2 figures to disk as pdf/ps/png.
there are packages that exist that one (i, myself) can’t seem to install simply by install.packages(“rgdal”) but instead download it from CRAN.r directly? so i went and did that and then tried to install by any/all below commands:
> install.packages(“rgdal”, lib.loc=”/my/own/R-packages/”)
i get the error that ‘rgdal’ is not available. i’ve been trying to read this for help:
(which does not appear to be composed by anyone who has ever sought help from a manual)
Are you using windows? Sec 6.3.1 at the link that you cite bove talk about windows specific compilation problems. In any case I don’t know much more about this so I can’t help here.
Which version of R are you using? some packages are version dependent.
It is nice information in this blog about I posted a website for color maps, color blindness color chart particular security. This is important because ggplot2 color maps can be changed at all those listed on the site
. I recommend to other for joining here to know more about this site.
Thought this article by Robert Gentleman was interesting…
Question on sampling the data – the sampling below with replace either TRUE or FALSE always return me the same data:
sample(nrow(movies), size=10, replace=TRUE)
sample(nrow(movies), size=10, replace=FALSE)
They return different sets of indexes but the same sets always.
I first noticed it when I was looking at a small set of indexes but then I tried with a larger set of indexes and still the same.
Any suggestions would be appreciated.
that’s probably because nrow(movies) is much larger than size and there is very little probability in this case of seeing a difference. You will see a difference for example in
sample(10,10) # permutation of 1,..,10
sample(10,10,replace=TRUE) # most likely you will see some repeating values
You must be logged in to post a comment.