Here's my situation. I have an object that I've created using read.spss.
> a <- read.spss(...)
> attach(a)
Now in this object (a) is a set questions that I would like to pull out that follows a sequence of question numbers.
> q3 <- data.frame(q3_1, q3_2, q3_4, ... q3_27)
Is there a way to automate it such that it pulls out all que...
I have two random variables:
X ~ binom(n, p1)
Y ~ binom(n, p2)
n is a known parameter (the total number of trials), while p1 and p2 are unknown.
I have one sample from each distribution (x from X, and y from Y). To give some context, x and y are numbers of true positives from two different classifiers, at a fixed selectivity.
I woul...
I have a density object dd created like this:
x1 <- rnorm(1000)
x2 <- rnorm(1000, 3, 2)
x <- rbind(x1, x2)
dd <- density(x)
plot(dd)
Which produces this very non-Gaussian distribution:
I would ultimately like to get random deviates from this distribution similar to how rnorm gets deviates from a normal distribution.
The way I ...
Is there a mode in emacs that does syntax highlighting for the R programming language? R-mode doesn't seem to work...
...
I'm trying to write a function to automate doing a variance analysis, part of which involves doing some further calculations. The method I've been using isn't very robust, if variable names change then it stops working.
For this dummy data
> dput(assayvar,"")
structure(list(Run = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L,
3L, 3L, 4L, 4L...
could you please give an example on how that might be done using the doSNOW ?
(I asked the same question here:
http://blog.revolution-computing.com/2009/08/parallel-programming-with-foreach-and-snow.html
And got only a partial reply)
Tal
...
I'm using ggplot2 to make some bullseye charts in R. They look delightful, and everyone is very pleased - except that they'd like to have the values of the bullseye layers plotted on the chart. I'd be happy just to put them in the lower-right corner of the plot, or even in the plot margins, but I'm having some difficulty doing this.
H...
In R on windows, tempdir() returns a path that contains short names for non 8dot3 directory names. How do I expand those to long names? An answer that uses pure R code is favorable, but one that uses well-known shell commands used via system() is fine as a backup.
...
I would like to improve my C skills in order to be more competent at converting R code to C where this would be useful. What hints do people have that will help me on my way?
Background: I followed an online Intro to C course a few years ago and that plus Writing R Extensions and S Programming (Venables & Ripley) enabled me to convert b...
Let's say I have a matrix x which contains 10 rows and 2 columns. I want to generate a new matrix M that contains each unique pair of rows from x - that is, a new matrix with 55 rows and 4 columns.
E.g.,
x <- matrix (nrow=10, ncol=2, 1:20)
M <- data.frame(matrix(ncol=4, nrow=55))
k <- 1
for (i in 1:nrow(x))
for (j in i:nrow(x))
{
...
Hello, I was wondering if anyone knew of a good way to get R or ESS to stop executing the rest of the code beyond the point at which an error occurs if I am evaluating a region or buffer (I've only found the opposite request in the help archives). I was looking in the R help files but option(error=stop) will only stop execution of the of...
@Totovader just asked if there are other packages for doing Venn diagrams in R besides the limma package. Anyone got tips?
Here's some notes on doing Venn diagrams with the limma packages.
...
Does anyone know of an R package that solves the longest common substring problem? I am looking for something fast that could work on vectors.
...
Does anyone have any wisdom on workflows for data analysis related to custom report writing? The use-case is basically this:
Client commissions a report that uses data analysis, e.g. a population estimate and related maps for a water district.
The analyst downloads some data, munges the data and saves the result (e.g. adding a column ...
I've never been able to figure out how to get the PgDn/PgUp keys to work in the R Graphics Viewer. Even the demo() programs don't seem to support it. Anyone able to point me to some code that shows how this can be implemented?
Thanks,
Phil
...
The function below works perfectly for my purpose. The display is wonderful. Now my problem is I need to be able to do it again, many times, on other variables that fit other patterns.
In this example, I've output results for "q4a", I would like to be able to do it for sequences of questions that follow patterns like: q4 < a - z > or q...
Hi, does anyone know how to use R to plot a histogram with the columns stacked up by more than 1 variables? Like the "stacked column" graph in excel.
Thank you!
...
We all love robust measures like medians and interquartile ranges, but lets face it, in many fields, boxplots almost never show up in published articles, while means and standard errors do so all the time.
It's simple in lattice, ggplot2, etc to draw boxplots and the galleries are full of them. Is there an equally straightforward way to...
Is rjava the only way to connect R to Java? I am asking because there is a disclaimer at the end of the web page:
This interface uses Java reflection
API to find the correct method so it
is much slower and may not be right
(works for simple examples but may not
for more complex ones). For now its
use is discouraged in progr...
I've learned R by toying, and I'm starting to think that I'm abusing the tapply function. Are there better ways to do some of the following actions? Granted, they work, but as they get more complex I wonder if I'm losing out on better options. I'm looking for some criticism, here:
tapply(var1, list(fac1, fac2), mean, na.rm=T)
tapply(va...