Anyone know how to take advantage of ggplot or lattice in doing survival analysis? It would be nice to do trellis/facet like survival graphs.
So in the end I played around and sort of found a solution for a kaplan meier plot. Apologize for the messy code in taking the list elements into a dataframe, but I couldnt figure out another wa...
I'm trying to create a ggplot2 plot with the legend beneath the plot.
The ggplot2 book says on p 112 "The position and justification of legends are controlled by the theme setting legend.position, and the value can be right, left, top, bottom, none (no legend), or a numeric position".
The following code works (since "right" it is the ...
I have some data that I am trying to plot faceted by its Type with a smooth (Loess, LM, whatever) superimposed. Generation code is below:
testFrame <- data.frame(Time=sample(20:60,50,replace=T),Dollars=round(runif(50,0,6)),Type=sample(c("First","Second","Third","Fourth"),50,replace=T,prob=c(.33,.01,.33,.33)))
I have no problem either...
When running this code (go ahead, try it):
library(ggplot2)
(myDat <- data.frame(cbind(VarX=10:1, VarY=runif(10)),
Descrip=sample(LETTERS[1:3], 10, replace=TRUE)))
ggplot(myDat,aes(VarX,VarY,shape=Descrip,size=3)) + geom_point()
... the "size=3" statement does correctly set the point size. However it causes the legend to give bi...
R users are advised to download R and R packages from local CRAN mirrors. But some are outdated. Is there an easy way to check if a repository is outdated? Any function in R that does that?
...
Hi everybody,
I tried to pass a filepath to a function in R, but I failed =/ I hope someone here can help me.
>heat <- function(filepath)
{ chicks <- read.table(file=filepath, dec=",", header=TRUE, sep="\t")
...
}
When I call the function, nothing happens...
>heat("/home/.../file.txt")
... and "chicks" is not found
>chicks
Error...
Hi,
I'm working with R and I have a code like this:
for (i in 1:10)
for (j in 1:100)
if (data[i] == paths[j,1])
cluster[i,4] <- paths[j,2]
where :
data is a vector with 100 rows and 1 column
paths is a matrix with 100 rows and 5 columns
cluster is a matrix with 100 rows and 5 columns
My question is: how cou...
Hi stackoverflow-pros,
I need your help again :)
I wrote an R script, that generates a heatmap out of a given tab-seperated txt or xls file. At the moment, I delete all columns I don't want to have in the heatmap by hand in the xls file.
Now I want to automatize it, but I don't know how :(
The interesting columns all start the same i...
Hello all,
I wish to search twitter for a word (let's say #google), and then be able to generate a tag cloud of the words used in twitts, but according to dates (for example, having a moving window of an hour, that moves by 10 minutes each time, and shows me how different words gotten more often used throughout the day).
I would apprec...
I have five shapefiles of bordering counties in California that I am trying to combine into one large shapefile and maintain the original borders of the counties. I then want to plot points such as this so the map only needs to be a simple map of county boundaries. Is there a way to do this in R or will I have to use something like Arc...
I'm fitting some exponential data using nls.
The code I'm using is:
fit <- nls(y ~ expFit(times, A, tau, C), start = c(A=100, tau=-3, C=0))
expFit is defined as
expFit <- function(t, A, tau, C)
{
expFit <- A*(exp(-t/tau))+C
}
This works well for most of my data, for which the starting parameters provided (100, -3 and ...
The title says it all. The objective is to have two simple ways to source some code, say func.R, containing a function. Calling R CMD BATCH func.R initializes the function and evaluates is. Within a session, issuing source("func.R") simply initializes the function.
Any idea?
...
I have a set of days-each with a 0/1 code- for the presence of an event I will call 'visit.'
For example for day 1 to day 12 I could have the vector (0,0,1,0,1,1,1,1,0,0,0,1) when I have a visit on days 3,5,6,7,8, and 12. I would like to apply some function that will give me the vector (1,4,1) which will imply 3 groups of visits of dur...
So there is R for 64-bit Windows users now. I'd like to know if anyone has found incremental benefits in using R-64bit over the 32bit version on Windows.
I'm looking for more specific information
What was the system specification (6gb RAM for example) and the largest data-set that was crunched ?
Which algorithm performed faster ?
Any...
Hi, I have what is probably a really dumb grep in R question. Apologies, because this seems like it should be so easy - I'm obviously just missing something.
I have a vector of strings, let's call it alice. Some of alice is printed out below:
T.8EFF.SP.OT1.D5.VSVOVA#4
T.8EFF.SP.OT1.D6.LISOVA#1
T.8EFF.SP.OT1.D6.LISOVA#2
T.8EFF....
Thanks to Hadley's plyr package ddply function we can take a dataframe, break it down into subdataframes by factors, send each to a function, and then combine the function results for each subdataframe into a new dataframe.
But what if the function returns an object of a class like glm or in my case, a c("glm", "lm"). Then, these can't ...
I have a table with >2M rows. I am only interested in percentiles of one variable vs. percentiles of number of observations (e.g. Lorentz curve).
How do I create a smaller dataframe that contains e.g. observations number 1,101,201,301,...,last , or observations that corresponds to e.g. the 1,2,3,...,100 percentile of total number of ob...
I was wondering if it is possible to extract nouns, verbs separately in R package openNLP?
I use the the tagPOS function which tags the sentence but what to do in case I want to extract verbs, nouns separately.
...
Hi guys,
I would like to create an R package which would include classes, methods and functions.
The thing is, I managed to create it on Linux (and it is working on Linux), but I can't make the same package work on Windows (which is my main OS).
What I tried to do (maybe it was a bit foolish) was to convert the tar.gz into a Zip file ...
I have some .Rdata files that contain saved functions as defined by approxfun().
Some of the save files pre-date the change to approxfun from package "base" to "stats", and so the body has
PACKAGE = "base"
and the wrong package causes the function to fail. I can fix(myfun) and simply replace "base" with "stats", but I want a neater a...