I'm working on visualizing a matrix in R (almost exactly like http://reference.wolfram.com/mathematica/ref/MatrixPlot.html), and I've been using
image(<matrix>,axes=FALSE)
to draw the picture. However, I noticed that with the y-axis turned off, the plot isn't centered--the space is still there for the axis ticks + label. I can finag...
I'm looking for some LaTeX template for creating quality output. On R-bloggers I've bumped on Frank Harrel's Rreport package. Due to my quite modest LaTeX abilities, only a user-friendly (and noob-friendly) interface should suffice. Here's a link to an official website. I'm following the instructions, but I cannot manage to install an ap...
From a data frame with timestamped rows (strptime results), what is the best method for aggregating statistics for intervals?
Intervals could be an hour, a day, etc.
There's the aggregate function, but that doesn't help with assigning each row to an interval. I'm planning on adding a column to the data frame that denotes interval a...
I am going through one of my .R files and by cleaning it up a little bit I am trying to get more familiar with writing the code the r-ight way. As a beginner, one of my favorite starting points is to get rid of the for() loops and try to transform the expression into a functional programming form.
So here is the scenario:
I am assemblin...
I noticed a strange malfunction in using findFn function (library sos) and I can't find out the source. While it works fine on my Windows XP pc, it does not on my Vista one.
library (sos)
findFn("randomization test")
# in both finds 72 results
findFn("{randomization test}")
# In XP finds 19 or about so, but in Vista whenever I use {} ...
Hi all,
I have a (somewhat complex) web scraping challenge that I wish to accomplish and would love for some direction (to whatever level you feel like sharing) here goes:
I would like to go through all the "species pages" present in this link:
http://gtrnadb.ucsc.edu/
So for each of them I will go to:
The species page link (for ex...
Hi guys ,
How do I specify random factors in R ?
If I have a factor x1 which is supposed to be random , can I try something like this ?
lm(y ~ x1, data = p)
...
Im trying to run a model with a response variable p and 3 fixed factors to get ANOVA. this is how my code looks like :
#run it as 3 fixed factor model
p1=c(37,38,37,41,41,40,41,42,41)
p2=c(42,41,43,42,42,42,43,42,43)
p3=c(30,31,31,31,31,31,29,30,28)
p4=c(42,43,42,43,43,43,42,42,42)
p5=c(28,30,29,29,30,29,31,29,29)
p6=c(42,42,43,45,45...
I have a couple of questions regarding facetting in ggplot2...
Let's say I have a query that returns data that looks like this:
(note that it's ordered by Rank asc, Alarm asc and two Alarms have a Rank of 3 because their Totals = 1798 for Week 4, and Rank is set according to Total for Week 4)
Rank Week Alarm To...
The following code is supposed to created a heatmap in rpy2
import numpy as np
from rpy2.robjects import r
data = np.random.random((10,10))
r.heatmap(data)
However, it results in the following error
Traceback (most recent call last):
File "z.py", line 8, in <module>
labRow=rowNames, labCol=colNames)
File "C:\Python25\lib\...
I'm looking for a faster way to calculate GC content for DNA strings read in from a FASTA file. This boils down to taking a string and counting the number of times that the letter 'G' or 'C' appears. I also want to specify the range of characters to consider.
I have a working function that is fairly slow, and it's causing a bottleneck...
Here is a simple randomized experiment.
In the following code I calculate the p-value under the null hypothesis that two different fertilizers applied to tomato plants have no effect in plants yields.
The first random sample (x) comes from plants where a standard fertilizer has been used, while an "improved" one has been used in the pl...
I'm trying to practice writing better code, so I wanted to validate my input sequence with regex to make sure that the first thing I get is a single letter A to H only, and the second is a number 1 to 12 only. I'm new to regex and not sure what the expression should look like. I'm also not sure what type of error R would throw if this ...
Hello,
R offers max and min, but I do not see a really fast way to find the another value in the order apart from sorting the whole vector and than picking value x from this vector.
Is there a faster way to get the second highest value (e.g.)?
Thanks
...
Hi all,
I want to use R to do string parsing that (I think) is like a simplistic HTML parsing.
For example, let's say we have the following two variables:
Seq <- "GCCTCGATAGCTCAGTTGGGAGAGCGTACGACTGAAGATCGTAAGGtCACCAGTTCGATCCTGGTTCGGGGCA"
Str <- ">>>>>>>..>>>>........<<<<.>>>>>.......<<<<<.....>>>>>.......<<<<<<<<<<<<."
Say that I wa...
Greetings to all
This is my model: aov.fit<-aov(Y~A+B+C+D+E+A:C+A:E, data=dat)
In summary(aov.fit) all F values are computed by eg MS(A)/MS(Residuals). This is not correct (or what I want), except for F(B) and F(A:E). I suppose P values are not correct either.
Can I specify how the F computations will be done? I 'd like them to be lik...
I have a problem where I have to add thirty-three integer vectors of equal length from a dataset in R. I know the simple solution would be
Vector1 + Vector2 + Vector3 +VectorN
But I am sure there is a way to code this. Also some vectors have NA in place of integers so I need a way to skip those. I know this may be very basic but I am ...
In R, how can I print a character list from A to Z? With integers I can say:
my_list = c(1:10)
> my_list
[1] 1 2 3 4 5 6 7 8 9 10
But can I do the same with characters? e.g.
my_char_list = c(A:Z)
my_char_list = c("A":"Z")
These don't work, I want the output to be: "A" "B" "C" "D", or separated by commas.
Thanks.
...
Hi,
is it possible to return a HashMap to R with the rJava extension of R?
E.g. I have a method in Java, which returns a HashMap and I want this HashMap use in R. I tried:
.jcall(javaObj, "Ljava/util/HashMap", "getDbInfoMap")
This doesn't work.
Do I have to put everything into a String[], that I want to pass to R from Java?
Or is th...
Why do I see a difference when I convert a unix timestamp to datetime object in R?
> as.POSIXlt(1268736919, origin="1970-01-01", tz="America/New_York")
[1] "2010-03-16 06:55:19 EDT"
> as.POSIXct(1268736919, origin="1970-01-01", tz="America/New_York")
[1] "2010-03-16 11:55:19 EDT"
The result from POSIXlt is actually correct.
Also, is...