I'm working on a big Sweave document/script on a Mac OS X system, R version 2.9.2. Under some circumstances, it appears as if Sweave is redirecting stdout, so that x <- 1; print(x) gives nothing at all. (The console is still running, as plot(x) pops up a plot as normal.) So, two questions:
How do I force stdout to go back to the consol...
In R (statistical computing environment) I would like on a generic plot, with time on the x-axis, highlight some specific years.
How can I bestly do this? My idea is for example a light yellow bar for the highlighted years, behind the plot of course.
The plot code I have now:
pdf("temperature_imfs_big_interm5.pdf", width=6, height=8);...
This is a simple problem, but for the life of me I cannot find the answer.
I have a vector of numbers:
numbers <- c(4,23,4,23,5,43,54,56,657,67,67,435,453,435,324,34,456,56,567,65,34,435)
I want to R to count the number of times a value "x" appears in the vector.
Any help?
...
not only is googling R so terribly difficult, log4r has also been taken for Ruby!
I am looking for the standard (if any) logging package for R. and some sample usage?
I also don't see it in http://cran.r-project.org/web/packages/
(late edit: it is now at its place on CRAN and there's a R-Forge page for it.)
...
Hello,
this seems to be an easy task really, but being completely new to the world of programming, I have problems with the following task:
I have a huge file which has the following format:
track type= wiggle name09
variableStep chrom=chr1
34 5
36 7
54 8
variableStep chrom=chr2
33 4
35 2
78 7
this is text with the word random in...
I have a data frame with two columns (data will not always be identical).
1 1
2 2
3 3
0 0
-1 -1
-2 -2
-3 -3
What I would like to do is create another column for the top 10% of the column and the bottom 10% of the column to be used as labels for a scatter plot.
1 1
2 2
3 3 1
0 0
-1 -1
-2 -2
-3 -3 2
In addition, it need...
Here is a question for R-users. I am interested in drawing a histogram with points stacked up, instead of a bar. For example if the data is (1,1,2,1,2,3,3,3,4,4), then I would like to see three points stacked up at 1, 2 points stacked up at 2 and so on. What is the best way to do this in R?
...
Is it possible to reposition the labels such that in sector (-x,y) the label is on the left and sector (+x,y) the label is on the right?
...
I am trying to output about 250 plots from an r-script and I'm receiving this error. Is there some setting that I can adjust to avoid this problem?
Here is an example of how I am creating the plots:
for(x in 250) {
plots <- ggplot(data=dat, aes(x,y,lab=labels))
jpeg(a_paste_function)
print(plots)
}
One thing I notice is that, whe...
What are some advantages and disadvantages to doing statistical analyses in SciPy vs. R? They seem to have been designed with opposite philosophies (plain old library vs. DSL). What are some rules of thumb about which is the right tool for the job?
...
Which conventions for naming variables and functions do you favor in R code?
As far as I can tell, there are several different conventions, all of which coexist in cacophonous harmony:
1. Use of period separator, e.g.
stock.prices <- c(12.01, 10.12)
col.names <- c('symbol','price')
Pros: Has historical precedence in the R...
With R. For a sequence of numbers x, how do I best create a function S(x, r, s) that computes sum(x[t]*x[t+r-s], t ranges from s to length(x)-r+1; r,s>0. Thanks.
...
I have a time series of data in TSV like so:
ID \t Date \t Value
-------------------------------
1234567 \t 2009-01-01T00:00:00.000Z \t 121
12131 \t 2009-06-01T00:00:00.000Z \t 151
12131 \t 2009-07-01T00:00:00.000Z \t 15153
...
It easily fits in RAM, but is too big for Excel.
There is one value per month per ID, but not all IDs have ...
On one of my PCs, when I build any R package I get the following fatal error
* checking for file 'forecast/DESCRIPTION' ... OK
* preparing 'forecast':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* removing junk files
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* ...
Question: how can you create a pdf where the output is vertically
justified, with for example, a one inch margin on top using pdf().
For example in
pdf(file='test.pdf', paper='letter', pagecentre=F)
### code for plot here ###
dev.off()
is there an option where it generate output that starts from the top of the
page rather than print...
I'm now reading some books of R, but I want to know if I can use this language as I use Perl or Ruby. Things like:
Image Processing
File Compression
Use APIs
Interact With Internet
But it's usual and simple(as in Perl or Ruby) to do things like this?
PS: I liked this language very much, because of this I want to use it on my persona...
Hello and Happy Ho Ho,
I have a data.frame, like this:
nums<-c(5,7,8,9,10,3,2,1)
text<-c("a","b","c","d","a 09","b 09","c 09","d 09")
this <- data.frame()
this <- cbind(text,nums)
"a" 5
"b" 7
"c" 8
"d" 9
"a 09" 10
"b 09" 3
"c 09" 2
"d 09" 1
a:d = data from 2010, a 09:d:09 = data from 2009.
I'd like it to be sorted first b...
I want to import an XML file from polarpersonaltrainer.com that stores heartrate data into a R data.frame.
Is there a package that makes importing XML easy or do I have to write my own parser?
...
I'm learning R and like the language very much because of its flexibility, but I want to know:
Are there any ports of R for mobile devices?
Where can I get them?
...
Is there a faster way in R to turn a list of characters like c("12313","21323") into a integer list like c(12313, 21323) than writing a for loop myself?
...