Re: [R] pch size in a legend

2015-01-30 Thread Jim Lemon
Hi Ahmed, Hmmm, this seems to work for me (R-3.1.2, Linux) legend(0,2100, legend=c("2009","2010","2012","2013","2014"), col = 1,cex=1,lty=NA,pch=c(1,2,6,7,8),lwd=2,bty="n",pt.cex=2) Jim On Sat, Jan 31, 2015 at 8:49 AM, Ahmed Attia wrote: > Hi R users, > > I would like to adjust the pch size

Re: [R] Coverage probability for a Poisson parameter

2015-01-30 Thread JS Huang
Hi, My first question is what is your n when you say fixed n. I assume the lambda is the mean of the poisson distribution that you want to take sample from. Another question is about the sample size. It does not make too much sense to make a sample of size 1. Let's assume that you want t

Re: [R] Package corpcor: Putting symmetric matrix entries in vector

2015-01-30 Thread Steven Yen
Great! Thanks. Thanks to all who tried to help. as.vector(r[upper.tri(r)]) does it: > e<-as.matrix(cbind(u1,u2,u3,v1,v2,v3)) > r<-cor(e); r [,1] [,2][,3][,4] [,5][,6] [1,] 1. 0.5240809 0.47996616 0.11200672 -0.1751103 -0.09276455 [2,] 0

Re: [R] Package corpcor: Putting symmetric matrix entries in vector

2015-01-30 Thread Peter Langfelder
If you have a symmetric matrix, you can work with the upper triangle instead of the lower one, and you get what you want by simply using as.vector(A[upper.tri(A)]) Example: > a = matrix(rnorm(16), 4, 4) > A = a + t(a) > A [,1] [,2] [,3][,4] [1,] 0.3341294 0.5460334

Re: [R] Package corpcor: Putting symmetric matrix entries in vector

2015-01-30 Thread David Winsemius
On Jan 30, 2015, at 3:03 PM, Steven Yen wrote: > Dear > I use sm2vec from package corpcor to puts the lower triagonal entries of a > symmetric matrix (matrix A) into a vector. However, sm2vec goes downward > (columnwise, vector B), but I would like it to go across (rowwise). So I > define a ve

[R] Package corpcor: Putting symmetric matrix entries in vector

2015-01-30 Thread Steven Yen
Dear I use sm2vec from package corpcor to puts the lower triagonal entries of a symmetric matrix (matrix A) into a vector. However, sm2vec goes downward (columnwise, vector B), but I would like it to go across (rowwise). So I define a vector to re-map the vector (vector C). This works. But is

Re: [R] naming rows/columns in 'array of matrices' | solved

2015-01-30 Thread Evan Cooch
The (obvious, after the fact) solution at the bottom. D'oh... On 1/30/2015 2:07 PM, Evan Cooch wrote: Suppose I have the following situation: I have an array of 2 matrices, where each matrix is (2x2): P <- array(0, c(2,2,2)) P[,,1] <- matrix(c(1,2,3,4),2,2,byrow=T); P[,,2] <- matrix(c(5,6,7,8

[R] naming rows/columns in 'array of matrices'

2015-01-30 Thread Evan Cooch
Suppose I have the following situation: I have an array of 2 matrices, where each matrix is (2x2): P <- array(0, c(2,2,2)) P[,,1] <- matrix(c(1,2,3,4),2,2,byrow=T); P[,,2] <- matrix(c(5,6,7,8),2,2,byrow=T); I want to label rows and columns of each matrix in the array, such that P would look l

Re: [R] Coverage probability for a Poisson parameter

2015-01-30 Thread JS Huang
Hi, Roughly reading the code, I find this statement "phat <- x / m" is probably incorrect since this will give you the set of 100 observed x values /100. I redefine the function cover with three inputs: lambda for the parameter of the poisson distribution, sample.size and significance.

Re: [R] quetion about matrix compute

