Re: [R] condition and function

2013-05-12 Thread Berend Hasselman
On 13-05-2013, at 08:16, catalin roibu wrote: > Hello all! > I want to create a new variable in a dataframe, and this variable is based > on a regression equation. For example for example for the hc<=10, the > values of the new variable(d0.3) is obtained by d0.3=15.9122+0.2105*dc, for > hc<=30,

[R] condition and function

2013-05-12 Thread catalin roibu
Hello all! I want to create a new variable in a dataframe, and this variable is based on a regression equation. For example for example for the hc<=10, the values of the new variable(d0.3) is obtained by d0.3=15.9122+0.2105*dc, for hc<=30, d0,3 values are obtained by d0.3=1.4781+0.8827*dc. Thank y

Re: [R] Multinomial-Dirichlet using R

2013-05-12 Thread David Winsemius
On May 12, 2013, at 4:44 PM, Anamika Chaudhuri wrote: > Hi: > > I have asked this question on Cross-Validated. So it might be a cross > posting but havent received any responses to it. > > I am trying to see which distribution will best fit the data I am working > on. The dataset is as followin

[R] Multinomial-Dirichlet using R

2013-05-12 Thread Anamika Chaudhuri
Hi: I have asked this question on Cross-Validated. So it might be a cross posting but havent received any responses to it. I am trying to see which distribution will best fit the data I am working on. The dataset is as following: Site Nausea headacheAbdominal Distension

Re: [R] How to center a horizontal legend with specified 'text.width'

2013-05-12 Thread Jim Lemon
On 05/12/2013 09:47 PM, Sascha Wolfer wrote: Hello dear list, I just cannot figure out how to do this and didn't find a solution for my specific problem. I want to place a centered horizontal legend between 4 plots. That's no problem. The problem is: As soon as I specify the "text.width" para

Re: [R] aggregate.data.frame with NAs and different types

2013-05-12 Thread Spencer Graves
Hi, Arun: Thanks. That's exactly what I need. Spencer fortune(298) Don't do as I say, do as Hadley does. -- Barry Rowlingson (in a discussion about the workflow for writing R packages, see also fortune(128)) R-devel (September 2011) On 5/12/2013 2:25 PM, arun wrote: HI,

Re: [R] scan in R

2013-05-12 Thread peter dalgaard
On May 12, 2013, at 22:42 , Naser Jamil wrote: > Dear R-user, > May I seek your help over a issue, probably a simple one. I just one to > scan the following numbers, avoiding [1]s, [2]. By the way, I know how to > scan numbers in the absence of such [1] and [2]. > > > --

Re: [R] aggregate.data.frame with NAs and different types

2013-05-12 Thread arun
HI, Try: library(plyr) res1<-ddply(df2aggregate,.(id),summarize,x=sum(x),y=mean(y),a=head(a,1)) res1 #  id  x   y    a #1  a  3  NA #2  b  7 2.5    A #3  c 11 4.5    C #4  d NA  NA    E  res1$x<- as.numeric(res1$x)  identical(ag1.2,res1) #[1] TRUE A.K. - Original Message - From: Spenc

Re: [R] scan in R

2013-05-12 Thread arun
Hi, You can do: vec1<-scan(text="[1] 18 18 17 14 17 13 13 18 13 16 16 14 [1] 12 19 15 21 13 17 10 13 18 14 17 13 [2] 13 15 20 14 18 15 10 12 20 17 17 17",what="character") as.numeric(vec1[-grep("\\[",vec1)]) # [1] 18 18 17 14 17 13 13 18 13 16 16 14 12 19 15 21 13 17 10 13 18 14 17 13 13 #[26] 15

Re: [R] scan in R

2013-05-12 Thread Gabor Grothendieck
On Sun, May 12, 2013 at 4:42 PM, Naser Jamil wrote: > Dear R-user, > May I seek your help over a issue, probably a simple one. I just one to > scan the following numbers, avoiding [1]s, [2]. By the way, I know how to > scan numbers in the absence of such [1] and [2]. > > >

[R] scan in R

2013-05-12 Thread Naser Jamil
Dear R-user, May I seek your help over a issue, probably a simple one. I just one to scan the following numbers, avoiding [1]s, [2]. By the way, I know how to scan numbers in the absence of such [1] and [2]. -- [1] 18 18 17 14 17 13 13 18 13 16

[R] aggregate.data.frame with NAs and different types

