R's qplot function has a nifty alpha parameter for shading coincident points in a scatter plot darker. Here it is in action:
http://www.decisionsciencenews.com/2010/07/01/maps-without-map-packages
I'm wondering how to do the same in Mathematica.
Here's code to grab the data from the above article and plot it, without the nifty shading...
http://picasaweb.google.com/lh/photo/F-p2qK3itxJsgj1tLLGsow?feat=directlink
If you look at the picture, theres this usage bit from the R help files at the bottom in the minbuffer.
howd i do that? it somehow just appeared, maybe cos i mashed the keyboard trying to run the commands.
It disappeared when i restarted emacs:(
thanks
...
Using position_jitter creates random jitter to prevent overplotting of data points.
In the below I have used the example of baseball statistics to illustrate my problem. When I plot the same data with two layers, the same jitter call jitters the geoms a bit differently.
This makes sense because it presumably generates the random jitter ...
Hi,
I find myself having to do this very often -- compare specific columns from 2 different files. The columns, formats are the same, but the columns that need comparison have floating point/exponential format data, e.g. 0.0058104642437413175, -3.459017050577087E-4, etc.
I'm currently using the below R code:
test <- read.csv("C:/VBG...
I recently upgraded R to 2.11.1 from 2.10.0 and now my package installation fails:
$ R CMD INSTALL --build blah_1.0.tar.gz
* installing to library 'c:/PROGRA~1/r/R-211~1.1/library'
* installing *source* package 'blah' ...
** libs
making DLL ...
... done
ERROR: compilation failed for package 'blah'
* removing 'c:/PROGRA~1/r/R-211~1.1...
Hi I'm using facets in ggplot2 to plot the distribution of expression in a large number of genes. My plotting commands are pretty generic:
p <- ggplot(top_n,aes(x=value,fill=ptype))
p <- p + geom_density(alpha = 0.2)
p <- p + facet_wrap(~probe,...)
they just plot the data in top_n as distributions coloured according to the ptype varia...
I'm trying to use regular expressions in R to find one or more phrases within a vector of long sentences (which I'll call x).
So, for example, this works fine for one phrase:
grep("(phrase 1)",x)
But this doesn't work for two (or more) phrases:
grep("(phrase 1)+(phrase 2)+",x)
As I would expect. As I read it, this last one should ...
i'd like to do large-scale regression (linear/logistic) in R with many (e.g. 100k) features, where each example is relatively sparse in the feature space---e.g., ~1k non-zero features per example.
it seems like the SparseM package slm should do this, but i'm having difficulty converting from the sparseMatrix format to a slm-friendly for...
Hi all,
I have the following 2 data.frames:
a1 <- data.frame(a = 1:5, b=letters[1:5])
a2 <- data.frame(a = 1:3, b=letters[1:3])
I want to find the row a1 has that a2 doesn't.
Is there a built in function for this type of operation?
(p.s: I did write a solution for it, I am simply curious if someone already made a more crafted code)...
Or a list of how to do in R things you do in SQL (or vise versa) ?
Thanks,
Tal
...
Is there any way to set the background color of plots constructed using the base R function persp()?
bg="black" is ignored either when supplied to persp() or previously to par()
Thanks
...
format(Sys.Date(),"%m") returns "07", but I'd like it to return "7" while still returning two characters when needed. adding width=8 to the argument list doesn't help, nor does anything else I've tried.
My end goal is to make the stock quote reading function on p. 182 of R in a Nutshell work properly.
...
Hi all,
I wish to recreate this graph:
(from here)
Using R base graphics.
I have no clue how to do that. Any advice ?
(My motivation is that I wish to create a plot where the line width (and/or color) will reflect another dimension. Until now - ggplot2 is the only place I found in R for how to do this. I would be happy to be able...
I'm gluing together a number of system calls using the Amazon Elastic Map Reduce command line tools. These commands return JSON text which has already been (partially?) escaped. Then when the system call turns it into an R text object (intern=T) it appears to get escaped again. I need to clean this up so it will parse with the rjson pack...
suppose n=3
then output should be: a vector containing vectors:
123
213
132
231
321
...
What is the difference between .tar.gz or .tgz files installed by R CMD install and install.packages()? I have made an example package with R CMD build, which I can currently install with R CMD install mypackage.tar.gz - and it works fine. I want to be able to install it through the install.packages() function (with a call like install.p...
When I'm generating graphics for publications and talks, I tend to use ggplot2. However, for very large data sets where I want to generate a quick plot or for courses where students don't have a good grounding in R, I use the base graphics.
Are there any nice (simple!) ways of spicing up R graphics? For example, do you use a nice combin...
I have input data that contain lines like this:
-0.438185 -0.766791 0.695282
0.759100 0.034400 0.524807
How can I create a data structure in R that looks like this:
[[1]]
[1] -0.438185 -0.766791 0.695282
[[2]]
[1] 0.759100 0.034400 0.524807
...
I find it hard to sort through all the messages in the R frame(?) in emacs, and I was wondering if it'll be easy to change the colours so that it looks more like the R GUI.
Thanks
...
Is there a simple way of identifying the number of times a value is in a vector or column of dataframe? I essentially want the numerical values of a histogram but I do not know how to access it.
# sample vector
a <- c(1,2,1,1,1,3,1,2,3,3)
#hist
hist(a)
Thank you.
UPDATE:
On Dirk's suggestion I am using hist. Is there a better way t...