Re: [R] R runtime performance and memory usage

2015-11-17 Thread Sasikumar Kandhasamy
Thanks a lot, Martin and William. Looks like, we can't apply prediction on lsfit and lm.fit objects. Because, i am trying to use lm object to predict the values for new data frame. Thanks & Regards Sasi On Tue, Nov 17, 2015 at 9:49 AM, Martin Maechler wrote: > > William Dunlap > >

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Jim Lemon
peter dalgaard wrote: > O2 < 2d < O3 had been even stranger, no? Don't give those dudes in Cupertino any more bright ideas, okay? Jim On Wed, Nov 18, 2015 at 12:11 PM, peter dalgaard wrote: > > > On 18 Nov 2015, at 01:59 , Jeff Newmiller > wrote: > > > > Are you sure that wasn't oh-3 rather

Re: [R] R runtime performance and memory usage

2015-11-17 Thread William Dunlap
That is what I meant about saving compute time and increasing programming time. You can do prediction by do the matrix multiplication explicitly. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Nov 17, 2015 at 9:01 PM, Sasikumar Kandhasamy wrote: > Thanks a lot, Martin and William. Looks li

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread peter dalgaard
> On 18 Nov 2015, at 01:59 , Jeff Newmiller wrote: > > Are you sure that wasn't oh-3 rather than 03? Sure I'm sure. I even cut+pasted the filenames from the offending dir... It's all just Apple trying to be helpful (and failing, again). O2 < 2d < O3 had been even stranger, no? -p >

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Jeff Newmiller
Are you sure that wasn't oh-3 rather than 03? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#..

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Bert Gunter
Thanks, David. Probably as one should expect. But reinforces what others said about first doing explicit conversions so that comparisons are not made made between differing types. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not w

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Duncan Murdoch
On 17/11/2015 6:56 PM, Henrik Bengtsson wrote: When choosing source format, it's probably helpful to know that if you work with a Markdown-based format (e.g. Rmarkdown) you'll be able to generate either/both HTML or/and PDF documents, whereas if you work with LaTeX-based formats (e.g. Sweave/knit

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Henrik Bengtsson
When choosing source format, it's probably helpful to know that if you work with a Markdown-based format (e.g. Rmarkdown) you'll be able to generate either/both HTML or/and PDF documents, whereas if you work with LaTeX-based formats (e.g. Sweave/knitr) you will only be able output PDF documents (at

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread David L Carlson
The conversion seems to be controlled by the scipen setting: > options("scipen") $scipen [1] 0 > as.character(10) [1] "1e+05" > options(scipen=5) > as.character(10) [1] "10" > as.character(100) [1] "100" > as.character(1000) [1] "1000" -

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread peter dalgaard
> On 17 Nov 2015, at 20:37 , Bert Gunter wrote: > >> 2 == "2" > [1] TRUE > > ?"==" says: > > "If the two arguments are atomic vectors of different types, one is > coerced to the type of the other, the (decreasing) order of precedence > being character, complex, numeric, integer, logical and r

[R] finding root of nonlinear equation

2015-11-17 Thread Sherouk Moawad via R-help
Dear R experts I'm trying to use R to solve for the root of one nonlinear function I tried to use the package "rootSolve" but it didn't give any value the value is (numeric(0)) although I tried on changing the interval of root. I tried also the package "nleqslv" but itdidn't iterate what ever

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Thierry Onkelinx
Dear Duncan, I'd rather convert the numeric to character. E.g. with sprintf() or format() in case it is a numeric vector. subset(Data, group == "10") subset(Data, group == sprintf("%.f", 10)) sprintf("%.f", 10) # "10" It requires the user to think about the format, which can red

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Duncan Murdoch
On 17/11/2015 2:25 PM, Duncan Murdoch wrote: On 17/11/2015 2:14 PM, Karl Schilling wrote: > Dear all, > > I have one observation that I do not quite understand. Maybe someone > can clarify this issue for me. > > I have a data frame which I want to subset based on a grouping variable, > say "group

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Bert Gunter
> 2 == "2" [1] TRUE ?"==" says: "If the two arguments are atomic vectors of different types, one is coerced to the type of the other, the (decreasing) order of precedence being character, complex, numeric, integer, logical and raw." > as.character(9) [1] "9" > as.character(10) [1] "

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Thierry Onkelinx
Dear Karl, Since you compare a character with a numeric, R converts the numeric silently. And then you're into trouble. as.character(9) # "9" as.character(10) # "1e+5" Bottom line, use the same type on both sides of the binary operator. Best regards, ir. Thierry Onkelinx Instituut

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Duncan Murdoch
On 17/11/2015 2:14 PM, Karl Schilling wrote: Dear all, I have one observation that I do not quite understand. Maybe someone can clarify this issue for me. I have a data frame which I want to subset based on a grouping variable, say "group". Actually, "group" is a numeric value, but it is saved

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Conklin, Mike (GfK)
R silently converts the integer to a character for comparison in the subset operation. But if we explicitly do the conversion we see that it does not work with the default R settings. > as.character(10) [1] "1e+05" > as.character(9) [1] "9" -- W. Michael Conklin EVP Marketing & Da

[R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread Karl Schilling
Dear all, I have one observation that I do not quite understand. Maybe someone can clarify this issue for me. I have a data frame which I want to subset based on a grouping variable, say "group". Actually, "group" is a numeric value, but it is saved as a character. I give some code to generate

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Duncan Murdoch
On 17/11/2015 10:42 AM, Marc Schwartz wrote: On Nov 17, 2015, at 9:21 AM, John Sorkin wrote: I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be ac

Re: [R] R runtime performance and memory usage

2015-11-17 Thread Martin Maechler
> William Dunlap > on Mon, 16 Nov 2015 16:01:42 -0800 writes: > If a quick running time is important and your models involve only > numeric data with no missing values and you are willing to spend more > programming time setting things up, the lsfit() function may work

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread John Kane
I've been very pleased using knitr in combination with LyX for pdf production. John Kane Kingston ON Canada > -Original Message- > From: jsor...@grecc.umaryland.edu > Sent: Tue, 17 Nov 2015 10:21:15 -0500 > To: r-help@r-project.org > Subject: [R] SWEAVE - a gentle introduction > > I a

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Thierry Onkelinx
Given that you like a gentle introduction and don't know HTML, I would recommend rmarkdown in combination with knitr. See http://rmarkdown.rstudio.com/ for a lot of information. I find knitr more flexible than sweave. Markdown syntax is much easier than HTML or latex. Best regards, Thierry Op 17

Re: [R] Clustered Standard Errors?

2015-11-17 Thread Lorenz, Jennifer
Hi Ignacio, following this link: http://www.ne.su.se/polopoly_fs/1.216115.1426234213!/menu/standard/file/clustering1.pdf you can download a documentation for Arai's cl-function that is mentioned in the link in your email. I used it several times and it works quite well. Just copy the function

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Ista Zahn
I suggest using knitr instead of sweave. There are plenty of tutorials online; http://jeromyanglim.blogspot.co.nz/2012/05/getting-started-with-r-markdown-knitr.html?m=1 might be a good place to start. Links to a full length book and other resources are available at http://yihui.name/knitr/ Best,

Re: [R] SWEAVE - a gentle introduction

2015-11-17 Thread Marc Schwartz
> On Nov 17, 2015, at 9:21 AM, John Sorkin wrote: > > I am looking for a gentle introduction to SWEAVE, and would appreciate > recommendations. > I have an R program that I want to run and have the output and plots in one > document. I believe this can be accomplished with SWEAVE. Unfortunate

[R] SWEAVE - a gentle introduction

2015-11-17 Thread John Sorkin
I am looking for a gentle introduction to SWEAVE, and would appreciate recommendations. I have an R program that I want to run and have the output and plots in one document. I believe this can be accomplished with SWEAVE. Unfortunately I don't know HTML, but am willing to learn. . . as I said I