Re: [R] How to divide each column with its own value

2012-09-17 Thread Berend Hasselman
On 17-09-2012, at 07:31, Jha, Ashutosh Kumar wrote: Dear Berend, No need to devide what all you need a indentity matrix with same dimesion. Following is one way to achieve this. mat-matrix(1,ncol=ncol(mat),nrow=nrow(mat)). That is not an identity matrix. It is a matrix with all

Re: [R] How to divide each column with its own value

2012-09-17 Thread Daniel Malter
It's not quite clear what you want to do. Is it just this? a-c(1,2,3,4) dim(a)-c(2,2) a/a This gives the element by element ratio. HTH, Daniel shukor wrote Hi, I have a matrix as below: mat= [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 What

Re: [R] How to filter information from a big .csv table into a new table

2012-09-17 Thread arun
Hi, I guess this is what you are looking for: dat1-read.table(text=     f1 f2  f3 f4  f5  f6 f7 f9  f10  f11 t1  1  0  1  0  1  0  0  0  0    1 t2  1  0  0  0  0  1  1  1  1    1 t3  0  0  0  0  0  0  0  0  0    0 t4  1  0  0  0  1  0  0  0  0    0 t5  0  0  0  0  0  0  0  0  0    0 t6  0  0  0 

Re: [R] Cragg-Donald Wald F statistic (weak instruments)

2012-09-17 Thread Daniel Malter
The test statistic above does not reproduce Stata results when there is more than one endogenous variable. While the code to compute the test statistic appears to be correct, the difference may lie in Stata computing the test statistic based on canonical correlations rather than the formula in

[R] How to use tune.svm or tune(svm...) for regression

2012-09-17 Thread JennyLMA
I dont know how to tell to the function 'svm' in this two cases: tune.svm or tune (svm...) the type (I want regression, but by default it works with classification) and the specify kind of kernel (by default it work with radial)... thank you so much!!! -- View this message in context:

Re: [R] How to divide each column with its own value

2012-09-17 Thread Jha, Ashutosh Kumar
Dear Berend,   No need to devide what all you need a indentity matrix with same dimesion.   Following is one way to achieve this.     mat Hi, I have a matrix as below: mat=      [,1]  [,2]  [,3] [1,]    1    4    7 [2,]    2    5    8 [3,]    

[R] Using paste to create and evaluate a variable expression

2012-09-17 Thread Bryan Keller
Is it possible to use paste to write out an expression and evaluate it? Suppose I want to add two vectors X1 and X2, defined as follows: X1 - 1:6 X2 - 6:1 If I write the following it looks like what I want but is a character: noquote(paste(paste(X, 1, sep = ), paste(X, 2, sep = ), sep = +)) Is

[R] eval(parse(...)) only once in a function

2012-09-17 Thread Christof Kluß
Hi I would like to have something like str - df$JT == 12 fun - function(df) { b - eval(parse(str)) return(b) } but for performance eval(parse(a)) should not be evaluated at each function call, but should work as fun - function(df) { b - df$JT == 12 return(b) } Do you have an idea

Re: [R] eval(parse(...)) only once in a function

2012-09-17 Thread David Winsemius
On Sep 16, 2012, at 11:27 PM, Christof Kluß wrote: Hi I would like to have something like str - df$JT == 12 fun - function(df) { b - eval(parse(str)) return(b) } What are you trying to do? str - quote(df$JT == 12) but for performance eval(parse(a)) should not be

Re: [R] Using paste to create and evaluate a variable expression

2012-09-17 Thread David Winsemius
On Sep 16, 2012, at 9:04 PM, Bryan Keller wrote: Is it possible to use paste to write out an expression and evaluate it? Of course. ?as.expression ?parse ?eval Suppose I want to add two vectors X1 and X2, defined as follows: X1 - 1:6 X2 - 6:1 If I write the following it looks like

Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread Massimo Bressan
thank you for the help, bert unfortunately, for reasons I can not understand (yet) I can not put to wortk it all (I'm always in trouble with the panel functions); max Il 14/09/2012 18:38, Bert Gunter ha scritto: Thanks for the example. Makes it easy to see what you mean. Yes, if I

Re: [R] eval(parse(...)) only once in a function

2012-09-17 Thread Heramb Gadgil
If you have a data frame df with a column JT Try this one: str - df$JT == 12 fun-function(str){b-eval(parse(text=str)) return(b)} fun(str) On Mon, Sep 17, 2012 at 11:57 AM, Christof Kluß ckl...@email.uni-kiel.dewrote: Hi I would like to have something like str - df$JT == 12 fun -

Re: [R] Zip a file

2012-09-17 Thread Rantony
Hi Arun, I tried this way, but getting an error like Using Eclips: “Error in .rj.originals$help(..., help_type = html) : 'topic' should be a name, length-one character vector or reserved word” Using R: Error: could not find function zip So, is it required to install any

[R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

2012-09-17 Thread Franckx Laurent
Dear all, I have problems loading a library in the 64 version of R. The following happens: · I have a file, equildistC.cpp, which contains a few lines of C++ code. · I have compiled the file using the following commands: PATH =

[R] Adding legends on plots using Lattice package

2012-09-17 Thread jpm miao
To dear Dr Sarkar and anyone that knows about Lattice package, I make 4 graphs by Lattice package. Each of the graphs has two time series. All the series are plotted in plain lines by default, and I would like one series to be in plain line and the other to be in dotted line in each graph. How

Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

2012-09-17 Thread Duncan Murdoch
On 12-09-17 3:56 AM, Franckx Laurent wrote: Dear all, I have problems loading a library in the 64 version of R. The following happens: · I have a file, equildistC.cpp, which contains a few lines of C++ code. · I have compiled the file using the following commands: PATH =

[R] count NAs per week

2012-09-17 Thread Tagmarie
Even though I work with R since a year or so I still struggle with simple problems. I hope someone can help me with this. Been trying for days and am a little frustrated now. I have a data frame somewhat like the one bellow: dattrial-data.frame(a=c(1,NA,rnorm(4,10)), Week=c(3,3,3,4,4,4)) I

[R] download truncating large files

2012-09-17 Thread Ian Shannon
Hi there, I have had a problem with loading the package XLConnectJars_0.2-0.zip from the CRAN mirrors. The problem occurs when executing utils:::menuInstallPkgs() I have traced the problem down to the download internal command. It appears that files over approx 15 MB are being truncated. The

Re: [R] multi-column factor

2012-09-17 Thread Hadley Wickham
If you have a million levels is it really necessary to use a factor? I'm not sure what advantages it will to have to a string in this circumstance (especially since you don't seem to know the levels a priori but have to learn them from the data). Hadley On Sunday, September 16, 2012, Sam

[R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread Sri krishna Devarayalu Balanagu
Hi Everyone, Can anyone help why the errors are coming and rectify it? invalid.ids - c(1,3,5) if (length(invalid.ids)==0) { cat(No Errors found) } else

Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

2012-09-17 Thread Franckx Laurent
Problem solved, thank you. -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: maandag 17 september 2012 13:05 To: Franckx Laurent Cc: 'r-help@r-project.org' Subject: Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread Duncan Murdoch
On 12-09-17 5:47 AM, Sri krishna Devarayalu Balanagu wrote: Hi Everyone, Can anyone help why the errors are coming and rectify it? invalid.ids - c(1,3,5) if (length(invalid.ids)==0) { cat(No Errors found)

Re: [R] count NAs per week

2012-09-17 Thread R. Michael Weylandt
On Mon, Sep 17, 2012 at 11:03 AM, Tagmarie ramga...@gmx.net wrote: Even though I work with R since a year or so I still struggle with simple problems. I hope someone can help me with this. Been trying for days and am a little frustrated now. I have a data frame somewhat like the one bellow:

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread Ted Harding
On 17-Sep-2012 09:47:41 Sri krishna Devarayalu Balanagu wrote: Hi Everyone, Can anyone help why the errors are coming and rectify it? invalid.ids - c(1,3,5) if (length(invalid.ids)==0) { cat(No Errors found)

Re: [R] possible TZ bug in parseISO8601 - Error in if (length(c(year, month, day, hour, min, sec)) == 6 c(year, : [...]

2012-09-17 Thread Bit Rocker
I think I've sorted this out now. Debugging an R program is certainly quite a feat but I think I'm getting there. It's worth it for the power yielded. On Sun, Sep 16, 2012 at 7:16 PM, Bit Rocker bitracket...@gmail.com wrote: Just found a typo elsewhere in the code which looks like it's the

Re: [R] Count based on 2 conditions [Beginner Question]

2012-09-17 Thread Stephen Politzer-Ahles
Most of your counting needs can be handled elegantly with the xtabs() function (cross-tabulation). This'll work a lot faster than an iterative method. For your data I would suggest something like this: # Create a column indicating whether or not the value in Col2 is above 5

Re: [R] download truncating large files

2012-09-17 Thread jim holtman
Try downloading the zip file using the browser interface to see if it might be something with your proxy. Do this outside of R to see if you have the same problem. After that, you can just install from a local zip file. On Mon, Sep 17, 2012 at 5:21 AM, Ian Shannon

Re: [R] Using paste to create and evaluate a variable expression

2012-09-17 Thread Jean V Adams
Bryan, Try this. char - paste(X, 1:2, sep=, collapse=+) eval(parse(text=char)) Jean Bryan Keller bsbkel...@gmail.com wrote on 09/16/2012 11:04:19 PM: Is it possible to use paste to write out an expression and evaluate it? Suppose I want to add two vectors X1 and X2, defined as follows:

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread R. Michael Weylandt
And now it is easy to see why we should all the one true brace style ;-) Michael On Mon, Sep 17, 2012 at 12:29 PM, Ted Harding ted.hard...@wlandres.net wrote: On 17-Sep-2012 09:47:41 Sri krishna Devarayalu Balanagu wrote: Hi Everyone, Can anyone help why the errors are coming and rectify it?

Re: [R] Server R

2012-09-17 Thread R. Michael Weylandt
On Sun, Sep 16, 2012 at 9:42 PM, Bazman76 h_a_patie...@hotmail.com wrote: Hi there, I used the command sudo apt-get install r-base to install R on an EC2 server as shown below: http://www.r-bloggers.com/ec2-micro-instance-of-rstudio/ It works but the version of R installed is:

Re: [R] Using paste to create and evaluate a variable expression

2012-09-17 Thread Bryan Keller
This is perfect, thanks! On Mon, Sep 17, 2012 at 7:16 AM, arun smartpink...@yahoo.com wrote: Hi, Try this: expr1-parse(text=paste(paste0(X,1:2),collapse=+)) eval(expr1) #[1] 7 7 7 7 7 7 A.K. - Original Message - From: Bryan Keller bsbkel...@gmail.com To:

Re: [R] Correlation between random effects in the package coxme

2012-09-17 Thread Terry Therneau
On 09/14/2012 05:00 AM, r-help-requ...@r-project.org wrote: Hello, Why the correlation between the random effects is negative? library(coxme) rats1- coxme(Surv(time, status) ~ (1|litter), rats) random.effects(rats1)[[1]] #one value for each of the 50 litters print(rats1) rats2- lmekin(time ~

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-17 Thread John Kane
Comments in-line below. Sorry to be so long getting back to you but sleep intervened. -Original Message- From: ridav...@gmail.com Sent: Sun, 16 Sep 2012 21:24:15 +0200 To: jrkrid...@inbox.com Subject: Re: [R] [newbie] aggregating table() results and simplifying code with loop

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread Jessica Streicher
Now i know why using else never worked for me - really, i'd consider this more of a bug than a feature of the language ;) On 17.09.2012, at 14:35, R. Michael Weylandt wrote: And now it is easy to see why we should all the one true brace style ;-) Michael On Mon, Sep 17, 2012 at 12:29 PM,

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread R. Michael Weylandt
On Mon, Sep 17, 2012 at 2:54 PM, Jessica Streicher j.streic...@micromata.de wrote: Now i know why using else never worked for me - really, i'd consider this more of a bug than a feature of the language ;) If it makes you feel any better (I can't imagine it would), javascript has the same

Re: [R] count NAs per week

2012-09-17 Thread William Dunlap
with(dattrial, table(A_is_missing=is.na(a), Week)) Week A_is_missing 3 4 FALSE 2 3 TRUE 1 0 with(dattrial, table(A_is_missing=is.na(a), Week))[TRUE, ] # extract the missing=TRUE row, note quotes 3 4 1 0 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com

Re: [R] [newbie] aggregating table() results and simplifying code with loop

2012-09-17 Thread Rui Barradas
Hello, Now I believe I've got it. (So-so believe.) ddply is a good idea, in my first post I was using xtabs to the same effect, but ddply makes it a lot easier. I had made a big mistake, though. I thought that only sequences of FALSE were valid, hence rle(). In a follow-up post, Davide listed

Re: [R] Using paste to create and evaluate a variable expression

2012-09-17 Thread arun
Hi, Try this: expr1-parse(text=paste(paste0(X,1:2),collapse=+))  eval(expr1) #[1] 7 7 7 7 7 7 A.K. - Original Message - From: Bryan Keller bsbkel...@gmail.com To: r-help@r-project.org Cc: Sent: Monday, September 17, 2012 12:04 AM Subject: [R] Using paste to create and evaluate a

[R] I want to send the vector a into the Object A.......

2012-09-17 Thread Sri krishna Devarayalu Balanagu
a=c(1,2,3) b=c(23, 24, 25) x=c(a, b) #if (length(x[1]) == 0) {cat(x[1] is having 3 elements)} Suppose I want to send the vector a into the Object A, um getting only a as the ouput for Object A but not getting required output as the vector with the elements 1, 2, 3 with the following code A-

Re: [R] count NAs per week

2012-09-17 Thread arun
Hi, Try this: dattrial-data.frame(a=c(1,NA,rnorm(4,10)), Week=c(3,3,3,4,4,4))  aggregate(dattrial$a,list(dattrial$Week),function(x) sum(is.na(x))) #  Group.1 x #1   3 1 #2   4 0 #or  ddply(dattrial,.(Week),summarize, sum(is.na(a))) #  Week ..1 #1    3   1 #2    4   0 #or

Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread maxbre
here it is, I think (I hope) I'm getting a little closer with this, but still there is something to sort out... error using packet 1 unused argument(s) (coef =1.5, do.out=TRUE) by reading the help for panel.bwplot at the argument stats it says: the function must accept arguments coef and

Re: [R] count NAs per week

2012-09-17 Thread Tagmarie
Thank you Michael, that worked perfectly! Now I wonder, if it is possible to break my data further apart and put it together again. Assume I include a column for an ID in the data frame like this: dattrial2-data.frame(a=c(1,NA,NA,NA,2,3), Week=c(3,3,3,4,4,4), AnimalID=c(Ernie,Bert, Ernie,

Re: [R] Sweave problem after R update version

2012-09-17 Thread jeff harring
I have been having the same problem. It appears to be linked to setting the working directory. = setwd(c:...) @ Then the error arrives. Any suggestions? -- View this message in context: http://r.789695.n4.nabble.com/Sweave-problem-after-R-update-version-tp4566044p4643363.html Sent from

Re: [R] Sweave problem after R update version

2012-09-17 Thread jeff harring
Is there a way to set the echo to be false as the code that was presented (by the way it worked well) shows up in the document? Thanks for any help here. -- View this message in context: http://r.789695.n4.nabble.com/Sweave-problem-after-R-update-version-tp4566044p4643366.html Sent from the

[R] Problem with Stationary Bootstrap

2012-09-17 Thread Hock Ann Lim
Dear R experts,   I'm running the following stationary bootstrap programming to find the parameters estimate of a linear model:     X-runif(10,0,10) Y-2+3*X a-data.frame(X,Y) coef-function(fit){   fit - lm(Y~X,data=a)    return(coef(fit)) }  result- tsboot(a,statistic=coef(fit),R = 10,n.sim =

Re: [R] I want to send the vector a into the Object A.......

2012-09-17 Thread Heramb Gadgil
A- get(a) This will work fine Best, Heramb On Mon, Sep 17, 2012 at 5:43 PM, Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com wrote: a=c(1,2,3) b=c(23, 24, 25) x=c(a, b) #if (length(x[1]) == 0) {cat(x[1] is having 3 elements)} Suppose I want to send the vector a into the

Re: [R] Possible Improvement of the R code

2012-09-17 Thread William Dunlap
Unlike C or C++, subscripting vector or matrix is not almost free. Also, subscripting a matrix tends to make more time than subscripting a vector so it can help to pull out the previous row of params once per iteration, use vector subscripting on the that row to build the new row, and then insert

Re: [R] Problem with Stationary Bootstrap

2012-09-17 Thread Rui Barradas
Hello, The problem is your function calling itself until there's no more stack memory left. Besides, your function doesn't make any sense. You pass an argument 'fit' then do not used it but change it's value then return itself. Corrected: set.seed(1) X - runif(10, 0, 10) Y - 2 + 3*X a -

Re: [R] Using paste to create and evaluate a variable expression

2012-09-17 Thread peter dalgaard
On Sep 17, 2012, at 06:04 , Bryan Keller wrote: Is it possible to use paste to write out an expression and evaluate it? Suppose I want to add two vectors X1 and X2, defined as follows: X1 - 1:6 X2 - 6:1 If I write the following it looks like what I want but is a character:

Re: [R] Can anyone help why the errors are coming and rectify it?

2012-09-17 Thread Patrick Burns
This is Circle 8.1.43 of 'The R Inferno'. http://www.burns-stat.com/pages/Tutor/R_inferno.pdf Pat On 17/09/2012 10:47, Sri krishna Devarayalu Balanagu wrote: Hi Everyone, Can anyone help why the errors are coming and rectify it? invalid.ids - c(1,3,5) if (length(invalid.ids)==0) {

Re: [R] I want to send the vector a into the Object A.......

2012-09-17 Thread Jean V Adams
Try this. A - get(x[1]) Jean Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com wrote on 09/17/2012 07:13:51 AM: a=c(1,2,3) b=c(23, 24, 25) x=c(a, b) #if (length(x[1]) == 0) {cat(x[1] is having 3 elements)} Suppose I want to send the vector a into the Object A, um getting

Re: [R] Possible Improvement of the R code

2012-09-17 Thread William Dunlap
Getting rid of one more matrix subscripting call trims the time by another 10-20%. With the following function the times for 10^4 reps for a a 11-row input matrix become raw compiled f1 5.57 3.04 f3 3.73 2.14 f5 3.45 1.95 f6 1.63 0.90 f7 1.32 0.81 f7 -

[R] Constraint Optimization with constrOptim

2012-09-17 Thread Raimund Grundböck
Hi, I am having trouble using constrOptim. My target is to do a portfolio optimization and there some constraints have to be fulfilled. 1) The weight of each share of the portfolio has to be greater than 0 2) The sum of these weights has to be 1 I am able to fulfill either the first or the

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread Duncan Temple Lang
Hi James Unfortunately, I am not certain if the latest version of the XML package has the garbage collection activated for the nodes. It is quite complicated and that feature was turned off in some versions of the package. I suggest that you install the version of the package on github

Re: [R] I want to send the vector a into the Object A.......

2012-09-17 Thread arun
Hi,After second thought, May be this:get(A) [1] 1 2 3 A.K. - Original Message - From: Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Monday, September 17, 2012 8:13 AM Subject: [R] I want to send the vector a into

Re: [R] count NAs per week

2012-09-17 Thread arun
HI, May be this is what you wanted.  res1-aggregate(dattrial2$a,list(dattrial2$Week,dattrial2$AnimalID),function(x) sum(is.na(x))) split(res1,res1$Group.2) #$Bert #  Group.1 Group.2 x #1   3    Bert 1 #2   4    Bert 1 #$Ernie  # Group.1 Group.2 x #3   3   Ernie 1 #4   4   Ernie

Re: [R] FF package downloading a large file using sqlQuery

2012-09-17 Thread Jan
You can use the read.dbi.ffdf and read.odbc.ffdf function in package ETLUtils. These allow you to fetch a query directly in an ffdf. See the examples in their corresponding documentation ?read.dbi.ffdf and ?read.odbc.ffdf or look at this blog post

Re: [R] Server R

2012-09-17 Thread Bazman76
Thanks Michael, I presume that the command sudo apt-get updatewill do the trick but am emailing the appropriate group to get more background on what packages are included in the latest ubuntu version of R.Date: Mon, 17 Sep 2012 05:43:56 -0700 From: ml-node+s789695n4643369...@n4.nabble.com To:

Re: [R] Zip a file

2012-09-17 Thread arun
Hi Antony, I don't use the function zip().  I was able to access the R documentation for zip() (package:utils).  I am using R 2.15 in Ubuntu 12.04.   If I wanted to compress files, I do gzip() from linux terminal.  I guess in windows, you can use 7-zip or other WinZip.  Is there any

Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 4:18 AM, maxbre wrote: here it is, I think (I hope) I'm getting a little closer with this, but still there is something to sort out... error using packet 1 unused argument(s) (coef =1.5, do.out=TRUE) by reading the help for panel.bwplot at the argument stats it

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread Yihui Xie
I think the correct address for GIT should be git://github.com/omegahat/XML.git :) Or just https://github.com/omegahat/XML Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On

Re: [R] count NAs per week

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 6:07 AM, Tagmarie wrote: Thank you Michael, that worked perfectly! Now I wonder, if it is possible to break my data further apart and put it together again. Assume I include a column for an ID in the data frame like this: dattrial2-data.frame(a=c(1,NA,NA,NA,2,3),

Re: [R] Boxplot lattice vs standard graphics

2012-09-17 Thread Rui Barradas
Hello, Em 17-09-2012 18:50, David Winsemius escreveu: On Sep 17, 2012, at 4:18 AM, maxbre wrote: here it is, I think (I hope) I'm getting a little closer with this, but still there is something to sort out... error using packet 1 unused argument(s) (coef =1.5, do.out=TRUE) by reading the

[R] other files in \inst\doc

2012-09-17 Thread A.I. McLeod
I would like to include a Mathematica notebook and cdf file (both are ASCII files) in the \inst\doc directory as supporting documentation. These files are not large, about 340K each one. When I check using R CMD check --as-cran ... I get the following warning: .. * checking

[R] Creating missingness in repeated measurement data

2012-09-17 Thread john james
Dear R users,   I have the following problems. My dataset (dat) is as follows: a - c(1,2,3) id - rep(a, c(3,2,3)) stat - c(1,1,0,1,0,1,1,1) g - c(0,0,0,0,0,0,1,0) stop - c(1,2,4,2,4,1,1.5,3) dat - data.frame(id,stat,g,stop)   I want to creat a new dataset (dat2) with missing values such that

Re: [R] Question about R performance on UNIX/LINUX with, different memory/swap configurations

2012-09-17 Thread Paul Gilbert
On 12-09-17 06:00 AM, r-help-requ...@r-project.org wrote: Date: Sun, 16 Sep 2012 14:41:42 -0500 From: Dirk Eddelbuettele...@debian.org To: Eberle, Anthonyae...@allstate.com Cc:r-help@r-project.org Subject: Re: [R] Question about R performance on UNIX/LINUX with different

Re: [R] Creating missingness in repeated measurement data

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 11:32 AM, john james wrote: Dear R users, I have the following problems. My dataset (dat) is as follows: a - c(1,2,3) id - rep(a, c(3,2,3)) stat - c(1,1,0,1,0,1,1,1) g - c(0,0,0,0,0,0,1,0) stop - c(1,2,4,2,4,1,1.5,3) dat - data.frame(id,stat,g,stop) I want

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread J Toll
On Mon, Sep 17, 2012 at 12:51 PM, Yihui Xie x...@yihui.name wrote: I think the correct address for GIT should be git://github.com/omegahat/XML.git :) Or just https://github.com/omegahat/XML Regards, Yihui -- Yihui Xie xieyi...@gmail.com Phone: 515-294-2465 Web: http://yihui.name

[R] arima forecast without the first order of auto-regressor

2012-09-17 Thread lornyi
Hi, I want to predict using airma, but I want to predict using t-2 or t-3, instead of t-1 right now the arima() function doesn't allow me to do that, it will alwasy return with variable t-1 , what is the way to skip that variable? thanks regards -- View this message in context:

[R] help

2012-09-17 Thread Seydou Badiane
HELLO, I SHALL NEED A HELP. It is my official language(tongue) is French, even if I manage little in English, I shall like understanding(including) as fast as possible, that is why I asked if there is a page wiki in French, thank you in advance for your answers [[alternative HTML version

Re: [R] Any way to get read.table.ffdf() (in the ff package) to pass colClasses or comment.char parameters through to read.fwf() ?

2012-09-17 Thread Jan
Hi Anthony, You are right, read.table.ffdf does not handle additional arguments passed on to read.table in the method read.fwf as you expect. read.table.ffdf checks the arguments of read.fwf and colClasses is not one of them, colClasses is part of ... which is passed on to read.table. You should

[R] loglogistic survreg

2012-09-17 Thread Jeremy Brown
Hi, I'm trying to graph the hazard function using the survreg function with the distributional assumptions to be loglogistic. If h(t)=[lambda*alpha*(lambda*t)^(alpha-1)]/[1+(lambda*t)^alpha], what output from R is alpha? Thanks [[alternative HTML version deleted]]

Re: [R] Creating missingness in repeated measurement data

2012-09-17 Thread Rui Barradas
Hello, Maybe there are simpler ways of doing it, but try the following. sp - lapply(split(dat, dat$id), function(.s){ i - min(which(.s$stat == 0), which(.s$g == 1)) .s$d - .s$stop[i] .s[-1][row(.s[-1]) = i] - NA .s }) dat3 - do.call(rbind, sp) rownames(dat3) -

Re: [R] memory leak using XML readHTMLTable

2012-09-17 Thread Duncan Temple Lang
Thanks Yihui for normalizing my customized git URL. The version of the package on github is in the standard R format and that part of the README is no longer relevant. Sorry for the confusion. It might be simplest to pick up a tar.gz file of the source at

Re: [R] loglogistic survreg

2012-09-17 Thread Thomas Lumley
On Tue, Sep 18, 2012 at 7:06 AM, Jeremy Brown jebrown_...@yahoo.com wrote: Hi, I'm trying to graph the hazard function using the survreg function with the distributional assumptions to be loglogistic. If h(t)=[lambda*alpha*(lambda*t)^(alpha-1)]/[1+(lambda*t)^alpha], what output from R is

Re: [R] eval(parse(...)) only once in a function

2012-09-17 Thread Thomas Lumley
On Mon, Sep 17, 2012 at 6:27 PM, Christof Kluß ckl...@email.uni-kiel.de wrote: Hi I would like to have something like str - df$JT == 12 fun - function(df) { b - eval(parse(str)) return(b) } but for performance eval(parse(a)) should not be evaluated at each function call, but

Re: [R] help

2012-09-17 Thread Rui Barradas
Google est ton ami: http://lmgtfy.com/?q=R+statistiques+fran%C3%A7ais Le deuxième parait prometteur. Bonne chance, Rui Barradas Em 17-09-2012 20:06, Seydou Badiane escreveu: HELLO, I SHALL NEED A HELP. It is my official language(tongue) is French, even if I manage little in English, I shall

[R] Compiling R2.15.1 on ubuntu with x86-64 architecture and shared library

2012-09-17 Thread Conklin, Mike (GfK Custom Research NA)
I am sure I am providing insufficient information, please ask for more. I installed R 2.14.2 on my Ubuntu laptop with and AMD64 processor and also installed RStudio and everything worked fine. Now, I tried to build R 2.15.1 from source and installed it using defaults. RStudio now complained

Re: [R] Compiling R2.15.1 on ubuntu with x86-64 architecture and shared library

2012-09-17 Thread Dirk Eddelbuettel
On 17 September 2012 at 23:51, Conklin, Mike (GfK Custom Research NA) wrote: | I am sure I am providing insufficient information, please ask for more. | | I installed R 2.14.2 on my Ubuntu laptop with and AMD64 processor and also installed RStudio and everything worked fine. | | Now, I tried

[R] eval inside a function call in connection with updating the data slot in the call of lmer

2012-09-17 Thread Søren Højsgaard
Dear list, Given a linear mixed model (from lme4) I want to 1) first change the input dataset and then 2) change the model formula. I want this to happen in a function call; Please see below. Options 1) and 2) below work whereas 3) fails with the message foo() Error in is.data.frame(data) :

Re: [R] eval inside a function call in connection with updating the data slot in the call of lmer

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 3:26 PM, Søren Højsgaard wrote: Dear list, Given a linear mixed model (from lme4) I want to 1) first change the input dataset and then 2) change the model formula. I want this to happen in a function call; Please see below. Options 1) and 2) below work whereas 3)