2015-01-30 Thread JS Huang
Hi, Here is my implementation. Hope this helps. > b [1] 1 2 3 4 5 > c [1] 1 2 1 3 5 4 > sapply(b,function(x)ifelse(x==c,1,0)) [,1] [,2] [,3] [,4] [,5] [1,]10000 [2,]01000 [3,]10000 [4,]00100 [5,]00

Re: [R] repeated measures ANOVA

2015-01-30 Thread Bert Gunter
Mixed effects models. Packages nlme and lme4 among others. Ask further on r-sig-mixed-models list. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Fr

[R] pch size in a legend

2015-01-30 Thread Ahmed Attia
Hi R users, I would like to adjust the pch size in a legend without changing the text size, pt.cex does not do the job. R 2.15.2 32 bit. legend(0,2100, legend=c("2009","2010","2012","2013","2014"), col = 1,cex=1,lty=NA,pch=c(1,2,6,7,8),lwd=2,bty="n") Thanks Ahmed Attia, Ph.D. Agronomist & Soil

Re: [R] repeated measures ANOVA

2015-01-30 Thread John Fox
Dear John, > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of John > Sorkin > Sent: January-30-15 3:43 PM > To: r-help@r-project.org > Subject: [R] repeated measures ANOVA > > Windows 7, R 3.1.0 > > How does one run repeated measures ANOVA using R for

Re: [R] timeseries aggregation by event (zoo, hydrostat, plyr ?)

2015-01-30 Thread Jim Lemon
Hi Bastian, While doing the research for sequential event intervals, I found a paper by Dr Andreas Eckner, who studies this topic. I suggest you check his research page: http://www.eckner.com/research.html and I would like to know if you find it helpful. Jim On Fri, Jan 30, 2015 at 9:52 PM, Ba

[R] repeated measures ANOVA

2015-01-30 Thread John Sorkin
Windows 7, R 3.1.0 How does one run repeated measures ANOVA using R for (1) A balanced design (2) An unbalanced design. so that one will get an ANOVA table? I have seen references to the Anova function in the car package, but this seems to have been deprecated. Thank you, John John David Sorki

Re: [R] stop a function

2015-01-30 Thread David Winsemius
On Jan 30, 2015, at 2:20 AM, n omranian via R-help wrote: > Hi All, > I'm getting actually nuts. I don't understand the following lines in R: > Here is the data, all rows are exactly the same! Their print representation may be "exactly the same", but their internal values may differ by an amoun

Re: [R] lost in plotmath expressions