2013-05-12 Thread Spencer Graves
Hello: Do you have suggestions for how to aggregate a data.frame using different functions on different columns? Consider the following example: df2aggregate <- data.frame(id=rep(letters[1:4], each=2), x =c(1:6, NA, NA), y =

Re: [R] Loop for CrossTable (gmodels)

2013-05-12 Thread David Winsemius
On May 12, 2013, at 10:44 AM, David Winsemius wrote: > > On May 12, 2013, at 10:30 AM, arun wrote: > >> Hi, >> According to the error, the variables should have the same length. >> For example: >> set.seed(24) >> dat1<- >> cbind(RACE=sample(1:10,10,replace=TRUE),as.data.frame(matrix(sample(1:1

Re: [R] Loop for CrossTable (gmodels)

2013-05-12 Thread David Winsemius
On May 12, 2013, at 10:30 AM, arun wrote: > Hi, > According to the error, the variables should have the same length. > For example: > set.seed(24) > dat1<- > cbind(RACE=sample(1:10,10,replace=TRUE),as.data.frame(matrix(sample(1:100,20*10,replace=TRUE),ncol=20))) > lapply(dat1[,-1],function(x)

Re: [R] Loop for CrossTable (gmodels)

2013-05-12 Thread arun
Hi, According to the error, the variables should have the same length. For example: set.seed(24) dat1<- cbind(RACE=sample(1:10,10,replace=TRUE),as.data.frame(matrix(sample(1:100,20*10,replace=TRUE),ncol=20)))  lapply(dat1[,-1],function(x) CrossTable(x,dat1$RACE,format="SPSS",prop.chisq=FALSE,digi

Re: [R] help

2013-05-12 Thread Ben Bolker
Niloofar.Javanrouh yahoo.com> writes: > I want to analysis of covariance with R software. What > should I do? I would like to have the answer as soon as possible > because I have a presentation in the following 8 hours. In general the respondents on this list are not very sympathetic to "please

[R] help

2013-05-12 Thread Niloofar.Javanrouh
  Hi dear all I want to analysis of covariance with R software. What should I do? I would like to have the answer as soon as possible because I have a presentation in the following 8 hours. Thanks a universe. _ Best Regards [[alternative HTML version deleted]] __

Re: [R] pmnorm produces NaN

2013-05-12 Thread Uwe Ligges
On 11.05.2013 15:29, Marsupilami wrote: Dear list-members, A specific set of parameter values produces NaN when using pmnorm (library mnormt). I was wondering whether has do to that either extremely small or big values are computed. Here is a reproducible code: ### library(mnormt)

Re: [R] Need help to building R package with devtools

2013-05-12 Thread John Kane
Just a guess but it looks like you need to upgrade to the latest release (2013-04-03, Masked Marvel) John Kane Kingston ON Canada > -Original Message- > From: bogaso.christo...@gmail.com > Sent: Sun, 12 May 2013 14:40:10 +0545 > To: r-help@r-project.org > Subject: [R] Need help to buildi

Re: [R] Need help to building R package with devtools

2013-05-12 Thread peter dalgaard
On May 12, 2013, at 10:55 , Christofer Bogaso wrote: > Hello again, > > I am using library(devtools) to build my custom package. > > Therefore I installed (normal/default installation) the RTools from > 'http://cran.r-project.org/bin/windows/Rtools/' with Rtools30.exe. > However I am getting fo

[R] How to center a horizontal legend with specified 'text.width'

2013-05-12 Thread Sascha Wolfer
Hello dear list, I just cannot figure out how to do this and didn't find a solution for my specific problem. I want to place a centered horizontal legend between 4 plots. That's no problem. The problem is: As soon as I specify the "text.width" parameter to separate the two legend entries, the

[R] Need help to building R package with devtools

2013-05-12 Thread Christofer Bogaso
Hello again, I am using library(devtools) to build my custom package. Therefore I installed (normal/default installation) the RTools from 'http://cran.r-project.org/bin/windows/Rtools/' with Rtools30.exe. However I am getting following error: > library(devtools) WARNING: Rtools is required to bu

[R] Unexpected scrapeR result

2013-05-12 Thread Andrew Roberts
Hi, I want to mine web pages and decided to use tm and scrapeR. The example given in scrapeR's manual runs as follows: library(scrapeR) pageSource<-scrape(url="http://cran.r-project.org/web/packages/",headers=TRUE, parse=FALSE) if(attributes(pageSource)$headers["status"]==200) { page<-scrape