[R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread Julie Lee-Yaw
Hi  I have a dataframe similar to: Sample-c(1,1,1,2,2,2,3,3,3) Time-c(1,2,3,1,2,3,1,2,3) Mass-c(3,3.1,3.4,4,4.3,4.4,3,3.2,3.5) mydata-as.data.frame(cbind(Sample,Time,Mass))   Sample Time Mass 1      1    1  3.0 2      1    2  3.1 3      1    3  3.4 4      2    1  4.0 5      2    2  4.3 6    

Re: [R] eval inside a function call in connection with updating the data slot in the call of lmer

2012-09-17 Thread Duncan Murdoch
On 12-09-17 6:26 PM, Søren Højsgaard wrote: Dear list, Given a linear mixed model (from lme4) I want to 1) first change the input dataset and then 2) change the model formula. I want this to happen in a function call; Please see below. Options 1) and 2) below work whereas 3) fails with the

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread Phil Spector
Julie - Since the apply functions operate on one row at a time, they can't do what you want. I think the easiest way to solve your problem is to reshape the data set, and merge it back with the original: dd = data.frame(Sample=c(1,1,1,2,2,2,3,3,3), +

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread Rui Barradas
Hello, Try the following. sp - split(mydata, mydata$Sample) do.call(rbind, lapply(sp, function(x){x$Gain - x$Mass[3] - x$Mass[2]; x})) Hope this helps, Rui Barradas Em 18-09-2012 00:15, Julie Lee-Yaw escreveu: Hi I have a dataframe similar to: Sample-c(1,1,1,2,2,2,3,3,3)

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 4:15 PM, Julie Lee-Yaw wrote: Hi I have a dataframe similar to: Sample-c(1,1,1,2,2,2,3,3,3) Time-c(1,2,3,1,2,3,1,2,3) Mass-c(3,3.1,3.4,4,4.3,4.4,3,3.2,3.5) mydata-as.data.frame(cbind(Sample,Time,Mass)) Please tell me where you learned that

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 5:00 PM, David Winsemius wrote: On Sep 17, 2012, at 4:15 PM, Julie Lee-Yaw wrote: Hi I have a dataframe similar to: Sample-c(1,1,1,2,2,2,3,3,3) Time-c(1,2,3,1,2,3,1,2,3) Mass-c(3,3.1,3.4,4,4.3,4.4,3,3.2,3.5) mydata-as.data.frame(cbind(Sample,Time,Mass))

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread Rui Barradas
Or diff(x[2:3]) Rui Barradas Em 18-09-2012 01:05, David Winsemius escreveu: On Sep 17, 2012, at 5:00 PM, David Winsemius wrote: On Sep 17, 2012, at 4:15 PM, Julie Lee-Yaw wrote: Hi I have a dataframe similar to: Sample-c(1,1,1,2,2,2,3,3,3) Time-c(1,2,3,1,2,3,1,2,3)

Re: [R] Parsing back to API strcuture

2012-09-17 Thread Eric Fail
Problem solved by Josh O'Brien on stackoverflow, http://stackoverflow.com/questions/12393004/parsing-back-to-messy-api-strcuture/12435389#12435389 some_magic - function(df) { ## Replace NA with , converting column types as needed df[] - lapply(df, function(X) {

[R] chunk row to new table/file

2012-09-17 Thread s.s.m. fauzi
I have big .csv file. I would like to filter that file into a new table. For example, I have .csv file as below: f1 f2 f3 f4 f5 f6 f7 f9 f10 f11 t1 1 0 1 0 1 0 0 0 01 t2 1 0 0 0 0 1 1 1 11 t3 0 0 0 0 0 0 0 0 00 t4 1

Re: [R] chunk row to new table/file

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 6:27 PM, s.s.m. fauzi wrote: I have big .csv file. I would like to filter that file into a new table. For example, I have .csv file as below: f1 f2 f3 f4 f5 f6 f7 f9 f10 f11 t1 1 0 1 0 1 0 0 0 01 t2 1 0 0 0 0 1 1 1

[R] extracting values

2012-09-17 Thread Champika Shyamalie Kariyawasam
Hi all, I 'm doing the exercise given in the 'SDM with R' (Robert J. Hijmans and Jane Elith), chapter 4.2, regarding extracting values . I tried to do the same using my own data as well. Each cases i received the following error message ; Error in .xyValues(x, as.matrix(y), ...) : xy should

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread arun
HI, Try this:  mydata$Gain-rep(tapply(mydata$Mass,mydata$Sample,FUN=function(x) (x[3]-x[2])),each=length(unique(mydata$Sample)))  mydata #  Sample Time Mass Gain #1  1    1  3.0  0.3 #2  1    2  3.1  0.3 #3  1    3  3.4  0.3 #4  2    1  4.0  0.1 #5  2    2  4.3  0.1 #6  2  

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread arun
HI, Modified version of my earlier solution: res1-tapply(mydata$Mass,mydata$Sample,FUN=function(x) (x[3]-x[2])) res2-data.frame(Sample=names(res1),Gain2_3=res1)  merge(mydata,res2) #Sample Time Mass Gain2_3 #1  1    1  3.0 0.3 #2  1    2  3.1 0.3 #3  1    3  3.4 0.3 #4 

[R] How to convert R script to standalone executable?

2012-09-17 Thread Jingwan Li
Hi all, Can anyone tell me how to convert a R script to a standalone executable that can be installed and run on any Windows machines? Thanks in advance. Jingwan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] help with calculation from dataframe with multiple entries per sample

2012-09-17 Thread David Winsemius
On Sep 17, 2012, at 7:28 PM, arun wrote: HI, Try this: mydata$Gain-rep(tapply(mydata$Mass,mydata$Sample,FUN=function(x) (x[3]-x[2])),each=length(unique(mydata$Sample))) mydata # Sample Time Mass Gain #1 11 3.0 0.3 #2 12 3.1 0.3 #3 13 3.4 0.3 #4

[R] Formula in a data-frame

2012-09-17 Thread Raoni Rodrigues
Hello all, I'm new in R, and I have a data-frame like this (dput information below): Specie Fooditem Occurrence Volume 1 Schizodonvegetal 1 0.05 2 Schizodon sediment 1 0.60 3 Schizodonvegetal 1 0.15 4 Schizodon

[R] S4, polymorphism, and parallelization

2012-09-17 Thread Fernando Saldanha
I am running Rmpi and MPICH2 to do parallelization in a Windows 7 machine. I am only using my PC's cores. Parallelization for standard R code works fine. For S4 code I am having the following problem: Let us say I have a class A and a subclasses B and C (both B and C contains A). I declared a