Re: [R] Writing data onto xlsx file without cell formatting

2016-09-26 Thread Christofer Bogaso
openxlsx is not solving my problem either. It is corrupting my xlsx file. I have a large data.frame, which I want to export to an existing xlsx file, without formatting that existing file. With XLconnect there is an option "setStyleAction(wb,XLC$"STYLE_ACTION.NONE")" which does it so. I am

[R-es] Asignacion de colclasses

2016-09-26 Thread Cesar Lopez
Buenas Noches, Les escribo para solicitarles una ayuda con lo siguiente: "Primero leo las primeras 100 lineas de mi archivo" inicial <- read.csv("cartera1.csv", header=TRUE, sep=";", fileEncoding="latin1", nrows=100) "Segundo determino las clases o tipos de objetos" clases <- sapply(inicial,

[R] ggplot grouped barchart based on marginal proportions

2016-09-26 Thread Paul Sanfilippo
I am trying to create a grouped barplot that uses marginal (row) proportions rather than cell proportions and can't figure out how to change: y = (..count..)/sum(..count..) in ggplot to do this. Using the mtcars dataset as an example and considering two categorical variables (cyl and am -

Re: [R] src/Makevars ignored ?

2016-09-26 Thread Jeff Newmiller
You failed to read the Posting Guide, which would have told you which mailing list to post this question to. (Hint: not this one.) -- Sent from my phone. Please excuse my brevity. On September 26, 2016 4:46:06 AM PDT, Eric Deveaud wrote: > > > Hello, > >as far as I

Re: [R] Writing data onto xlsx file without cell formatting

2016-09-26 Thread jim holtman
I use the "openxlsx" package to handle spreadsheets. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Sep 26, 2016 at 5:56 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hi again, > >

Re: [R] Writing data onto xlsx file without cell formatting

2016-09-26 Thread Christofer Bogaso
Hi again, I have been following above suggestion to export data from R to xlsx file using XLconnect. However recently I am facing Java memory allocation problem with large dataset (looks like a known issue with this package) and therefore decided to move to using "xlsx" package. Now I started

Re: [R] Using lapply in R data table

2016-09-26 Thread Bert Gunter
... and just for fun, here's an alternative in which mapply() is used to vectorize switch(); again, whether you like it may be just a matter of taste, although I suspect it might be less efficient than ifelse(), which is already vectorized: DT <- within(DT, exposure <- {

Re: [R] Using lapply in R data table

2016-09-26 Thread Bert Gunter
Ista: Aha -- now I see the point. My bad. You are right. I was careless. However, cut() with ifelse() might simplify the code a bit and/or make it more readable. To be clear, this is just a matter of taste; e.g. using your data and a data frame instead of a data table: > DT <- within(DT,

Re: [R-es] Concatenación de tablas

2016-09-26 Thread Carlos J. Gil Bellosta
?merge El 26 de septiembre de 2016, 22:09, Cesar Lopez escribió: > Buenas Tardes, > > > Les escribo para solicitarles una ayuda dado que tengo 2 tablas, una con > los campos: > > > cedula | nombre | direccion > > > y la otra con la tabla: > > > cedula | barrio |

Re: [R] 32 and 64 bit R

2016-09-26 Thread Duncan Murdoch
On 26/09/2016 6:29 AM, Mike meyer wrote: Hello, I have both 32 and 64 bit verions of R installed. What happens if I open a workspace saved from 64 bit R in the 32 bit version or conversely? I am fairly careless but never noticed any problems. No problems will arise because of the different

Re: [R] Using lapply in R data table

2016-09-26 Thread Ista Zahn
On Mon, Sep 26, 2016 at 2:48 PM, Bert Gunter wrote: > I thought that that was a typo from the OP, as it disagrees with his > example. But the labels are arbitrary, so in fact cut() will do it > whichever way he meant. I don't see how cut will do it, at least not

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Jeff Newmiller
I think you are going to have to be more specific than "having some trouble". Your plot used lka as the x-axis. FWIW note that lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) is the same as lm(ruotsi.pist ~ mies + koulu*clka, data=dta) -- Sent from my phone. Please excuse my

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Greg Snow
If your goal is to visualize the predicted curve from an lm fit (or other model fit) then you may want to look at the Predict.Plot and TkPredict functions from the TeachingDemos package. On Sun, Sep 25, 2016 at 7:01 AM, Matti Viljamaa wrote: > I’m trying to plot regression

Re: [R] Using lapply in R data table

2016-09-26 Thread Bert Gunter
I thought that that was a typo from the OP, as it disagrees with his example. But the labels are arbitrary, so in fact cut() will do it whichever way he meant. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka

Re: [R] Using lapply in R data table

2016-09-26 Thread Ista Zahn
On Mon, Sep 26, 2016 at 1:59 PM, Bert Gunter wrote: > This seems like a job for cut() . I thought that at first two, but the middle group shouldn't be .87 but rather exposure" = "2007-01-01" - "fini" so, I think cut alone won't do it. Best, Ista > > (I made DT a data

Re: [R] Using lapply in R data table

2016-09-26 Thread Bert Gunter
This seems like a job for cut() . (I made DT a data frame to avoid loading the data table package. But I assume it would work with a data table too, Check this, though!) > DT <- within(DT, exposure <- > cut(fini,as.Date(c("2000-01-01","2006-01-01","2006-06-30","2006-12-21")), > labels=

Re: [R-es] Variable Progresiva

2016-09-26 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal? He leído en este hilo la respuesta correcta a la pregunta equivocada. Realmente, no quieres crear variables con nombres generados con un subíndice; quieres una lista. Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com El 26 de septiembre de 2016, 16:40, Rafael

Re: [R] Using lapply in R data table

2016-09-26 Thread Ista Zahn
Hi Frank, lapply(DT) iterates over each column. That doesn't seem to be what you want. There are probably better ways, but here is one approach. DT[, exposure := vector(mode = "numeric", length = .N)] DT[fini < as.Date("2006-01-01"), exposure := 1] DT[fini >= as.Date("2006-01-01") & fini <=

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Matti Viljamaa
> On 26 Sep 2016, at 19:41, Matti Viljamaa wrote: > > Thank you. > > However, I’m having some trouble converting your code to use clka, because > the model I was using was: > > fit2 <- lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) I mean, not to use clka

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-26 Thread Matti Viljamaa
Thank you. However, I’m having some trouble converting your code to use clka, because the model I was using was: fit2 <- lm(ruotsi.pist ~ mies + koulu + clka + koulu*clka, data=dta) > On 25 Sep 2016, at 21:23, Jeff Newmiller wrote: > > This illustrates why you need

[R] Problem in "cannot allocate vector of size"

2016-09-26 Thread GwanSeon Kim
Hi R-Users, I am running raster to point code in R, but I have an error message that "cannot allocate vector of size 1.7 Gb". One of my friends run the same code I used, and it is working with his computer. I am using Window 7 64-bit with 16 GB ram. When I check memory size and limit in RStudio, I

[R] [R-pkgs] package Rdice released

2016-09-26 Thread Gennaro Tedesco
The package "Rdice" has just been released on CRAN. It contains a collection of functions to simulate dice rolls and the like. In particular, experiments and exercises can be performed looking at combinations and permutations of values in dice rolls and coin flips, together with the corresponding

[R] src/Makevars ignored ?

2016-09-26 Thread Eric Deveaud
Hello, as far as I understood the R library generic compilation mechanism, compilation of C//C++ sources is controlde 1) at system level by the ocntentos RHOME/etc/Makeconf 2) at user level by the content of ~/.R/Makevars 3) at package level by the content of src/Makevars Problem I

[R] 32 and 64 bit R

2016-09-26 Thread Mike meyer
Hello,   I have both 32 and 64 bit verions of R installed. What happens if I open a workspace saved from 64 bit R in the 32 bit version or conversely? I am fairly careless but never noticed any problems.    __ R-help@r-project.org mailing list -- To

[R] Using lapply in R data table

2016-09-26 Thread Frank S.
Dear all, I have a R data table like this: DT <- data.table( id = rep(c(2, 5, 7), c(3, 2, 2)), fini = rep(as.Date(c('2005-04-20', '2006-02-19', '2006-10-08')), c(3, 2, 2)), group = rep(c("A", "B", "A"), c(3, 2, 2)) ) I want to construct a new variable "exposure" defined as follows: 1)

Re: [R-es] Listado de Valores

2016-09-26 Thread Carlos Ortega
Hola, Puedes hacerlo con "unique(tu_data_frame$columa_fechas)" o con "table(tu_data_frame$columa_fechas)" Saludos, Carlos Ortega www.qualityexcellence.es El 26 de septiembre de 2016, 17:14, Rafael Saturno < rafael_satu...@hotmail.com> escribió: > Hola Comunidad, > > > Una duda > > > Como hago

Re: [R-es] Variable Progresiva

2016-09-26 Thread Rafael Saturno
Una duda, si fuese a leer 3 archivos csv que se llamar archivo 1, archivo 2 y archivo 3 tambi�n se podr�a usar? gracias De: Isidro Hidalgo Arellano Enviado: lunes, 26 de septiembre de 2016 07:48 a.m. Para: 'Rafael Saturno'; 'R' Asunto: RE: