Re: [R] Aggregate time series from daily to monthly by date and site

2014-04-05 Thread Rui Barradas
Hello, Maybe the following will do. dat - structure(...) aggregate(dat[5:8], dat[c(1, 2, 4)], FUN = mean) Hope this helps, Rui Barradas Em 05-04-2014 06:37, Zilefac Elvis escreveu: Hi, I have daily data arranged by date and site. Keeping the number of columns as there are, I will like

[R] Purpose of readLines(..., encoding=)?

2014-04-05 Thread Milan Bouchet-Valat
Hi! I'm wondering what's the use of the 'encoding' argument to readLines(x), as opposed to readLines(file(x, encoding=)). The same question applies to read.table()'s 'encoding' vs 'fileEncoding' arguments. AFAIK only the latter is able to re-encode the read text into the internal representation

Re: [R] Purpose of readLines(..., encoding=)?

2014-04-05 Thread Prof Brian Ripley
UTF-8 is treated specially by readLines(), originally to allow for UTF-8 strings on Windows. See the NEWS for 2.12.0. That is not the case for encoding = latin1. If you have a Latin-1 file in a UTF-8 locale, then readLines(x, encoding = latin1) stores the strings in Latin-1 and marks them,

Re: [R] Purpose of readLines(..., encoding=)?

2014-04-05 Thread Milan Bouchet-Valat
Le samedi 05 avril 2014 à 14:16 +0100, Prof Brian Ripley a écrit : UTF-8 is treated specially by readLines(), originally to allow for UTF-8 strings on Windows. See the NEWS for 2.12.0. That is not the case for encoding = latin1. If you have a Latin-1 file in a UTF-8 locale, then

Re: [R] Aggregate time series from daily to monthly by date and site

2014-04-05 Thread Zilefac Elvis
Thanks, Rui. It works great. Atem. On Saturday, April 5, 2014 4:46 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Maybe the following will do. dat - structure(...) aggregate(dat[5:8], dat[c(1, 2, 4)], FUN = mean) Hope this helps, Rui Barradas Em 05-04-2014 06:37, Zilefac Elvis

[R] Multic for windows 7 and Ubuntu

2014-04-05 Thread Srinivasan, Sathish K
Hi all, Does anyone have issues installing multic package (http://cran.r-project.org/web/packages/multic/index.html) on ubuntu. Also, there is no active support for windows binary version. Could any one please help me install multic package on ubuntu 12.04, 64 bit system running with R 2.14.2

Re: [R] Base within reverses column order

2014-04-05 Thread Dan Murphy
Thanks, Duncan. Using names is certainly the most reliable solution, but requires remembering to modify the surrounding code when enhancing what's within -- a bug risk source when passing on the code. Are you saying that an automatic reversal as follows may break in the future because R-devel may

Re: [R] simulation data

2014-04-05 Thread Charles Determan Jr
Thanoon, Firstly, please remember to reply to the R help list as well so that other may benefit from your questions as well. Regarding your second request, I have written the following as a very naive way of inducing correlations. Hopefully this makes it perfectly clear what you change for

Re: [R] Sweave files into LaTex

2014-04-05 Thread Michael Friendly
If you use knitr, you can do, in master.Rnw Rcode, child=Rcode.Rnw= @ This is the equivalent of \input{} (but not \include{}) at the .Rnw level. At any rate, if you have more than just a few code chunks, you should do your work in master.Rnw and produce master.tex from that using either

[R] Setting alternative x-axis breaks using gglpot2

2014-04-05 Thread Kate Ignatius
I'm not doing a Manhattan plot, but plotting AD (coloured by DP) along the genome: points - ggplot(sam,aes(x = midpoint,y = ad, colour = dp, size = 3)) + geom_point() + scale_y_continuous(breaks=c(0,20,30,40)) + labs(x = chr,y = ad) + scale_colour_gradient2(high=red, mid=green) However,

[R] Recoding in R conditioned on a certain value.

2014-04-05 Thread Kate Ignatius
I'm trying to work out the average of a certain value by chromosome. I've done the following, but it doesn't seem to work: Say, I want to find average AD for chromosome 1 only and paste the value next to all the positions on chromosome 1: sam$mmad[sam$chrom == '1'] -

Re: [R] Difficulty coding time-forced functions in deSolve

2014-04-05 Thread Thomas Petzoldt
Hi, does the following help you? Thomas require(deSolve) SEIR - function(t, x, p) { if (t 7) xlag - x else xlag - lagvalue(t - 7) V - ifelse(xlag[3]/sum(xlag) 0.01, 0.25, 0) ## uncomment the following for printing some internal information #cat(t=, t, -- )

Re: [R] Recoding in R conditioned on a certain value.

2014-04-05 Thread David Winsemius
On Apr 5, 2014, at 9:51 AM, Kate Ignatius wrote: I'm trying to work out the average of a certain value by chromosome. I've done the following, but it doesn't seem to work: Say, I want to find average AD for chromosome 1 only and paste the value next to all the positions on chromosome 1:

Re: [R] Multic for windows 7 and Ubuntu

2014-04-05 Thread David Winsemius
On Apr 5, 2014, at 1:50 AM, Srinivasan, Sathish K wrote: Hi all, Does anyone have issues installing multic package (http://cran.r-project.org/web/packages/multic/index.html) on ubuntu. After doing a search on rhelp and r-sig-debian yours seems to be the first. Shouldn't you be providing

Re: [R] Multic for windows 7 and Ubuntu

2014-04-05 Thread Qiang Kou
I have just test the package on Ubuntu 12.04, everything is OK. So please provide the error message on your computer. Best, KK On Sat, Apr 5, 2014 at 9:02 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 5, 2014, at 1:50 AM, Srinivasan, Sathish K wrote: Hi all, Does anyone have