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

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

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

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/

[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

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

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()

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

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] 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.

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

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

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

[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

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

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 &

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...

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

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

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:

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: >

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

[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

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

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,

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Carlos Ortega
Hola, Esta es una forma: > DF <- data.frame(a=rnorm(1000)) > DF$new <- 1 + floor(1:nrow(DF) / 400) > unique(DF$new) [1] 1 2 3 Saludos, Carlos Ortega www.qualityexcellence.es El 17 de noviembre de 2015, 15:50, Jesús Para Fernández < j.para.fernan...@hotmail.com> escribió: > Entiendo la

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Jorge I Velez
Hola Jesús, No es necesario un loop para ello. A continuación una idea utilizando seq(): datos[-seq(400, NROW(datos), by = 400), ] Saludos cordiales, Jorge Velez.- 2015-11-17 9:14 GMT-05:00 Jesús Para Fernández : > Buenas, tengo un csv [csv final] con 5

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Carlos J. Gil Bellosta
datos <- datos[ (1:nrow(datos) %% 400 != 0, ] Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com El día 17 de noviembre de 2015, 15:14, Jesús Para Fernández escribió: > Buenas, tengo un csv [csv final] con 5 filas, que es unión de varios csv > [csv

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Bartolomé Marcos , José Antonio
Prueba con: Datos[-seq(from = 400, to=5, by = 400), ] No necesitas un buche, para eliminar las filas. Un cordial saludo. -Mensaje original- De: R-help-es [mailto:r-help-es-boun...@r-project.org] En nombre de Jesús Para Fernández Enviado el: Tuesday, November 17, 2015 3:15 PM Para:

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Jesús Para Fernández
Entiendo la logica pero no veo el como hacerlo. No se como implementar el 1+floor(1:nrow(datos)/400)) Gracias Jesús > Date: Tue, 17 Nov 2015 15:31:39 +0100 > Subject: Re: [R-es] Borrar cada fila 400 > From: c...@datanalytics.com > To: j.para.fernan...@hotmail.com > CC:

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Jesús Para Fernández
Gracuas a todos!!! Por cierto, esta ya es de nota. Si quiero agregar una columna, y que cada 400 piezsa el valor se incremente en una unidad, es decir las 400 primeras, tendrian cada fila el valor 1. Las siguientes 400, 2, Lo he hecho con un for, pero va bastante lento: k<-1 for(i in

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Carlos J. Gil Bellosta
1 + floor(1:nrow(datos) / 400) Pura aritmética, de nuevo. Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com El día 17 de noviembre de 2015, 15:28, Jesús Para Fernández escribió: > Gracuas a todos!!! > > Por cierto, esta ya es de nota. Si quiero

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Jesús Para Fernández
La verad es que es un asolución sencilla pero muy eficaz. Ya con esta siguiente duda termino: La matriz de cada csv es de 400x500, es decir, 400 filas y 500 columnas. Si quiero calcular la media de diferentes regiones del csv, por ejemplo la media de las 20 primeras filas y 20 primreas

Re: [R-es] Borrar cada fila 400

2015-11-17 Thread Carlos Ortega
Hola, Esta es una forma. Indicas con unos indices el trozo que quieres, lo seleccionas (df_df_reg) y sobre él calculas medias por fila o por columna. R tiene funciones específicas para este cálculo. #--- n_row <- 400 n_col <- 500 df_mat <- matrix(rnorm(n_row * n_col),