Re: [R] work with observations in column

2013-10-06 Thread arun
Hi, May be this helps:  vec1<- 1:10 library(zoo) rollmean(vec1,2) #[1] 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5 vec2<- c(5,8,9,13,20)  diff(vec2) #[1] 3 1 4 7 A.K. Hello, How can I calculate half sum of 2 observ (l(i) + l(i+1))/2 ? How compute f(i) - f(i+1) ? please help me.

Re: [R] Create a categorical variable from numeric column

2013-10-06 Thread arun
Thanks, ?cut() could be used in one line. Categ2<-(!is.na(cut(dat1[,1],breaks=c(7,17+1  identical(Categ,Categ2) #[1] TRUE A.K. - Original Message - From: Bert Gunter To: arun Cc: R help Sent: Sunday, October 6, 2013 10:18 AM Subject: Re: [R] Create a categorical variable from n

Re: [R] FW: Transposing the output of 'table'

2013-10-06 Thread Andrea Lamont
If t(table(OBJECT)) does not work, does: u<-as.matrix(table(OBJ)) t(u) -i.e. use matrix operations? On Sun, Oct 6, 2013 at 1:47 PM, LAMONT, ANDREA wrote: > > > > > From: r-help-bounces@r-project.orgOn Behalf OfBerend Hasselman > Sent: Sunday, October 0

Re: [R] Transposing the output of 'table'

2013-10-06 Thread Duncan Murdoch
On 13-10-06 3:15 PM, Rui Barradas wrote: Hello, How about OBJECT <- sample(4, 20, TRUE) t(t(table(OBJECT))) Or simply as.matrix(table(OBJECT)) Hope this helps, Rui Barradas Em 06-10-2013 19:22, Bert Gunter escreveu: Berend et.al: Yes. But note that this only works for a 2-d table-- w

Re: [R] Transposing the output of 'table'

2013-10-06 Thread Berend Hasselman
On 06-10-2013, at 20:32, Dennis Fisher wrote: > unsuccessful > Please reply to the list and not to me only. That way others can contribute to solving the problem. Berend > Dennis Fisher MD > P < (The "P Less Than" Company) > Phone: 1-866-PLessThan (1-866-753-7784) > Fax: 1-866-PLessThan (1

Re: [R] Transposing the output of 'table'

2013-10-06 Thread Rui Barradas
Hello, How about OBJECT <- sample(4, 20, TRUE) t(t(table(OBJECT))) Hope this helps, Rui Barradas Em 06-10-2013 19:22, Bert Gunter escreveu: Berend et.al: Yes. But note that this only works for a 2-d table-- which the OP indicated was what he had; in general, one would have to explicitly pe

Re: [R] Transposing the output of 'table'

2013-10-06 Thread Bert Gunter
Berend et.al: Yes. But note that this only works for a 2-d table-- which the OP indicated was what he had; in general, one would have to explicitly permute the array(table) dimensions, e.g. via aperm() . Cheers, Bert On Sun, Oct 6, 2013 at 10:44 AM, Berend Hasselman wrote: > > On 06-10-2013,

Re: [R] Transposing the output of 'table'

2013-10-06 Thread Berend Hasselman
On 06-10-2013, at 19:30, Dennis Fisher wrote: > R 3.0.1 > OS X > > Colleagues, > > If I execute the command: > table(OBJECT) > the output might look like: > 1 2 > 25 336 > > I would like it to appear as: > 1 25 > 2 336 > > I can accomplish this with: >

[R] Transposing the output of 'table'

2013-10-06 Thread Dennis Fisher
R 3.0.1 OS X Colleagues, If I execute the command: table(OBJECT) the output might look like: 1 2 25 336 I would like it to appear as: 1 25 2 336 I can accomplish this with: TABLE <- table(OBJECT) data.frame(names(TABLE), as.numeric(TA

Re: [R] Create a categorical variable from numeric column

2013-10-06 Thread Bert Gunter
I think this is unwise. It depends on there being exactly 2 categories in the desired result and silent coercion from logical to numeric, and so does not generalize. Sometimes brevity is **not** the soul of wit (google if necessary). I would suggest instead that cut specify three intervals and th

Re: [R] trying to compile R in win 7 (with Rtools) ... (bitmapdll - png.h )

2013-10-06 Thread Uwe Ligges
On 06.10.2013 01:42, Cleber N.Borges wrote: I tried to follow the intrusions in http://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Building-the-bitmap-files when I type make bitmapdll (in gnuwin directory) or make (in gnuwin/bitmap dir) the libpng and libjpeg seems to compile but l

Re: [R] trouble with nlme: Error in MEEM() : Singularity in backsolve at level 0, block 1

2013-10-06 Thread Uwe Ligges
On 06.10.2013 03:11, Robert Lynch wrote: I am trying to fit my data, attached, with the following model CutOff <- 0 fit.full <- lme(fixed= zGrade ~ Rep + ISE +Yfrm7A +Ufrm7A +Female +White +HSGPA +MATH +AP_TOTAL +Years +Course + Course*Rep + Course*ISE +Course*Yfrm7A+Course

Re: [R] Create a categorical variable from numeric column

2013-10-06 Thread Bert Gunter
No. Use ?cut instead. -- Bert On Sun, Oct 6, 2013 at 6:29 AM, arun wrote: > > > > Hi, > > I created 3 categories. If 1-7 and 18-24 should come under the same category, > then: > Categ<- findInterval(dat1$Col1,c(8,18))+1 > Categ[Categ>2]<- 1 > dat1$Categ<- Categ > tail(dat1) > # Col1

Re: [R] Creating a vector in R

2013-10-06 Thread arun
HI, Try: x1 <- (1:100)^2 A.K. Hi I am newbie of using R. Please help me create vector x(1^2, 2^2, 3^2,,100^2) in R. Thanks you I am looking forward to see your reply soon, Best wish Andrew, __ R-help@r-project.org mailing list https://stat.

Re: [R] Create a categorical variable from numeric column

2013-10-06 Thread arun
Hi, I created 3 categories. If 1-7 and 18-24 should come under the same category, then:  Categ<- findInterval(dat1$Col1,c(8,18))+1 Categ[Categ>2]<- 1 dat1$Categ<- Categ  tail(dat1) #   Col1   Col2 Categ #45    2 -0.5419758 1 #46   21  1.1042719 1 #47   24 -1.0787079 1 #48   18 

[R] power law plot

2013-10-06 Thread Soumitro Dey
Hello all, I have a distribution of numbers with an abundance of zeros (zero-inflated). I thought about plotting the data in a log-log plot but then I cannot plot the zeros in such a plot. Also log-log plots are considered biased and not so robust. I have seen CCDF plots being used instead of that

Re: [R] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2013-10-06 Thread David Winsemius
Well, first off, you ought to learn to post in plain text as requested in the Posting Guide. After you have mastered that rather simple task, you might consider searching with Google for "setting up a cran mirror" which for me anyway produces this as the first hit: http://cran.r-project.org/m