When using R's rpart function, I can easily fit a model with it. for example:
# Classification Tree with rpart
library(rpart)
# grow tree
fit <- rpart(Kyphosis ~ Age + Number + Start,
method="class", data=kyphosis)
printcp(fit) # display the results
plotcp(fit)
summary(fit) # detailed summary of splits
# plot tree
plot(fit, ...
I have been struggling to load the rJava package in R.
I get the following messages
> library(rJava)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared library \
'C:/PROGRA~1/R/R-210~1.1/library/rJava/libs/rJava.dll':
LoadLibrary failure: The specified module could not be found.
Error : .onL...
Hello,
I want an stacked barplot, or at least two barplots (histogramms) of the data below. But I cant't figure out how. plot(online) is not the solution, I´m looking for. Please see below.
online offline
1 sehrwichtig wichtig
2 wichtig unwichtig
3 sehrwichtig ...
I'm trying to override the text in some ggplot strips to incorporate Greek characters. Here's some sample data, and the base for the plot.
dfr <- data.frame(
x = rep(1:10, times = 6),
y = runif(60),
fx = rep(c("foo", "bar"), each = 30),
fy = rep(c("alpha", "beta", "gamma"), each = 10, times = 2)
)
p <- ggplot(dfr, aes(x, y...
I have a data frame where one particular column has a set of specific values (let's say, 1, 2, ..., 23). What I would like to do is to convert from this layout to the one, where the frame would have extra 23 (in this case) columns, each one representing one of the factor values. The data in these columns would be booleans indicating whet...
I want to plot stacked histograms in R; i.e. stack individual histograms in the third dimension.
Here's an example: http://www.denovosoftware.com/images/3d_fill_histo1.gif
...
I am working with a data frame where one of the columns consists of POSIXct date-time values. I am trying to plot a histogram of these timestamps using ggplot2 but I'm having two issues:
I don't know how to set the binwidth in geom_histogram(). I'd like to set each bin to a day or a week. I've tried providing a difftime object, but ...
Using ggplot I normally use geom_text and something like position=jitter to annotate my plots.
However - for a nice plot I often finds it worthwhile to annotate manually. like below:
data2 <- structure(list(type = structure(c(5L, 1L, 2L, 4L, 3L, 5L, 1L,
2L, 4L, 3L, 5L, 1L, 2L, 4L, 3L, 5L, 1L, 2L, 4L, 3L), .Label = c("EDS",
"KIU", "LA...
I started using Emacs (ESS) as a default R editor (yes, @Dirk, as you've said, I want ESS), and I must admit it's by far the best R editor I've been using so far. However, I cannot manage to get an output of help() function up to web browser. It keeps displaying help page in a separate R buffer, even if options(help_type = "html", brows...
Hi, I'd like to begin thinking about how I can scale up my algorithms that I write for data analysis so that they can be applied to arbitrarily large sets of data. I wonder what are the relevant concepts (threads, concurrency, immutable data structures, recursion) and tools (Hadoop/MapReduce, Terracota, and Eucalyptus) to make this happe...
What good resources are there for R idioms, in the same line as there are for Java and Python?
...
JD Long helped me with this: question about manual annotation. But is it possible to do something similar on a facetted plot, such that the label style corresponds to the linestyle (aestetics) and in a way that I can annotate different facets individually?
Some data
funny <- structure(list(Institution = structure(c(1L, 1L, 1L, 1L, 2L,
...
I'd like to write an R function that accepts a formula as its first argument, similar to lm() or glm() and friends. In this case, it's a function that takes a data frame and writes out a file in SVMLight format, which has this general form:
<line> .=. <target> <feature>:<value> <feature>:<value> ... <feature>:<value> # <info>
<target> ...
From the online bar chart guide:
qplot(factor(cyl), data=mtcars, geom="bar", fill=factor(gear))
How do I get 5 to sit on the bottom, 4 above that, and 3 on top?
...
(This is a database / R commands question)
I wish (for my thesis work), to import tRNA data into R and have it aligned.
My questions are:
1) What resources can I use for the data.
2) What commands might help me with the import/alignment.
So far, I found two nice repositories that holds such data:
tRNAdb at the University of Leipzig
...
How can I build a function
slice(x, n)
which would return a list of vectors where each vector except maybe the last has size n, i.e.
slice(letters, 10)
would return
list(c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j"),
c("k", "l", "m", "n", "o", "p", "q", "r", "s", "t"),
c("u", "v", "w", "x", "y", "z"))
?
...
Hi,
I have the following problem.
First my environment, I have two 24-CPU servers to work with and one big job (resampling a large dataset) to share among them. I've setup multicore and (a socket) Snow cluster on each. As a high-level interface I'm using foreach.
What is the optimal sharing of the job? Should I setup a Snow cluster...
Is it possible, in the expr expression of the with() function, to access the data argument directly? Here's what I mean conceptually:
> print(df)
result qid f1 f2 f3
1 -1 1 0.0000 0.1253 0.0000
2 -1 1 0.0098 0.0000 0.0000
3 1 1 0.0000 0.0000 0.1941
4 -1 2 0.0000 0.2863 0.0948
5 1 2 0.0000 0...
If I have some R list mylist, you can append an item obj to it like so:
mylist[[length(mylist)+1]] <- obj
But surely there is some more compact way. When I was new at R, I tried writing lappend() like so:
lappend <- function(lst, obj) {
lst[[length(lst)+1]] <- obj
return(lst)
}
but of course that doesn't work due to R's c...
I accidentally managed to get colour names, #HEX, and a colour preview in Emacs. Don't have a bloody idea how, must've pressed some keybinding or menu item... But, now I can't seem to find where's that feature... I'm quite sure I wasn't hallucinating, so it's gotta be there, under some keystroke that I can't reproduce!!! =)
...