2015-01-30 Thread William Dunlap
You successfully used an 'expression' object in your first example plot(1,1,xlab=expression(paste("D50 [", mu,"m]"))) so use a vector of expressions in your second example nams<-c(expression(P[205]~"[%]"), expression(paste("D50 [", mu, "m]"))) par(mfrow=c(2,1)) for (i in 1:2) plot(1, 1,

Re: [R] How to run sequential Rscript command for windows command line with a batch file.

2015-01-30 Thread Ista Zahn
I don't think this is an R question, since you want to loop from the windows command line rather than in R. Perhaps see http://stackoverflow.com/questions/11192039/how-to-do-a-for-loop-in-windows-command-line On Thu, Jan 29, 2015 at 11:26 PM, nevil amos wrote: > Hi, > > I need to run multiple ite

Re: [R] Repeat elements of character vector

2015-01-30 Thread Ivan Calandra
Hi, Take a look at the argument "each" from rep(). You could do that (there might be something shorter): paste(rep(v1,each=3), 1:3, sep="_") HTH, Ivan -- Ivan Calandra, ATER University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26

Re: [R] Repeat elements of character vector

2015-01-30 Thread Chel Hee Lee
> paste(rep(v1, each=3), 1:3, sep="_") [1] "a_1" "a_2" "a_3" "b_1" "b_2" "b_3" "c_1" "c_2" "c_3" > Is this what you are looking for? I hope this helps. Chel Hee Lee On 1/30/2015 7:34 AM, Knut Hansen wrote: I have a vector of several character elements: v1 <- c("a", "b", "c") I want each of t

[R] Repeat elements of character vector

2015-01-30 Thread Knut Hansen
I have a vector of several character elements: v1 <- c("a", "b", "c") I want each of these elements to be repeated n times and the number of the repetition added as part of the element text, hence rep() will not work. For n=3 the result would be: v2 <- c("a_1", "a_2", "a_3", "b_1", "b_2", "b_3",

[R] timeseries aggregation by event (zoo, hydrostat, plyr ?)

2015-01-30 Thread Bastian Pöschl
hallo, i search for a possibillity to aggregate a time series by non regular periods (events) As an example i have a precipitation time series ## generate some smooth timeseries library(zoo) library(hydrostats) ## some example data ## ## ## ## x.pr <- c(0, 0, 0, 0.2, 0.8, 0.7, 0, 0, 0, 0.6,

Re: [R] lost in plotmath expressions

2015-01-30 Thread PIKAL Petr
Hi Thanks for the answer. Previous attempts were closer to my intention and are easier for me to understand and extend. Cheers Petr > -Original Message- > From: Chel Hee Lee [mailto:chl...@mail.usask.ca] > Sent: Friday, January 30, 2015 3:10 PM > To: PIKAL Petr; Richard M. Heiberger; S

Re: [R] lost in plotmath expressions

2015-01-30 Thread Chel Hee Lee
Why don't try this? > nams<-c("P2O5 ['%']", "D50 [mu*m]") > pdf("test.pdf") > for(i in 1:2) + plot(1,1,xlab=parse(text=(bquote(.(nams[i]) > dev.off() Is this what you are looking for? I hope this helps. On 1/30/2015 7:54 AM, PIKAL Petr wrote: Thanks So the key is to put expression(s) dir

Re: [R] lost in plotmath expressions

2015-01-30 Thread PIKAL Petr
Thanks So the key is to put expression(s) directly into pool of annotations. I should think about it myself, stupid me. I normally use paste but your constructions are much more readable. thanks again. Petr > -Original Message- > From: Richard M. Heiberger [mailto:r...@temple.edu] > Sen

Re: [R] digits in matrix

2015-01-30 Thread Duncan Murdoch
On 30/01/2015 8:17 AM, Knut Krueger wrote: Am 30.01.2015 um 12:51 schrieb Duncan Murdoch: > You are mixing up formatting with storage. Floating point numbers will > be displayed without decimals if they are close enough to whole numbers. > > Duncan Murdoch > Ok, I am talking from display data

Re: [R] lost in plotmath expressions

2015-01-30 Thread Richard M. Heiberger
I would do this names <- c(expression(D[50]~mu*m), expression(P[2]*O[5]*"%")) for (i in 1:2) plot(1, 1, xlab=names[i]) On Fri, Jan 30, 2015 at 7:33 AM, PIKAL Petr wrote: > Dear all > > I usually find out how I can use expressions in picture annotationmyself :-) > > plot(1,1, xlab=expression(past

Re: [R] lost in plotmath expressions

2015-01-30 Thread S Ellison
> nams<-c("P2O5 [%]", "D50 [mum]") These are strings; plotmath is invoked on expressions. Also, in an expression, [] has special meaning (it's treated as a subscripted index), so a space followed by '[' causes an error and even if that didn't happen, [] would not give units in square brackets. H

Re: [R] digits in matrix

2015-01-30 Thread Knut Krueger
Am 30.01.2015 um 12:51 schrieb Duncan Murdoch: You are mixing up formatting with storage. Floating point numbers will be displayed without decimals if they are close enough to whole numbers. Duncan Murdoch Ok, I am talking from display data = matrix(c(1:16),nrow=4,ncol=4) #create matrix da

[R] Decision trees take long or throws memory limit message

2015-01-30 Thread Kim C.
Hi everyone, I try making decision trees and random forest using the packages rpart and party. I'm already stuck at t he first step. Each time when I enter the code either 1. R takes more than an hour. I haven't waited long enough to see if there's a result but it doesn't look like it! When I

[R] lost in plotmath expressions

2015-01-30 Thread PIKAL Petr
Dear all I usually find out how I can use expressions in picture annotationmyself :-) plot(1,1, xlab=expression(paste("D50 [", mu,"m]"))) However when I want to use this programmatically I am rather lost. Is there anybody who can shed a light on such annotation? nams<-c("P2O5 [%]", "D50 [mum]"

Re: [R] digits in matrix

2015-01-30 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Knut > Krueger > Sent: Friday, January 30, 2015 12:32 PM > To: r-help@r-project.org > Subject: Re: [R] digits in matrix > > Am 30.01.2015 um 11:50 schrieb PIKAL Petr: > > > > You cannot. Matrix is a v

Re: [R] stupid thing with the correlation

2015-01-30 Thread n omranian via R-help
Well, yes, I do agree with you. And thanks a lot, I found the FAQ 7.31. very useful. Best,N. On Friday, January 30, 2015 12:44 PM, Duncan Murdoch wrote: On 30/01/2015 5:22 AM, n omranian via R-help wrote: > Hi All, > I'm getting actually nuts. I don't understand the following line

Re: [R] digits in matrix

2015-01-30 Thread Duncan Murdoch
On 30/01/2015 6:31 AM, Knut Krueger wrote: > Am 30.01.2015 um 11:50 schrieb PIKAL Petr: >> >> You cannot. Matrix is a vector with dimensions so basically it has to have >> the same mode and type of data. >> >> The only way I can think about is to split matrix to 3 matrices before >> making calcul

Re: [R] stupid thing with the correlation

2015-01-30 Thread Duncan Murdoch
On 30/01/2015 5:22 AM, n omranian via R-help wrote: > Hi All, > I'm getting actually nuts. I don't understand the following lines in R: > Here is the data, all rows are exactly the same! >> ord_data[pid,] > c0m2 c0m4 c0m8 c0m16c0m24c0m48 c0p2 > c0p4 c0p8

Re: [R] digits in matrix

2015-01-30 Thread Knut Krueger
Am 30.01.2015 um 11:50 schrieb PIKAL Petr: You cannot. Matrix is a vector with dimensions so basically it has to have the same mode and type of data. The only way I can think about is to split matrix to 3 matrices before making calculation an keep those 3 matrices separate. Cheers Petr bu

Re: [R] digits in matrix

2015-01-30 Thread PIKAL Petr
Hi > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Knut > Krueger > Sent: Friday, January 30, 2015 11:21 AM > To: r-h...@stat.math.ethz.ch > Subject: [R] digits in matrix > > I have a matrix winth integer values after an arithmetic calulation > How ca

Re: [R] stop a function

2015-01-30 Thread n omranian via R-help
Hi All, I'm getting actually nuts. I don't understand the following lines in R: Here is the data, all rows are exactly the same! > ord_data[pid,] c0m2 c0m4 c0m8  c0m16    c0m24    c0m48 c0p2 c0p4      c0p8   c0p16    c0p24    c0p48   c24m2    c24m4    c24m8  c24m16 1333

[R] stupid thing with the correlation

2015-01-30 Thread n omranian via R-help
Hi All, I'm getting actually nuts. I don't understand the following lines in R: Here is the data, all rows are exactly the same! > ord_data[pid,] c0m2 c0m4 c0m8  c0m16    c0m24    c0m48 c0p2 c0p4      c0p8   c0p16    c0p24    c0p48   c24m2    c24m4    c24m8  c24m16 1333

[R] digits in matrix

2015-01-30 Thread Knut Krueger
I have a matrix winth integer values after an arithmetic calulation How can prevent the [1:3]1:3] part of the matrix to be converted to floats data = matrix(c(1:16),nrow=4,ncol=4) #create matrix data[4,] = data[4,]/3 data[,4] = data[,4]/3 data Kind regards Knut ___