Re: [R] mysterious error message not sure if its from within package?

2015-11-05 Thread Duncan Murdoch
On 05/11/2015 12:14 AM, Sharon Louise Every wrote:
> Hi everyone,
> 
>   Sorry if this is not appropriate through this email list but I wanted to 
> check if this was something wrong with R in my computer rather than within a 
> package I’m using. I am using SIAR - SIBER and have for a few months now. I 
> went back to check some figures with code that I had previously used without 
> a problem. I have since ran the sample data within the package and somebody 
> else’s data and code yet  theirs works and I get the same error Error: not a 
> matrix when bayesian stats are about to be used. I have recently update my 
> osx system to El captain - but everything that I have recently tried works. 
> Does anyone have any suggestions. I have updated, and reinstalled R.

After you get the error, call traceback().  That will usually tell you
where the error occurred by listing the call stack at the time of the
error.

Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] How to change name of pdf output of function windRose in openair package

2015-11-05 Thread Stefano Sofia
Dear r-list users,
I am using windRose within the openair package.
Automatically the wind rose is saved in a pdf file called Rplots.pdf .

I need to apply this function to different data frames, and each time I need to 
change automatically the name of the pdf output.
I am not able to do it, I read the manual quite carefully but I didn't find any 
hint about it.

Would somebody be able to help me?
Thank you for your attention
Stefano




AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere 
informazioni confidenziali, pertanto è destinato solo a persone autorizzate 
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche 
possono contenere informazioni confidenziali e con privilegi legali. Se non si 
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare 
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al 
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi 
dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed 
urgenza, la risposta al presente messaggio di posta elettronica può essere 
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by 
persons entitled to receive the confidential information it may contain. E-mail 
messages to clients of Regione Marche may contain information that is 
confidential and legally privileged. Please do not read, copy, forward, or 
store this message unless you are an intended recipient of it. If you have 
received this message in error, please forward it to the sender and delete it 
completely from your computer system.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] [FORGED] Re: merging-binning data

2015-11-05 Thread Alaios via R-help
Thanks.That is what I want. It is more that I do not know how to read factors 
that these two functions return
Browse[1]> y
$`13.6954016405008`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`88.5092280867206`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`137.931810364616`
[1] (115,217]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

 str(y)
List of 30
 $ 13.6954016405008: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
 $ 88.5092280867206: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
 $ 137.931810364616: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 138.559590072838: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 143.085897171535: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 177.678839068735: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 177.819693807561: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 184.752000138622: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 211.255591076421: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
 $ 238.951618624679: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
 $ 241.609050762905: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
 $ 252.528297510773: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3 3 3
 $ 254.643586371518: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3

I need to be able to keep the items within their groups and at the same time to 
keep the label of the group so to be able to use it for plotting purposes.
How I can do that?RegardsAlex
 


 On Wednesday, November 4, 2015 11:20 PM, Rolf Turner 
 wrote:
   

 
I have been vaguely following this thread and have become very confused 
given the complications that seem to have appeared.

The original question was:

> On Tue, Nov 3, 2015 at 10:47 AM, Alaios via R-help  
> wrote:
>> Dear all,I am not exactly sure on what is the proper name of what I am 
>> trying to do.
>> I have a vector that looks like

Actually you appear to have a 32 x 1 *matrix* (NOT the same thing!) that 
looks like:

>>    binDistance
>>              [,1]
>>    [1,] 238.95162
>>    [2,] 143.08590
>>    [3,]  88.50923
>>    [4,] 177.67884
>>    [5,] 277.54116
>>    [6,] 342.94689
>>    [7,] 241.60905
>>    [8,] 177.81969
>>    [9,] 211.25559
>> [10,] 279.72702
>> [11,] 381.95738
>> [12,] 483.76363
>> [13,] 480.98841
>> [14,] 369.75241
>> [15,] 267.73650
>> [16,] 138.55959
>> [17,] 137.93181
>> [18,] 184.75200
>> [19,] 254.64359
>> [20,] 328.87785
>> [21,] 273.15577
>> [22,] 252.52830
>> [23,] 252.52830
>> [24,] 252.52830
>> [25,] 262.20084
>> [26,] 314.93064
>> [27,] 366.02996
>> [28,] 442.77467
>> [29,] 521.20323
>> [30,] 465.33071
>> [31,] 366.60582
>> [32,]  13.69540

A later addendum to the question indicated that the OP wanted labels for 
the result consisting of the endpoints of the intervals into which the 
data were subdivided.  Unless I am misunderstanding, this is trivial to 
accomplish using cut() and split():

x <- c(238.95162, 143.0859, 88.50923, 177.67884, 277.54116, 342.94689,
241.60905, 177.81969, 211.25559, 279.72702, 381.95738, 483.76363,
480.98841, 369.75241, 267.7365, 138.55959, 137.93181, 184.752,
254.64359, 328.87785, 273.15577, 252.5283, 252.5283, 252.5283,
262.20084, 314.93064, 366.02996, 442.77467, 521.20323, 465.33071,
366.60582, 13.6954)

f <- cut(x,5)

y <- split(x,f)

y

$`(13.2,115]`
[1] 88.50923 13.69540

$`(115,217]`
[1] 143.0859 177.6788 177.8197 211.2556 138.5596 137.9318 184.7520

$`(217,318]`
  [1] 238.9516 277.5412 241.6090 279.7270 267.7365 254.6436 273.1558 
252.5283
  [9] 252.5283 252.5283 262.2008 314.9306

$`(318,420]`
[1] 342.9469 381.9574 369.7524 328.8779 366.0300 366.6058

$`(420,522]`
[1] 483.7636 480.9884 442.7747 521.2032 465.3307


Is this not the result that you want?  If not, what *is* the result that 
you want?

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276


  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R-es] Duda respecto a la dimensión de la división de dos columnas de una tabla

2015-11-05 Thread Albert Montolio
Muchas gracias,

así funciona. La última pregunta del día. Quiero representar un análisis
secuencial. Tengo dos columnas, columna 1 con meses, columna 2 con los
datos. Utilizo la función

indexplot(Serie01D96, type='p', id.method='y', id.n=2,
labels=rownames(test1),
  main=" Diagrama seqüèncial Des96 - Des08"
  )

Pero me representa solo los datos sobre un eje X de 1, 2, 3, 4, etc. Quiero
que en el eje de X salgan los meses, algunos de hecho. Como puedo
escribirlo en comando? He intentando sacar esta información con el paquete
Rcmdr pero no da la opción, por tanto no puedo realizarlo en Rcmdr y ver
como es el código.

Alguien me puede ayudar?

Muchas gracias!
Albert

El 5 de noviembre de 2015, 14:47, Jesús Para Fernández <
j.para.fernan...@hotmail.com> escribió:

> Prueba a hacer esto:
>
> Serie16<-wb[3]/wb[12]
>
> > Date: Thu, 5 Nov 2015 14:43:22 +0100
> > From: albert.monto...@gmail.com
> > To: R-help-es@r-project.org
> > Subject: [R-es] Duda respecto a la dimensión de la división de dos
> columnas de una tabla
>
> >
> > Muchas gracias a tod@s por las respuetas!
> >
> > tengo en una variable wb una tabla con 145 filas y 17 columnas.
> > dim(wb) 145 17
> >
> > Creo una variable Serie16, la cual resulta de dividir la columna 3 y la
> 12.
> > Serie16 <- c(wb[3]/wb[12])
> > Serie16
> >
> > Aquí viene el problema. La dimensión de la nueva columna, pensaba que
> seria
> > 145 filas y 1 columna.
> > Le doy a dim, y me devuelve el valor NULL. Por qué? he dividido columna
> por
> > columna.
> > dim(Serie16) NULL
> > length(Serie16) 1
> >
> > la longitud me sale de 1. Se refiere a 1 columna? como miro el número de
> > filas entonces?
> >
> > el problema viene ahora. Quiero agregar con la función cbind, mi nueva
> > columna calculad, a la tabla que ya tenia con 17 columnas y 145 filas.
> >
> > wb <- cbind(Serie16)
> >
> > Pero no funciona. Donde esta el error? como consigo que cuando hago
> >
> > Serie16 <- c(wb[3]/wb[12])
> >
> > me retorne una variable que sea una tabla, con el mismo numero de filas,
> > para poder utilizar despues
> > la funcion cbind?
> >
> > Muchas gracias!
> > Albert
> >
> > --
> >
> >
> > *Albert Montolio Aguado*
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 


*Albert Montolio Aguado*

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] Duda respecto a la dimensión de la división de dos columnas de una tabla

2015-11-05 Thread Jesús Para Fernández

indexplot(columna1,columna2, id.method='y', id.n=2, labels=rownames(test1),
  main=" Diagrama seq��ncial Des96 - Des08"
  )
Date: Thu, 5 Nov 2015 15:23:06 +0100
Subject: Re: [R-es] Duda respecto a la dimensi�n de la divisi�n de dos columnas 
de una tabla
From: albert.monto...@gmail.com
To: j.para.fernan...@hotmail.com
CC: r-help-es@r-project.org

Muchas gracias, 

as� funciona. La �ltima pregunta del d�a. Quiero representar un an�lisis 
secuencial. Tengo dos columnas, columna 1 con meses, columna 2 con los datos. 
Utilizo la funci�n  

indexplot(Serie01D96, type='p', id.method='y', id.n=2, labels=rownames(test1),
  main=" Diagrama seq��ncial Des96 - Des08"
  )

Pero me representa solo los datos sobre un eje X de 1, 2, 3, 4, etc. Quiero que 
en el eje de X salgan los meses, algunos de hecho. Como puedo escribirlo en 
comando? He intentando sacar esta informaci�n con el paquete Rcmdr pero no da 
la opci�n, por tanto no puedo realizarlo en Rcmdr y ver como es el c�digo.

Alguien me puede ayudar? 

Muchas gracias!
Albert

El 5 de noviembre de 2015, 14:47, Jes�s Para Fern�ndez 
 escribi�:



Prueba a hacer esto:

Serie16<-wb[3]/wb[12]

> Date: Thu, 5 Nov 2015 14:43:22 +0100
> From: albert.monto...@gmail.com
> To: R-help-es@r-project.org
> Subject: [R-es] Duda respecto a la dimensi�n de la divisi�n de dos columnas 
> de una tabla
> 
> Muchas gracias a tod@s por las respuetas!
> 
> tengo en una variable wb una tabla con 145 filas y 17 columnas.
> dim(wb) 145 17
> 
> Creo una variable Serie16, la cual resulta de dividir la columna 3 y la 12.
> Serie16 <- c(wb[3]/wb[12])
> Serie16
> 
> Aqu� viene el problema. La dimensi�n de la nueva columna, pensaba que seria
> 145 filas y 1 columna.
> Le doy a dim, y me devuelve el valor NULL. Por qu�? he dividido columna por
> columna.
> dim(Serie16) NULL
> length(Serie16) 1
> 
> la longitud me sale de 1. Se refiere a 1 columna? como miro el n�mero de
> filas entonces?
> 
> el problema viene ahora. Quiero agregar con la funci�n cbind, mi nueva
> columna calculad, a la tabla que ya tenia con 17 columnas y 145 filas.
> 
> wb <- cbind(Serie16)
> 
> Pero no funciona. Donde esta el error? como consigo que cuando hago
> 
> Serie16 <- c(wb[3]/wb[12])
> 
> me retorne una variable que sea una tabla, con el mismo numero de filas,
> para poder utilizar despues
> la funcion cbind?
> 
> Muchas gracias!
> Albert
> 
> -- 
> 
> 
> *Albert Montolio Aguado*
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
  


-- 


Albert Montolio Aguado
  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

[R-es] seleccionar columnas en archivo .csv

2015-11-05 Thread Albert Montolio
Hola chic@s,

tengo un archivo .csv con 145 filas y 17 columnas. He importado en R el
archivo con la funcion de leer .csv.

//especificar ruta del directori.
setwd("/home/albert/Documentos/R/PAC1")

wb <- read.csv("Dades_PAC1Des96_Des08.csv",header=TRUE)

wbs1<-(wb[,1:3])

quiero meter en una variable una sub-tabla de la tabla 145x17. Se hacer una
matriz 145*3, es decir, con las 3 primeras columnas. Lo que quiero es una
matriz con la primera y la tercera columna. La segunda no la quiero. He
probado con &, he probado con c(1,3) y no hay manera.

Alguna ayuda?

Muchas gracias.
Albert



-- 


*Albert Montolio Aguado*

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] seleccionar columnas en archivo .csv

2015-11-05 Thread Víctor Granda García
Hola.

También puedes hacerlo con dplyr:

library(dplyr)

wbs1 %>%
   select(nombre_columna_1, nombre_columna_3)

Y si la salida tiene que ser una matriz en vez de un data_frame o
data_table:

wbs1 %>%
   select(nombre_columna_1, nombre_columna_3) %>%
   as.matrix(.)

Un saludo.

El jue., 5 nov. 2015 a las 12:48, Jesús Para Fernández (<
j.para.fernan...@hotmail.com>) escribió:

> Prueba con
> wbs1<-(wb[,c(1,3)])
>
> Sino tb puedes hacer esto:
>
> wbs1<-wb
> wbs1[,2]<-NULL
>
>
>
>
> > Date: Thu, 5 Nov 2015 12:24:02 +0100
> > From: albert.monto...@gmail.com
> > To: R-help-es@r-project.org
> > Subject: [R-es] seleccionar columnas en archivo .csv
> >
> > Hola chic@s,
> >
> > tengo un archivo .csv con 145 filas y 17 columnas. He importado en R el
> > archivo con la funcion de leer .csv.
> >
> > //especificar ruta del directori.
> > setwd("/home/albert/Documentos/R/PAC1")
> >
> > wb <- read.csv("Dades_PAC1Des96_Des08.csv",header=TRUE)
> >
> > wbs1<-(wb[,1:3])
> >
> > quiero meter en una variable una sub-tabla de la tabla 145x17. Se hacer
> una
> > matriz 145*3, es decir, con las 3 primeras columnas. Lo que quiero es una
> > matriz con la primera y la tercera columna. La segunda no la quiero. He
> > probado con &, he probado con c(1,3) y no hay manera.
> >
> > Alguna ayuda?
> >
> > Muchas gracias.
> > Albert
> >
> >
> >
> > --
> >
> >
> > *Albert Montolio Aguado*
> >
> >   [[alternative HTML version deleted]]
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-help-es
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] How to change name of pdf output of function windRose in openair package

2015-11-05 Thread Jim Lemon
Hi Stefano,
Just start the PDF device, do the plot, then close the PDF device:

library(openair)
...
data(mydata)
pdf("windRose.pdf")
windRose(mydata)
dev.off()

This is from the first example for the windRose function. It will produce a
file named "windRose.pdf" in the working directory of R.

Jim



On Thu, Nov 5, 2015 at 8:26 PM, Stefano Sofia <
stefano.so...@regione.marche.it> wrote:

> Dear r-list users,
> I am using windRose within the openair package.
> Automatically the wind rose is saved in a pdf file called Rplots.pdf .
>
> I need to apply this function to different data frames, and each time I
> need to change automatically the name of the pdf output.
> I am not able to do it, I read the manual quite carefully but I didn't
> find any hint about it.
>
> Would somebody be able to help me?
> Thank you for your attention
> Stefano
>
>
> 
>
> AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
> informazioni confidenziali, pertanto è destinato solo a persone autorizzate
> alla ricezione. I messaggi di posta elettronica per i client di Regione
> Marche possono contenere informazioni confidenziali e con privilegi legali.
> Se non si è il destinatario specificato, non leggere, copiare, inoltrare o
> archiviare questo messaggio. Se si è ricevuto questo messaggio per errore,
> inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio
> computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in
> caso di necessità ed urgenza, la risposta al presente messaggio di posta
> elettronica può essere visionata da persone estranee al destinatario.
> IMPORTANT NOTICE: This e-mail message is intended to be received only by
> persons entitled to receive the confidential information it may contain.
> E-mail messages to clients of Regione Marche may contain information that
> is confidential and legally privileged. Please do not read, copy, forward,
> or store this message unless you are an intended recipient of it. If you
> have received this message in error, please forward it to the sender and
> delete it completely from your computer system.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R-es] seleccionar columnas en archivo .csv

2015-11-05 Thread Jesús Para Fernández
Prueba con 
wbs1<-(wb[,c(1,3)])

Sino tb puedes hacer esto:

wbs1<-wb
wbs1[,2]<-NULL




> Date: Thu, 5 Nov 2015 12:24:02 +0100
> From: albert.monto...@gmail.com
> To: R-help-es@r-project.org
> Subject: [R-es] seleccionar columnas en archivo .csv
> 
> Hola chic@s,
> 
> tengo un archivo .csv con 145 filas y 17 columnas. He importado en R el
> archivo con la funcion de leer .csv.
> 
> //especificar ruta del directori.
> setwd("/home/albert/Documentos/R/PAC1")
> 
> wb <- read.csv("Dades_PAC1Des96_Des08.csv",header=TRUE)
> 
> wbs1<-(wb[,1:3])
> 
> quiero meter en una variable una sub-tabla de la tabla 145x17. Se hacer una
> matriz 145*3, es decir, con las 3 primeras columnas. Lo que quiero es una
> matriz con la primera y la tercera columna. La segunda no la quiero. He
> probado con &, he probado con c(1,3) y no hay manera.
> 
> Alguna ayuda?
> 
> Muchas gracias.
> Albert
> 
> 
> 
> -- 
> 
> 
> *Albert Montolio Aguado*
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Caret Internal Data Representation

2015-11-05 Thread Lorenzo Isella

Dear All,
I have a data set which contains both categorical and numerical
variables which I analyze using Cubist+the caret framework.
Now, from the generated rules, it is clear that cubist does something
to the categorical variables and probably uses some dummy coding for
them.
However, I cannot right now access the data the way it is transformed
by cubist.
If caret (or the package) need to do some dummy coding of the factors,
how can I access the newly encoded data set?
I suppose this applies to plenty of other packages.
Any suggestion is welcome.
Cheers

Lorenzo

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-05 Thread Evan Cooch



On 11/5/2015 9:45 AM, Rainer Hurling wrote:

Am 04.11.2015 um 21:36 schrieb Evan Cooch:



On 11/4/2015 2:08 PM, Evan Cooch wrote:

Greetings --

This has also been posted on the jags forum, but since I suspect the
problem is more 'R-related' than jags, will aos post here.

Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux
boxes (which run latest RHEL). Here are the basic details:

1\ used R 3.2.2 compiled from source. 64-bit -- nothing fancy, other
than the fact that I used OpenBLAS instead of 'generic'. Works fine.

2\ downloaded and compiled JAGS 4.0.1 from source (nothing fancy,
./configure & make & make install) -- no errors. Runs fine as a
standalone app from CLI.


3\ Downloaded rjags_4-3.tar.gz, and installed from R CLI (within R --
usual R CMD INSTALL approach). Again, no errors reported.


However, when I fire up R, and try something simple like

library(R2jags)

I get a whole slew of error messages - following is reproducible on
all my machines:

Loading required package: rjags
Loading required package: coda
Error : .onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/usr/lib64/R/library/rjags/libs/rjags.so':
libjags.so.3: cannot open shared object file: No such file or directory
Error: package ‘rjags’ could not be loaded




Further puzzlement -- I uninstalled R2jags and rjags, with the idea that
re-installing them (ostensibly with the 'latest and greatest') would do
the trick. While the process went fine for R2jags, when I tried to
re-install rjags, got the following error messages:

checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking for jags_version in -ljags... yes
checking version of JAGS library... wrong version
configure: error: rjags requires JAGS version 4.x.y
ERROR: configuration failed for package ‘rjags’
* removing ‘/usr/lib64/R/library/rjags’
* restoring previous ‘/usr/lib64/R/library/rjags’


Hmm, is it possible, that your JAGS 4.x.y installation is fine, but an 
old libjags.so library is lying around from a not fully completed 
deinstallation? Could you have a look for older libjags.so versions, 
please?


Just a thought.




I suppose thats possible -- I'll go through the sequence again at some 
point, and report back.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] Attempting to plot two different time series together

2015-11-05 Thread Ezra Boyd
Hello,

I am trying to create a plot (I guess two plots) using two different time
series datasets, but I'm not sure of the best approach.  The data is from a
tidal surge due to a hurricane and I would like to show the relationship
between stage and windspeed/direction.

One dataset is the tidal stage and it is sampled in 30 minutes intervals.
The other dataset is windspeed and direction and it is sampled every 6
minutes.  I would like to display the tidal hydrograph and then also show
windspeed and direction as a banner above it.  They would be two separate
plots, but with identical x-axis (as opposed to one plot that has both tide
& wind.)

Should I combine the two time series into one dataframe (with lots of NAs)
so that I can create the plots together, for example using pairs or
ggpairs? Or should I keep them separate, make the individual plots, and
then work on the layout in graphic design software? I would prefer the
former, but I just can't figure out how to make that work out.

Also, is it possible to depict wind direction (which is given in degree
clockwise from due north) with an arrow?

Thank you very much,

Ezra

-- 
Ezra Boyd, PhD
DisasterMap.net, LLC 
ezgis 7...@gmail.com 
(504)533-4447

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] JAGS 4.x, rjags 4.x problems | Linux -- solved

2015-11-05 Thread Evan Cooch
Well, sort of. I got sufficiently frustrated that I completely 
uninstalled R, jags, and everything related. Did a re-install using only 
versions of R nd JAGS found in the epel repo. No muss, no muss -- all 
works.


Out of curiosity, uninstalled again, and tried my usual sequence of 
manually compile R from source, same with JAGS. R works, JAGS works, but 
can't get any R package linking the two (say, rjags, R2jags), to 
recognize that JAGS is installed.


Ah well, at least the 'install from repos' approach works. I'll have to 
make do with that.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] post a message - R help. Surivival analysis and goodness of fit

2015-11-05 Thread Luke Gaylor
Hello there,

I have registered for both through nabble and R-help-request with this email.

I want to post the following question:

I want to implement a Hosmer Lemeshow Goodness of Fit test to my survival 
analysis.
In R we can use the hoslem.test() function.
The x values are our observations, and y are our fitted probabilities.

So we can take the following data:

s <- Surv(ovarian$futime, ovarian$fustat)
sWei <- survreg(s ~ age,dist='weibull',data=ovarian)

so here we assume a weibull distribution. I want to do a HL GOF test to see, if 
this is an invalid assumption.
Now how do we get our predicted probabilities. I assume it is with the 
predict() function.
I have tried the code, but it is not correct

predict(sWei, newdata=list(ovarian$age), type = 'response')
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] JAGS 4.x, rjags 4.x problems | Linux -- solved

2015-11-05 Thread Rainer Hurling
Am 05.11.2015 um 15:44 schrieb Evan Cooch:
> Well, sort of. I got sufficiently frustrated that I completely
> uninstalled R, jags, and everything related. Did a re-install using only
> versions of R nd JAGS found in the epel repo. No muss, no muss -- all
> works.
> 
> Out of curiosity, uninstalled again, and tried my usual sequence of
> manually compile R from source, same with JAGS. R works, JAGS works, but
> can't get any R package linking the two (say, rjags, R2jags), to
> recognize that JAGS is installed.
> 
> Ah well, at least the 'install from repos' approach works. I'll have to
> make do with that.


Just took another look in my installation call, I made some time ago.
What I did to get it work on FreeBSD was:


R CMD INSTALL rjags_4-4.tar.gz --configure-args='CPPFLAGS="-fPIC"
LDFLAGS="-L/usr/local/lib -ljags"
--with-jags-include=/usr/local/include/JAGS --with-jags-lib=/usr/local/lib'


So I used --configure-args, LDFLAGS, --with-jags-inlcue and
--with-jags-lib in my installation procedure. Perhaps it is worth
another try?

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating "Envelope" around a plot

2015-11-05 Thread Greg Snow
Look at the polylineoffset function in the polyclip package.  It looks
like it does what you are asking for.

On Mon, Nov 2, 2015 at 5:33 AM, WRAY NICHOLAS
 wrote:
> Hi  I am plotting various strands of information, and I want to create an
> "envelope" around each line, so that the locus of the envelope is the boundary
> points no more than a fixed maximum distance from the plotted line, a bit like
> drawing a larger rectangle with paralle sides and curved compass corners 
> around
> a smaller rectangle.  Obviously I can work out how to do this in code
> (eventually) but I suspect it would take me a while and i was wondering 
> whether
> there was some R function which I don't know about which creates sets of of
> points at a given maximal distance
>
> the lines are simple vectors, ie like this noddy example
>
> veca<-c(4,3,6,5,7,3,2,3,3,6,8,7)
> plot(veca,type="l",lwd=2)
>
> then I want to plot the locus of the boundary of all points no more than 
> (say) 1
> unit from the line  I imagine that one would have to provide a larger set of
> interpolated points between the actual points of veca, but I can do that no
> problem
>
> I'd be grateful if anyone out there in the R-ethervoid has any ideas
>
> Thanks, Nick Wray
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Duncan Murdoch

On 05/11/2015 1:00 PM, Dimitri Liakhovitski wrote:

I am using a windows laptop, R 3.2.2

I am using R-gui.

When I go to Packages -> Update packages and then select a Cran mirror
(in the US) - it tells me to update the following packages:

GLMMGibbs
RDCOMClient
Rstem
survnnet
yags

I click OK and then I get successful update messages, like:

trying URL 
'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/survnnet_1.1-3.zip'
Content type 'application/zip' length 235981 bytes (230 KB)
downloaded 230 KB

trying URL 
'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/yags_4.0-2.2.zip'
Content type 'application/zip' length 205372 bytes (200 KB)
downloaded 200 KB

package ‘survnnet’ successfully unpacked and MD5 sums checked
package ‘yags’ successfully unpacked and MD5 sums checked

Then I to to Packages -> Update packages, and exactly the same
packages as before appear - as if I didn't just update them.

What could be the reason? I tried to totally delete the folders of
those packages, install them from scratch (successfully), still - they
keep appearing in Update Pacakges widnow.

Any advice?


It may be installing them to a personal library rather than the system 
one (to which you typically don't have write permission).


You should be getting messages about this, but they might be hidden; if 
you run


update.packages()

it might be easier to see the messages.  You can also try running 
.libPaths() to see what libraries are searched.


Duncan Murdoch

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
I am using a windows laptop, R 3.2.2

I am using R-gui.

When I go to Packages -> Update packages and then select a Cran mirror
(in the US) - it tells me to update the following packages:

GLMMGibbs
RDCOMClient
Rstem
survnnet
yags

I click OK and then I get successful update messages, like:

trying URL 
'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/survnnet_1.1-3.zip'
Content type 'application/zip' length 235981 bytes (230 KB)
downloaded 230 KB

trying URL 
'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/yags_4.0-2.2.zip'
Content type 'application/zip' length 205372 bytes (200 KB)
downloaded 200 KB

package ‘survnnet’ successfully unpacked and MD5 sums checked
package ‘yags’ successfully unpacked and MD5 sums checked

Then I to to Packages -> Update packages, and exactly the same
packages as before appear - as if I didn't just update them.

What could be the reason? I tried to totally delete the folders of
those packages, install them from scratch (successfully), still - they
keep appearing in Update Pacakges widnow.

Any advice?
Thank you!

-- 
Dimitri Liakhovitski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
Just in case:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.2.2lavaan_0.5-19  mnormt_1.5-3   pbivnorm_0.6.0 stats4_3.2.2
[6] quadprog_1.5-5

On Thu, Nov 5, 2015 at 2:00 PM, Dimitri Liakhovitski
 wrote:
> I am using a windows laptop, R 3.2.2
>
> I am using R-gui.
>
> When I go to Packages -> Update packages and then select a Cran mirror
> (in the US) - it tells me to update the following packages:
>
> GLMMGibbs
> RDCOMClient
> Rstem
> survnnet
> yags
>
> I click OK and then I get successful update messages, like:
>
> trying URL 
> 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/survnnet_1.1-3.zip'
> Content type 'application/zip' length 235981 bytes (230 KB)
> downloaded 230 KB
>
> trying URL 
> 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/yags_4.0-2.2.zip'
> Content type 'application/zip' length 205372 bytes (200 KB)
> downloaded 200 KB
>
> package ‘survnnet’ successfully unpacked and MD5 sums checked
> package ‘yags’ successfully unpacked and MD5 sums checked
>
> Then I to to Packages -> Update packages, and exactly the same
> packages as before appear - as if I didn't just update them.
>
> What could be the reason? I tried to totally delete the folders of
> those packages, install them from scratch (successfully), still - they
> keep appearing in Update Pacakges widnow.
>
> Any advice?
> Thank you!
>
> --
> Dimitri Liakhovitski



-- 
Dimitri Liakhovitski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Caret Internal Data Representation

2015-11-05 Thread Bert Gunter
I am not familiar with caret/Cubist, but assuming they follow the
usual R procedures that encode categorical factors for conditional
fitting, you need to do some homework on your own by reading up on the
use of contrasts in regression.

See ?factor and ?contrasts (and other linked Help as necessary) to see
what are R's usual procedures, but you will undoubtedly need to
consult outside statistical references -- the help files will point
you to some -- to fully understand what's going on. It is not trivial.

Cheers,
Bert
Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Thu, Nov 5, 2015 at 9:38 AM, Lorenzo Isella  wrote:
> Dear All,
> I have a data set which contains both categorical and numerical
> variables which I analyze using Cubist+the caret framework.
> Now, from the generated rules, it is clear that cubist does something
> to the categorical variables and probably uses some dummy coding for
> them.
> However, I cannot right now access the data the way it is transformed
> by cubist.
> If caret (or the package) need to do some dummy coding of the factors,
> how can I access the newly encoded data set?
> I suppose this applies to plenty of other packages.
> Any suggestion is welcome.
> Cheers
>
> Lorenzo
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] A bunch of packages keeps wanting to get updated

2015-11-05 Thread Dimitri Liakhovitski
Thank you, Duncan.
Indeed those packages were sitting in a temp directory.
I had to install them manually from a 'zip file.

On Thu, Nov 5, 2015 at 2:40 PM, Duncan Murdoch  wrote:
> On 05/11/2015 1:00 PM, Dimitri Liakhovitski wrote:
>>
>> I am using a windows laptop, R 3.2.2
>>
>> I am using R-gui.
>>
>> When I go to Packages -> Update packages and then select a Cran mirror
>> (in the US) - it tells me to update the following packages:
>>
>> GLMMGibbs
>> RDCOMClient
>> Rstem
>> survnnet
>> yags
>>
>> I click OK and then I get successful update messages, like:
>>
>> trying URL
>> 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/survnnet_1.1-3.zip'
>> Content type 'application/zip' length 235981 bytes (230 KB)
>> downloaded 230 KB
>>
>> trying URL
>> 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.2/yags_4.0-2.2.zip'
>> Content type 'application/zip' length 205372 bytes (200 KB)
>> downloaded 200 KB
>>
>> package ‘survnnet’ successfully unpacked and MD5 sums checked
>> package ‘yags’ successfully unpacked and MD5 sums checked
>>
>> Then I to to Packages -> Update packages, and exactly the same
>> packages as before appear - as if I didn't just update them.
>>
>> What could be the reason? I tried to totally delete the folders of
>> those packages, install them from scratch (successfully), still - they
>> keep appearing in Update Pacakges widnow.
>>
>> Any advice?
>
>
> It may be installing them to a personal library rather than the system one
> (to which you typically don't have write permission).
>
> You should be getting messages about this, but they might be hidden; if you
> run
>
> update.packages()
>
> it might be easier to see the messages.  You can also try running
> .libPaths() to see what libraries are searched.
>
> Duncan Murdoch
>



-- 
Dimitri Liakhovitski

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] creating a jpeg from xyplot with openbugs

2015-11-05 Thread Chris
 I'm using xyplot to plot MCMC results generated via R2openbugs and coda and 
trying to create jpeg outputs. the jpegs are blank
I can plot the MCMC object with xyplot at the command line
however, when I use a function to send the  plot to a jpeg (or to a bmp, or png 
or pdf) the file is created and the plot is blank
>example commands
cond.out10c <- bugs(data.cond, inits, params, model.file,codaPkg=TRUE, 
n.iter=5)cond.out.coda10c <- read.bugs(cond.out10c) 
the following command displays the xyplotxyplot(cond.out.coda10c)
The following command creates a jpeg inside a function, but the jpeg is 
blankxysendit <- 
function(mcmcobj){jpeg(file="C:\\testplot.jpg")xyplot(mcmcobj)dev.off()}xysendit(cond.out.coda10c)

Chris Barker, Ph.D.
Adjunct Associate Professor of Biostatistics - UIC-SPH
415 609 7473 
skype: barkerstats


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] creating a jpeg from xyplot with openbugs

2015-11-05 Thread Bert Gunter
Please post i plain text, as request by the posting guide. As you can
see, HTML can come out a mess.

Answer: FAQ 7.22

-- Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Thu, Nov 5, 2015 at 2:30 PM, Chris  wrote:
>  I'm using xyplot to plot MCMC results generated via R2openbugs and coda and 
> trying to create jpeg outputs. the jpegs are blank
> I can plot the MCMC object with xyplot at the command line
> however, when I use a function to send the  plot to a jpeg (or to a bmp, or 
> png or pdf) the file is created and the plot is blank
>>example commands
> cond.out10c <- bugs(data.cond, inits, params, model.file,codaPkg=TRUE, 
> n.iter=5)cond.out.coda10c <- read.bugs(cond.out10c)
>the following command displays the xyplotxyplot(cond.out.coda10c)
>The following command creates a jpeg inside a function, but the jpeg is 
>blankxysendit <- 
>function(mcmcobj){jpeg(file="C:\\testplot.jpg")xyplot(mcmcobj)dev.off()}xysendit(cond.out.coda10c)
>
> Chris Barker, Ph.D.
> Adjunct Associate Professor of Biostatistics - UIC-SPH
> 415 609 7473
> skype: barkerstats
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with dplyr

2015-11-05 Thread Axel Urbiz
Hello, 
 
Is there a way to avoid the warning below in dplyr. I’m performing an operation 
within groups, and the warning says that the factors created from each group do 
not have the same levels, and so it coerces the factor to character. I’m using 
this inside a package I’m developing. I’d appreciate your recommendation on how 
to handle this.
 
library(dplyr)
 
set.seed(4)
df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels = 
c("model1", "model2")))
 
create_bins <- function (pred, nBins) {
  Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
  bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks, 
include.lowest = TRUE))
  bin
}
 
res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
Warning message:
  In rbind_all(out[[1]]) : Unequal factor levels: coercing to character
 
Thank you,
Axel.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Help with dplyr

2015-11-05 Thread peter dalgaard

> On 06 Nov 2015, at 00:59 , Axel Urbiz  wrote:
> 
> Hello, 
> 
> Is there a way to avoid the warning below in dplyr. I’m performing an 
> operation within groups, and the warning says that the factors created from 
> each group do not have the same levels, and so it coerces the factor to 
> character. I’m using this inside a package I’m developing. I’d appreciate 
> your recommendation on how to handle this.

Well, what did you intend? If you cut according to quantiles, the levels of the 
result will reflect the value of the quantiles, as in

> y <- runif(10)
> cut(y, quantile(y,c(0,.25,.5,.75, 1)), include.lowest=T)
 [1] (0.65,0.765]  [0.108,0.281] [0.108,0.281] (0.65,0.765]  (0.281,0.528]
 [6] [0.108,0.281] (0.528,0.65]  (0.281,0.528] (0.65,0.765]  (0.528,0.65] 
Levels: [0.108,0.281] (0.281,0.528] (0.528,0.65] (0.65,0.765]

If you do it in different groups, the quantiles will differ, hence the factor 
levels too. Concatenating the resulting factors will get you in trouble.

If you don't mind losing the information about that the quantile intervals are, 
you could consider standardizing the levels with somthing like levels(bin$bin) 
<- 1:nBins.

-pd

> 
> library(dplyr)
> 
> set.seed(4)
> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels = 
> c("model1", "model2")))
> 
> create_bins <- function (pred, nBins) {
>  Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
>  bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks, 
> include.lowest = TRUE))
>  bin
> }
> 
> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
> Warning message:
>  In rbind_all(out[[1]]) : Unequal factor levels: coercing to character
> 
> Thank you,
> Axel.
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] [FORGED] Re: merging-binning data

2015-11-05 Thread Rolf Turner

On 05/11/15 22:49, Alaios wrote:

Thanks.That is what I want. It is more that I do not know how to read
factors that these two functions return

Browse[1]> y
$`13.6954016405008`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`88.5092280867206`
[1] (13.2,115]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

$`137.931810364616`
[1] (115,217]
Levels: (13.2,115] (115,217] (217,318] (318,420] (420,522]

  str(y)
List of 30
  $ 13.6954016405008: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
  $ 88.5092280867206: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 1
  $ 137.931810364616: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 138.559590072838: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 143.085897171535: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 177.678839068735: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 177.819693807561: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 184.752000138622: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 211.255591076421: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 2
  $ 238.951618624679: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
  $ 241.609050762905: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3
  $ 252.528297510773: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3 3 3
  $ 254.643586371518: Factor w/ 5 levels "(13.2,115]","(115,217]",..: 3

I need to be able to keep the items within their groups and at the same
time to keep the label of the group so to be able to use it for plotting
purposes.

How I can do that?


(1) I am afraid that I have no idea what you're asking.  It seems to me 
that you need to learn how to "do R".


(2) I'm puzzled by your "str(y)" output given above.  If the "y" in 
question is that from the commands that I sent you, then it should be a 
list with *5* entries, not 30!


Note that y is a *list* of 5 vectors, the first of which consists of all 
those entries of your original data vector that lie between 13.2 and 
115, the second of which consists of all those entries of your original 
data vector that lie between 115 and 217, and so on.


It doesn't seem very complicated to me.  What is it that you don't 
understand?


cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] post a message - R help. Surivival analysis and goodness of fit

2015-11-05 Thread David Winsemius

> On Nov 5, 2015, at 6:34 AM, Luke Gaylor  wrote:
> 
> Hello there,
> 
> I have registered for both through nabble and R-help-request with this email.
> 
> I want to post the following question:
> 
> I want to implement a Hosmer Lemeshow Goodness of Fit test to my survival 
> analysis.
> In R we can use the hoslem.test() function.
> The x values are our observations, and y are our fitted probabilities.
> 
> So we can take the following data:
> 
> s <- Surv(ovarian$futime, ovarian$fustat)
> sWei <- survreg(s ~ age,dist='weibull',data=ovarian)
> 
> so here we assume a weibull distribution. I want to do a HL GOF test to see, 
> if this is an invalid assumption.
> Now how do we get our predicted probabilities. I assume it is with the 
> predict() function.
> I have tried the code, but it is not correct

(It would be better to post the reason for your conclusion of “incorrectitude”. 
Error? Unexpected result? )


> predict(sWei, newdata=list(ovarian$age), type = 'response’)

This code had an unmatched single quote because the flanking character was 
a”smart-quote. I’m side-stepping the wisdom of using an HL GOF test of a 
distrubutional assumption. I suspect that the argument to newdata will not have 
a name. Try:

 predict(sWei, newdata=list(age = ovarian$age), type = ‘response')

Or, since you jsut want the original data to be the basis:

 predict(sWei,  type = ‘response')

— 
David.

> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] cannot install RWinEdt

2015-11-05 Thread Uwe Ligges



On 06.11.2015 02:06, Nordlund, Dan (DSHS/RDA) wrote:

You might want to upgrade to R-3.2.2 as there appears to be a RWinEdt binary 
available for it.


There is also a binary for the R-3.1.x series, hence 
install.packages("RWinEdt") should do the trick.



Anyway, if you want to install from sources, please instal the Rtools 
and also install with the --no-test-load flag (RWinEdt complains if 
called non-interactively).


Best,
Uwe Ligges





Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Cynthia Yeung - 
NOAA Federal
Sent: Thursday, November 05, 2015 3:18 PM
To: r-help@r-project.org
Subject: [R] cannot install RWinEdt

I am an intermediate R user with little understanding of the working of R 
packages.
My problem is with the package RWinEdt.

I was using using WinEdt 6 with R 3.1.3 and R-Sweave-6 in Windows 7 rather 
smoothly.
Then I got a brand new computer,still running windows 7.
I installed R 3.1.3, no new packages except the base packages.
I installed WinEdt 6.
I cannot get RWinEdt to install.
I tried:
RWinEdt_2.0-4.tar.gz
RWinEdt2.0-0.zip
RWinEdt_1.6-2.zip
nothing worked.

Error messages from trying different strategies include:

*** 1 

install.packages("RWinEdt", type="source")

trying URL 'http://cran.fhcrc.org/src/contrib/RWinEdt_2.0-5.tar.gz'
Content type 'application/x-gzip' length 590307 bytes (576 KB) opened URL 
downloaded 576 KB

* installing *source* package 'RWinEdt' ...
** package 'RWinEdt' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f 
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'

The downloaded source packages are in
 ‘C:\Users\cy\AppData\Local\Temp\RtmpgdAJ2x\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l "C:\Program 
Files\R\R-3.1.3\library"
C:\Users\CYNTHI~1.YEU\AppData\Local\Temp\RtmpgdAJ2x/downloaded_packages/RWinEdt_2.0-5.tar.gz'
had status 1
2: In install.packages("RWinEdt", type = "source") :
   installation of package ‘RWinEdt’ had non-zero exit status

library(RWinEdt)

Error in library(RWinEdt) : there is no package called ‘RWinEdt’

utils:::menuInstallPkgs()

Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
type) :
   no packages were specified

**

*** 2 

install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz", repos
=

NULL, type="source")
* installing *source* package 'RWinEdt' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f 
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l "C:\Program 
Files\R\R-3.1.3\library"
"D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz"' had status 1
2: In install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz",  :
   installation of package ‘D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz’ had 
non-zero exit status

utils:::menuInstallLocal()

package ‘RWinEdt’ successfully unpacked and MD5 sums checked

library(RWinEdt)

Error: package ‘RWinEdt’ was built before R 3.0.0: please re-install it

install.packages('RWinEdt')


package ‘RWinEdt’ is available as a source package but not as a binary

Warning message:
package ‘RWinEdt’ is not available (as a binary package for R version
3.1.3)

**

*** 3 

install.packages('RWinEdt')

Warning: unable to access index for repository
http://www.rforge.net/bin/windows/contrib/3.1

package ‘RWinEdt’ is available as a source package but not as a binary

**

Appreciate any help.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To 

Re: [R] cannot install RWinEdt

2015-11-05 Thread Uwe Ligges
There is also a binary for the R-3.1.x series, hence 
install.packages("RWinEdt") should do the trick.



Anyway, if you want to install from sources, please instal the Rtools 
and also install with the --no-test-load flag (RWinEdt complains if 
called non-interactively).


Best,
Uwe Ligges




On 06.11.2015 00:17, Cynthia Yeung - NOAA Federal wrote:

I am an intermediate R user with little understanding of the working of R
packages.
My problem is with the package RWinEdt.

I was using using WinEdt 6 with R 3.1.3 and R-Sweave-6 in Windows 7 rather
smoothly.
Then I got a brand new computer,still running windows 7.
I installed R 3.1.3, no new packages except the base packages.
I installed WinEdt 6.
I cannot get RWinEdt to install.
I tried:
RWinEdt_2.0-4.tar.gz
RWinEdt2.0-0.zip
RWinEdt_1.6-2.zip
nothing worked.

Error messages from trying different strategies include:

*** 1 

install.packages("RWinEdt", type="source")

trying URL 'http://cran.fhcrc.org/src/contrib/RWinEdt_2.0-5.tar.gz'
Content type 'application/x-gzip' length 590307 bytes (576 KB)
opened URL
downloaded 576 KB

* installing *source* package 'RWinEdt' ...
** package 'RWinEdt' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'

The downloaded source packages are in
 ‘C:\Users\cy\AppData\Local\Temp\RtmpgdAJ2x\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l
"C:\Program Files\R\R-3.1.3\library"
C:\Users\CYNTHI~1.YEU\AppData\Local\Temp\RtmpgdAJ2x/downloaded_packages/RWinEdt_2.0-5.tar.gz'
had status 1
2: In install.packages("RWinEdt", type = "source") :
   installation of package ‘RWinEdt’ had non-zero exit status

library(RWinEdt)

Error in library(RWinEdt) : there is no package called ‘RWinEdt’

utils:::menuInstallPkgs()

Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
type) :
   no packages were specified

**

*** 2 

install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz", repos =

NULL, type="source")
* installing *source* package 'RWinEdt' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l
"C:\Program Files\R\R-3.1.3\library"
"D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz"' had status 1
2: In install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz",  :
   installation of package ‘D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz’ had
non-zero exit status

utils:::menuInstallLocal()

package ‘RWinEdt’ successfully unpacked and MD5 sums checked

library(RWinEdt)

Error: package ‘RWinEdt’ was built before R 3.0.0: please re-install it

install.packages('RWinEdt')


package ‘RWinEdt’ is available as a source package but not as a binary

Warning message:
package ‘RWinEdt’ is not available (as a binary package for R version
3.1.3)

**

*** 3 

install.packages('RWinEdt')

Warning: unable to access index for repository
http://www.rforge.net/bin/windows/contrib/3.1

package ‘RWinEdt’ is available as a source package but not as a binary

**

Appreciate any help.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] cannot install RWinEdt

2015-11-05 Thread Cynthia Yeung - NOAA Federal
I am an intermediate R user with little understanding of the working of R
packages.
My problem is with the package RWinEdt.

I was using using WinEdt 6 with R 3.1.3 and R-Sweave-6 in Windows 7 rather
smoothly.
Then I got a brand new computer,still running windows 7.
I installed R 3.1.3, no new packages except the base packages.
I installed WinEdt 6.
I cannot get RWinEdt to install.
I tried:
RWinEdt_2.0-4.tar.gz
RWinEdt2.0-0.zip
RWinEdt_1.6-2.zip
nothing worked.

Error messages from trying different strategies include:

*** 1 
> install.packages("RWinEdt", type="source")
trying URL 'http://cran.fhcrc.org/src/contrib/RWinEdt_2.0-5.tar.gz'
Content type 'application/x-gzip' length 590307 bytes (576 KB)
opened URL
downloaded 576 KB

* installing *source* package 'RWinEdt' ...
** package 'RWinEdt' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'

The downloaded source packages are in
‘C:\Users\cy\AppData\Local\Temp\RtmpgdAJ2x\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l
"C:\Program Files\R\R-3.1.3\library"
C:\Users\CYNTHI~1.YEU\AppData\Local\Temp\RtmpgdAJ2x/downloaded_packages/RWinEdt_2.0-5.tar.gz'
had status 1
2: In install.packages("RWinEdt", type = "source") :
  installation of package ‘RWinEdt’ had non-zero exit status
> library(RWinEdt)
Error in library(RWinEdt) : there is no package called ‘RWinEdt’
> utils:::menuInstallPkgs()
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
type) :
  no packages were specified

**

*** 2 
> install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz", repos =
NULL, type="source")
* installing *source* package 'RWinEdt' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l
"C:\Program Files\R\R-3.1.3\library"
"D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz"' had status 1
2: In install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz",  :
  installation of package ‘D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz’ had
non-zero exit status
> utils:::menuInstallLocal()
package ‘RWinEdt’ successfully unpacked and MD5 sums checked
> library(RWinEdt)
Error: package ‘RWinEdt’ was built before R 3.0.0: please re-install it
> install.packages('RWinEdt')

   package ‘RWinEdt’ is available as a source package but not as a binary

Warning message:
package ‘RWinEdt’ is not available (as a binary package for R version
3.1.3)

**

*** 3 
> install.packages('RWinEdt')
Warning: unable to access index for repository
http://www.rforge.net/bin/windows/contrib/3.1

   package ‘RWinEdt’ is available as a source package but not as a binary

**

Appreciate any help.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] problem in R

2015-11-05 Thread Jim Lemon
Hi thanoon,
When I run your code, I get two error messages. Those error messages tell
you all you need to know to solve the first part of your problem (i.e. that
none of the values in W1 and W2 are changed from NA). The second part of
your problem is that even if you attend to those error messages, you will
only change the first values in W1 and W2. The fundamental problem that has
emerged in this discussion is that you seem to be applying the method of
post-modernist deconstruction to programming in R. I see no future in this
enterprise.

Jim


On Fri, Nov 6, 2015 at 1:10 AM, thanoon younis 
wrote:

> Dear Dr. Lemon
>
> I have a problem in the code below same the previous problem but the data
> now is dichotomous with two categories 0,1. I want to transfer the vector
> BZ with missing data to vector W with dichotomous data but the result is NA
> for W how can i solve this problem please?
>
> Mnay thanks in advance
>
>
>
>
> N1<-200;N2<-200;P<-9
> BZ1=matrix(NA, nrow=N1, ncol=1)
> BZ2=matrix(NA, nrow=N2, ncol=1)
> W1=matrix(NA, nrow=N1, ncol=1)
> W2=matrix(NA, nrow=N2, ncol=1)
>
> BZ1=rbinom(200,1,0.7)
>
>
> for (j in 1:1) { if (BZ1[i]>=0) W1[i]<-1 else W1[i]<-0 }
>
>  BZ2=rbinom(200,1,0.7)
>
>
>
>  for (j in 1:1) { if (BZ2[i]>=0) W2[i]<-1 else W2[i]<-0 }
>
>
>   #Input data set for OpenBUGS
>   data<-list(N1=200,N2=200,P=9,R=Ro,W1,W2)
>
>
> #end
>
> W1
> W2
>
> --
> Thanoon Y. Thanoon
> PhD Candidate
> Department of Mathematical Sciences
> Faculty of Science
> University Technology Malaysia, UTM
> E.Mail: thanoon.youni...@gmail.com
> E.Mail: dawn_praye...@yahoo.com
> Facebook:Thanoon Younis AL-Shakerchy
> Twitter: Thanoon Alshakerchy
> H.P:00601127550205
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with dplyr

2015-11-05 Thread Jeff Newmiller
Yes,  that was my intention, but it appears I may not have read his code 
carefully enough. 
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On November 5, 2015 5:23:38 PM PST, David Winsemius  
wrote:
>
>> On Nov 5, 2015, at 4:58 PM, Jeff Newmiller 
>wrote:
>> 
>> Solution is to always use the stringsAsFactors=TRUE option in your
>data.frame() function calls. 
>
>Since that is the default, I’m wondering if you meant to say FALSE?
>
>— 
>David.
>>
>---
>> Jeff NewmillerThe .   .  Go
>Live...
>> DCN:Basics: ##.#.   ##.#.  Live
>Go...
>>  Live:   OO#.. Dead: OO#.. 
>Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#. 
>rocks...1k
>>
>---
>
>> Sent from my phone. Please excuse my brevity.
>> 
>> On November 5, 2015 3:59:10 PM PST, Axel Urbiz 
>wrote:
>>> Hello, 
>>> 
>>> Is there a way to avoid the warning below in dplyr. I’m performing
>an
>>> operation within groups, and the warning says that the factors
>created
>>> from each group do not have the same levels, and so it coerces the
>>> factor to character. I’m using this inside a package I’m developing.
>>> I’d appreciate your recommendation on how to handle this.
>>> 
>>> library(dplyr)
>>> 
>>> set.seed(4)
>>> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels =
>>> c("model1", "model2")))
>>> 
>>> create_bins <- function (pred, nBins) {
>>> Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
>>> bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks,
>>> include.lowest = TRUE))
>>> bin
>>> }
>>> 
>>> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
>>> Warning message:
>>> In rbind_all(out[[1]]) : Unequal factor levels: coercing to
>character
>>> 
>>> Thank you,
>>> Axel.
>>> 
>>> 
>>> [[alternative HTML version deleted]]
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>David Winsemius
>Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Help with dplyr

2015-11-05 Thread Jeff Newmiller
Solution is to always use the stringsAsFactors=TRUE option in your data.frame() 
function calls. 
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On November 5, 2015 3:59:10 PM PST, Axel Urbiz  wrote:
>Hello, 
> 
>Is there a way to avoid the warning below in dplyr. I’m performing an
>operation within groups, and the warning says that the factors created
>from each group do not have the same levels, and so it coerces the
>factor to character. I’m using this inside a package I’m developing.
>I’d appreciate your recommendation on how to handle this.
> 
>library(dplyr)
> 
>set.seed(4)
>df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels =
>c("model1", "model2")))
> 
>create_bins <- function (pred, nBins) {
>  Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
>bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks,
>include.lowest = TRUE))
>  bin
>}
> 
>res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
>Warning message:
>  In rbind_all(out[[1]]) : Unequal factor levels: coercing to character
> 
>Thank you,
>Axel.
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Attempting to plot two different time series together

2015-11-05 Thread Jeff Newmiller
Seems like you would benefit from reading about long and wide data... perhaps  
[1]. 

If I am understanding what you want,  ggplot facetting should be able to do 
what you want.  You first have to put the data in long form (e.g. variable, 
timestamp, value) before you give it to ggplot.

If you want more specific help then you should provide a small sample data set 
as one or more  R dputs as the Posting Guide recommends (see footer, and  [2]).

[1] https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html

[2] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On November 5, 2015 7:00:18 AM PST, Ezra Boyd  wrote:
>Hello,
>
>I am trying to create a plot (I guess two plots) using two different
>time
>series datasets, but I'm not sure of the best approach.  The data is
>from a
>tidal surge due to a hurricane and I would like to show the
>relationship
>between stage and windspeed/direction.
>
>One dataset is the tidal stage and it is sampled in 30 minutes
>intervals.
>The other dataset is windspeed and direction and it is sampled every 6
>minutes.  I would like to display the tidal hydrograph and then also
>show
>windspeed and direction as a banner above it.  They would be two
>separate
>plots, but with identical x-axis (as opposed to one plot that has both
>tide
>& wind.)
>
>Should I combine the two time series into one dataframe (with lots of
>NAs)
>so that I can create the plots together, for example using pairs or
>ggpairs? Or should I keep them separate, make the individual plots, and
>then work on the layout in graphic design software? I would prefer the
>former, but I just can't figure out how to make that work out.
>
>Also, is it possible to depict wind direction (which is given in degree
>clockwise from due north) with an arrow?
>
>Thank you very much,
>
>Ezra

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with dplyr

2015-11-05 Thread William Dunlap
Did you mean to add stringsAsFactors=FALSE to the following call to
data.frame?
   bin <- data.frame(
  pred = pred,
  bin = cut(pred, breaks = Breaks, include.lowest = TRUE))
Since cut() produces a factor you would also have to convert it to character
to make stringAsFactors=FALSE to have an effect.
   bin <- data.frame(stringsAsFactors=FALSE,
  pred = pred,
  bin = as.character(cut(pred, breaks = Breaks, include.lowest = TRUE)))

However, I suspect that things would work out better if all the calls to
cut used the same breaks and then leaving it as a factor would be fine.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Nov 5, 2015 at 5:45 PM, Jeff Newmiller 
wrote:

> Yes,  that was my intention, but it appears I may not have read his code
> carefully enough.
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On November 5, 2015 5:23:38 PM PST, David Winsemius <
> dwinsem...@comcast.net> wrote:
> >
> >> On Nov 5, 2015, at 4:58 PM, Jeff Newmiller 
> >wrote:
> >>
> >> Solution is to always use the stringsAsFactors=TRUE option in your
> >data.frame() function calls.
> >
> >Since that is the default, I’m wondering if you meant to say FALSE?
> >
> >—
> >David.
> >>
>
> >---
> >> Jeff NewmillerThe .   .  Go
> >Live...
> >> DCN:Basics: ##.#.   ##.#.  Live
> >Go...
> >>  Live:   OO#.. Dead: OO#..
> >Playing
> >> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> >> /Software/Embedded Controllers)   .OO#.   .OO#.
> >rocks...1k
> >>
>
> >---
> >
> >> Sent from my phone. Please excuse my brevity.
> >>
> >> On November 5, 2015 3:59:10 PM PST, Axel Urbiz 
> >wrote:
> >>> Hello,
> >>>
> >>> Is there a way to avoid the warning below in dplyr. I’m performing
> >an
> >>> operation within groups, and the warning says that the factors
> >created
> >>> from each group do not have the same levels, and so it coerces the
> >>> factor to character. I’m using this inside a package I’m developing.
> >>> I’d appreciate your recommendation on how to handle this.
> >>>
> >>> library(dplyr)
> >>>
> >>> set.seed(4)
> >>> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels =
> >>> c("model1", "model2")))
> >>>
> >>> create_bins <- function (pred, nBins) {
> >>> Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
> >>> bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks,
> >>> include.lowest = TRUE))
> >>> bin
> >>> }
> >>>
> >>> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
> >>> Warning message:
> >>> In rbind_all(out[[1]]) : Unequal factor levels: coercing to
> >character
> >>>
> >>> Thank you,
> >>> Axel.
> >>>
> >>>
> >>> [[alternative HTML version deleted]]
> >>>
> >>> __
> >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide
> >>> http://www.R-project.org/posting-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> >David Winsemius
> >Alameda, CA, USA
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] problem in R

2015-11-05 Thread Rolf Turner


On 06/11/15 14:31, Jim Lemon wrote:




The fundamental problem that has emerged in this discussion is that
you seem to be applying the method of post-modernist deconstruction
to programming in R. I see no future in this enterprise.




*Gotta* be a fortune!!!

cheers,

Rolf

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help with dplyr

2015-11-05 Thread David Winsemius

> On Nov 5, 2015, at 3:59 PM, Axel Urbiz  wrote:
> 
> Hello, 
> 
> Is there a way to avoid the warning below in dplyr.

There is an option that lets you turn off warnings. There also a wrapper 
function called, not surprisingly, … `suppressWarnings`. This is all descibed 
on:

?warning

— 
David.


> I’m performing an operation within groups, and the warning says that the 
> factors created from each group do not have the same levels, and so it 
> coerces the factor to character. I’m using this inside a package I’m 
> developing. I’d appreciate your recommendation on how to handle this.
> 
> library(dplyr)
> 
> set.seed(4)
> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels = 
> c("model1", "model2")))
> 
> create_bins <- function (pred, nBins) {
>  Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
>  bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks, 
> include.lowest = TRUE))
>  bin
> }
> 
> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
> Warning message:
>  In rbind_all(out[[1]]) : Unequal factor levels: coercing to character
> 
> Thank you,
> Axel.
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] creating a jpeg from xyplot with openbugs

2015-11-05 Thread Bert Gunter
Oh, and incidentally, you appear to be mixing base graphics -- the
jpeg() call -- with lattice graphics, xyplot(). See ?trellis.device
for lattice details.

-- Bert


Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Thu, Nov 5, 2015 at 2:30 PM, Chris  wrote:
>  I'm using xyplot to plot MCMC results generated via R2openbugs and coda and 
> trying to create jpeg outputs. the jpegs are blank
> I can plot the MCMC object with xyplot at the command line
> however, when I use a function to send the  plot to a jpeg (or to a bmp, or 
> png or pdf) the file is created and the plot is blank
>>example commands
> cond.out10c <- bugs(data.cond, inits, params, model.file,codaPkg=TRUE, 
> n.iter=5)cond.out.coda10c <- read.bugs(cond.out10c)
>the following command displays the xyplotxyplot(cond.out.coda10c)
>The following command creates a jpeg inside a function, but the jpeg is 
>blankxysendit <- 
>function(mcmcobj){jpeg(file="C:\\testplot.jpg")xyplot(mcmcobj)dev.off()}xysendit(cond.out.coda10c)
>
> Chris Barker, Ph.D.
> Adjunct Associate Professor of Biostatistics - UIC-SPH
> 415 609 7473
> skype: barkerstats
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cannot install RWinEdt

2015-11-05 Thread Nordlund, Dan (DSHS/RDA)
You might want to upgrade to R-3.2.2 as there appears to be a RWinEdt binary 
available for it.

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Cynthia Yeung - 
NOAA Federal
Sent: Thursday, November 05, 2015 3:18 PM
To: r-help@r-project.org
Subject: [R] cannot install RWinEdt

I am an intermediate R user with little understanding of the working of R 
packages.
My problem is with the package RWinEdt.

I was using using WinEdt 6 with R 3.1.3 and R-Sweave-6 in Windows 7 rather 
smoothly.
Then I got a brand new computer,still running windows 7.
I installed R 3.1.3, no new packages except the base packages.
I installed WinEdt 6.
I cannot get RWinEdt to install.
I tried:
RWinEdt_2.0-4.tar.gz
RWinEdt2.0-0.zip
RWinEdt_1.6-2.zip
nothing worked.

Error messages from trying different strategies include:

*** 1 
> install.packages("RWinEdt", type="source")
trying URL 'http://cran.fhcrc.org/src/contrib/RWinEdt_2.0-5.tar.gz'
Content type 'application/x-gzip' length 590307 bytes (576 KB) opened URL 
downloaded 576 KB

* installing *source* package 'RWinEdt' ...
** package 'RWinEdt' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f 
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f 
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'

The downloaded source packages are in
‘C:\Users\cy\AppData\Local\Temp\RtmpgdAJ2x\downloaded_packages’
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l 
"C:\Program Files\R\R-3.1.3\library"
C:\Users\CYNTHI~1.YEU\AppData\Local\Temp\RtmpgdAJ2x/downloaded_packages/RWinEdt_2.0-5.tar.gz'
had status 1
2: In install.packages("RWinEdt", type = "source") :
  installation of package ‘RWinEdt’ had non-zero exit status
> library(RWinEdt)
Error in library(RWinEdt) : there is no package called ‘RWinEdt’
> utils:::menuInstallPkgs()
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
type) :
  no packages were specified

**

*** 2 
> install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz", repos 
> =
NULL, type="source")
* installing *source* package 'RWinEdt' ...
** libs

*** arch - i386
Warning: running command 'make -f "Makevars.win" -f 
"C:/PROGRA~1/R/R-31~1.3/etc/i386/Makeconf" -f 
"C:/PROGRA~1/R/R-31~1.3/share/make/winshlib.mk" SHLIB="RWinEdt.dll"
OBJECTS="ismdi.o"' had status 127
ERROR: compilation failed for package 'RWinEdt'
* removing 'C:/Program Files/R/R-3.1.3/library/RWinEdt'
Warning messages:
1: running command '"C:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l 
"C:\Program Files\R\R-3.1.3\library"
"D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz"' had status 1
2: In install.packages("D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz",  :
  installation of package ‘D:/Documents/Downloads/RWinEdt_1.8-3.tar.gz’ had 
non-zero exit status
> utils:::menuInstallLocal()
package ‘RWinEdt’ successfully unpacked and MD5 sums checked
> library(RWinEdt)
Error: package ‘RWinEdt’ was built before R 3.0.0: please re-install it
> install.packages('RWinEdt')

   package ‘RWinEdt’ is available as a source package but not as a binary

Warning message:
package ‘RWinEdt’ is not available (as a binary package for R version
3.1.3)

**

*** 3 
> install.packages('RWinEdt')
Warning: unable to access index for repository
http://www.rforge.net/bin/windows/contrib/3.1

   package ‘RWinEdt’ is available as a source package but not as a binary

**

Appreciate any help.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Help with dplyr

2015-11-05 Thread David Winsemius

> On Nov 5, 2015, at 4:58 PM, Jeff Newmiller  wrote:
> 
> Solution is to always use the stringsAsFactors=TRUE option in your 
> data.frame() function calls. 

Since that is the default, I’m wondering if you meant to say FALSE?

— 
David.
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>  Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> --- 
> Sent from my phone. Please excuse my brevity.
> 
> On November 5, 2015 3:59:10 PM PST, Axel Urbiz  wrote:
>> Hello, 
>> 
>> Is there a way to avoid the warning below in dplyr. I’m performing an
>> operation within groups, and the warning says that the factors created
>> from each group do not have the same levels, and so it coerces the
>> factor to character. I’m using this inside a package I’m developing.
>> I’d appreciate your recommendation on how to handle this.
>> 
>> library(dplyr)
>> 
>> set.seed(4)
>> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels =
>> c("model1", "model2")))
>> 
>> create_bins <- function (pred, nBins) {
>> Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
>> bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks,
>> include.lowest = TRUE))
>> bin
>> }
>> 
>> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
>> Warning message:
>> In rbind_all(out[[1]]) : Unequal factor levels: coercing to character
>> 
>> Thank you,
>> Axel.
>> 
>> 
>>  [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Help with dplyr

2015-11-05 Thread Axel Urbiz
Thank you all!


> On Nov 5, 2015, at 9:07 PM, William Dunlap  wrote:
> 
> Did you mean to add stringsAsFactors=FALSE to the following call to
> data.frame?
>   bin <- data.frame(
>  pred = pred,
>  bin = cut(pred, breaks = Breaks, include.lowest = TRUE))
> Since cut() produces a factor you would also have to convert it to character
> to make stringAsFactors=FALSE to have an effect.
>   bin <- data.frame(stringsAsFactors=FALSE,
>  pred = pred,
>  bin = as.character(cut(pred, breaks = Breaks, include.lowest = TRUE)))
> 
> However, I suspect that things would work out better if all the calls to
> cut used the same breaks and then leaving it as a factor would be fine.
> 
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
> 
> On Thu, Nov 5, 2015 at 5:45 PM, Jeff Newmiller 
> wrote:
> 
>> Yes,  that was my intention, but it appears I may not have read his code
>> carefully enough.
>> ---
>> Jeff NewmillerThe .   .  Go Live...
>> DCN:Basics: ##.#.   ##.#.  Live
>> Go...
>>  Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
>> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
>> ---
>> Sent from my phone. Please excuse my brevity.
>> 
>> On November 5, 2015 5:23:38 PM PST, David Winsemius <
>> dwinsem...@comcast.net> wrote:
>>> 
 On Nov 5, 2015, at 4:58 PM, Jeff Newmiller 
>>> wrote:
 
 Solution is to always use the stringsAsFactors=TRUE option in your
>>> data.frame() function calls.
>>> 
>>> Since that is the default, I’m wondering if you meant to say FALSE?
>>> 
>>> —
>>> David.
 
>> 
>>> ---
 Jeff NewmillerThe .   .  Go
>>> Live...
 DCN:Basics: ##.#.   ##.#.  Live
>>> Go...
 Live:   OO#.. Dead: OO#..
>>> Playing
 Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
 /Software/Embedded Controllers)   .OO#.   .OO#.
>>> rocks...1k
 
>> 
>>> ---
>>> 
 Sent from my phone. Please excuse my brevity.
 
 On November 5, 2015 3:59:10 PM PST, Axel Urbiz 
>>> wrote:
> Hello,
> 
> Is there a way to avoid the warning below in dplyr. I’m performing
>>> an
> operation within groups, and the warning says that the factors
>>> created
> from each group do not have the same levels, and so it coerces the
> factor to character. I’m using this inside a package I’m developing.
> I’d appreciate your recommendation on how to handle this.
> 
> library(dplyr)
> 
> set.seed(4)
> df <- data.frame(pred = rnorm(100), models = gl(2, 50, 100, labels =
> c("model1", "model2")))
> 
> create_bins <- function (pred, nBins) {
> Breaks <- unique(quantile(pred, probs = seq(0, 1, 1/nBins)))
> bin <- data.frame(pred = pred, bin = cut(pred, breaks = Breaks,
> include.lowest = TRUE))
> bin
> }
> 
> res_dplyr <- df %>% group_by(models) %>% do(create_bins(.$pred, 10))
> Warning message:
> In rbind_all(out[[1]]) : Unequal factor levels: coercing to
>>> character
> 
> Thank you,
> Axel.
> 
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
>>> 
>>> David Winsemius
>>> Alameda, CA, USA
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 

Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-05 Thread Rainer Hurling

Am 04.11.2015 um 21:36 schrieb Evan Cooch:



On 11/4/2015 2:08 PM, Evan Cooch wrote:

Greetings --

This has also been posted on the jags forum, but since I suspect the
problem is more 'R-related' than jags, will aos post here.

Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux
boxes (which run latest RHEL). Here are the basic details:

1\ used R 3.2.2 compiled from source. 64-bit -- nothing fancy, other
than the fact that I used OpenBLAS instead of 'generic'. Works fine.

2\ downloaded and compiled JAGS 4.0.1 from source (nothing fancy,
./configure & make & make install) -- no errors. Runs fine as a
standalone app from CLI.


3\ Downloaded rjags_4-3.tar.gz, and installed from R CLI (within R --
usual R CMD INSTALL approach). Again, no errors reported.


However, when I fire up R, and try something simple like

library(R2jags)

I get a whole slew of error messages - following is reproducible on
all my machines:

Loading required package: rjags
Loading required package: coda
Error : .onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/usr/lib64/R/library/rjags/libs/rjags.so':
libjags.so.3: cannot open shared object file: No such file or directory
Error: package ‘rjags’ could not be loaded




Further puzzlement -- I uninstalled R2jags and rjags, with the idea that
re-installing them (ostensibly with the 'latest and greatest') would do
the trick. While the process went fine for R2jags, when I tried to
re-install rjags, got the following error messages:

checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking for jags_version in -ljags... yes
checking version of JAGS library... wrong version
configure: error: rjags requires JAGS version 4.x.y
ERROR: configuration failed for package ‘rjags’
* removing ‘/usr/lib64/R/library/rjags’
* restoring previous ‘/usr/lib64/R/library/rjags’


Hmm, is it possible, that your JAGS 4.x.y installation is fine, but an 
old libjags.so library is lying around from a not fully completed 
deinstallation? Could you have a look for older libjags.so versions, please?


Just a thought.




I'm confused as to how it is not finding JAGS 4.x.y, which is not only
most definitely on the system, but in the path:

[root@euler egc]# jags
Welcome to JAGS 4.0.1 on Wed Nov  4 15:35:12 2015
JAGS is free software and comes with ABSOLUTELY NO WARRANTY
Loading module: basemod: ok
Loading module: bugs: ok


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R-es] Duda respecto a la dimensión de la división de dos columnas de una tabla

2015-11-05 Thread Jesús Para Fernández
Prueba a hacer esto:

Serie16<-wb[3]/wb[12]

> Date: Thu, 5 Nov 2015 14:43:22 +0100
> From: albert.monto...@gmail.com
> To: R-help-es@r-project.org
> Subject: [R-es] Duda respecto a la dimensi�n de la divisi�n de dos columnas 
> de una tabla
> 
> Muchas gracias a tod@s por las respuetas!
> 
> tengo en una variable wb una tabla con 145 filas y 17 columnas.
> dim(wb) 145 17
> 
> Creo una variable Serie16, la cual resulta de dividir la columna 3 y la 12.
> Serie16 <- c(wb[3]/wb[12])
> Serie16
> 
> Aqu� viene el problema. La dimensi�n de la nueva columna, pensaba que seria
> 145 filas y 1 columna.
> Le doy a dim, y me devuelve el valor NULL. Por qu�? he dividido columna por
> columna.
> dim(Serie16) NULL
> length(Serie16) 1
> 
> la longitud me sale de 1. Se refiere a 1 columna? como miro el n�mero de
> filas entonces?
> 
> el problema viene ahora. Quiero agregar con la funci�n cbind, mi nueva
> columna calculad, a la tabla que ya tenia con 17 columnas y 145 filas.
> 
> wb <- cbind(Serie16)
> 
> Pero no funciona. Donde esta el error? como consigo que cuando hago
> 
> Serie16 <- c(wb[3]/wb[12])
> 
> me retorne una variable que sea una tabla, con el mismo numero de filas,
> para poder utilizar despues
> la funcion cbind?
> 
> Muchas gracias!
> Albert
> 
> -- 
> 
> 
> *Albert Montolio Aguado*
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
  
[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] How to change name of pdf output of function windRose in openair package

2015-11-05 Thread PIKAL Petr
Hi

if you need to do naming automagically you can use ls for creating object 
consisting from names of objects and use it for naming inside a cycle.

obj <- ls()
for (i in 1:n) {
pdf(paste(obj[i], "pdf", sep="."))
...
do the plotting
dev.off()
}

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim
> Lemon
> Sent: Thursday, November 05, 2015 12:25 PM
> To: Stefano Sofia
> Cc: r-help@r-project.org
> Subject: Re: [R] How to change name of pdf output of function windRose
> in openair package
>
> Hi Stefano,
> Just start the PDF device, do the plot, then close the PDF device:
>
> library(openair)
> ...
> data(mydata)
> pdf("windRose.pdf")
> windRose(mydata)
> dev.off()
>
> This is from the first example for the windRose function. It will
> produce a file named "windRose.pdf" in the working directory of R.
>
> Jim
>
>
>
> On Thu, Nov 5, 2015 at 8:26 PM, Stefano Sofia <
> stefano.so...@regione.marche.it> wrote:
>
> > Dear r-list users,
> > I am using windRose within the openair package.
> > Automatically the wind rose is saved in a pdf file called Rplots.pdf
> .
> >
> > I need to apply this function to different data frames, and each time
> > I need to change automatically the name of the pdf output.
> > I am not able to do it, I read the manual quite carefully but I
> didn't
> > find any hint about it.
> >
> > Would somebody be able to help me?
> > Thank you for your attention
> > Stefano
> >
> >
> > 
> >
> > AVVISO IMPORTANTE: Questo messaggio di posta elettronica può
> contenere
> > informazioni confidenziali, pertanto è destinato solo a persone
> > autorizzate alla ricezione. I messaggi di posta elettronica per i
> > client di Regione Marche possono contenere informazioni confidenziali
> e con privilegi legali.
> > Se non si è il destinatario specificato, non leggere, copiare,
> > inoltrare o archiviare questo messaggio. Se si è ricevuto questo
> > messaggio per errore, inoltrarlo al mittente ed eliminarlo
> > completamente dal sistema del proprio computer. Ai sensi dell’art. 6
> > della DGR n. 1394/2008 si segnala che, in caso di necessità ed
> > urgenza, la risposta al presente messaggio di posta elettronica può
> essere visionata da persone estranee al destinatario.
> > IMPORTANT NOTICE: This e-mail message is intended to be received only
> > by persons entitled to receive the confidential information it may
> contain.
> > E-mail messages to clients of Regione Marche may contain information
> > that is confidential and legally privileged. Please do not read,
> copy,
> > forward, or store this message unless you are an intended recipient
> of
> > it. If you have received this message in error, please forward it to
> > the sender and delete it completely from your computer system.
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it 

[R-es] Duda respecto a la dimensión de la división de dos columnas de una tabla

2015-11-05 Thread Albert Montolio
Muchas gracias a tod@s por las respuetas!

tengo en una variable wb una tabla con 145 filas y 17 columnas.
dim(wb) 145 17

Creo una variable Serie16, la cual resulta de dividir la columna 3 y la 12.
Serie16 <- c(wb[3]/wb[12])
Serie16

Aquí viene el problema. La dimensión de la nueva columna, pensaba que seria
145 filas y 1 columna.
Le doy a dim, y me devuelve el valor NULL. Por qué? he dividido columna por
columna.
dim(Serie16) NULL
length(Serie16) 1

la longitud me sale de 1. Se refiere a 1 columna? como miro el número de
filas entonces?

el problema viene ahora. Quiero agregar con la función cbind, mi nueva
columna calculad, a la tabla que ya tenia con 17 columnas y 145 filas.

wb <- cbind(Serie16)

Pero no funciona. Donde esta el error? como consigo que cuando hago

Serie16 <- c(wb[3]/wb[12])

me retorne una variable que sea una tabla, con el mismo numero de filas,
para poder utilizar despues
la funcion cbind?

Muchas gracias!
Albert

-- 


*Albert Montolio Aguado*

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


RE: [R-es] Duda respecto a la dimensi�n de la divisi�n de dos columnas de una tabla

2015-11-05 Thread Isidro Hidalgo
Tienes que cambiar esta fila:
Serie16 <- c(wb[3]/wb[12])

Por esta otra:
Serie16 <- c(wb[,3]/wb[,12])

Saludos

Isidro Hidalgo Arellano
Observatorio del Mercado de Trabajo
Consejería de Economía, Empresas y Empleo
http://www.jccm.es



> -Mensaje original-
> De: R-help-es [mailto:r-help-es-boun...@r-project.org] En nombre de
> Albert Montolio
> Enviado el: jueves, 05 de noviembre de 2015 14:43
> Para: R-help-es@r-project.org
> Asunto: [R-es] Duda respecto a la dimensión de la división de dos columnas
> de una tabla
>
> Muchas gracias a tod@s por las respuetas!
>
> tengo en una variable wb una tabla con 145 filas y 17 columnas.
> dim(wb) 145 17
>
> Creo una variable Serie16, la cual resulta de dividir la columna 3 y la
12.
> Serie16 <- c(wb[3]/wb[12])
> Serie16
>
> Aquí viene el problema. La dimensión de la nueva columna, pensaba que
> seria
> 145 filas y 1 columna.
> Le doy a dim, y me devuelve el valor NULL. Por qué? he dividido columna
por
> columna.
> dim(Serie16) NULL
> length(Serie16) 1
>
> la longitud me sale de 1. Se refiere a 1 columna? como miro el número de
> filas entonces?
>
> el problema viene ahora. Quiero agregar con la función cbind, mi nueva
> columna calculad, a la tabla que ya tenia con 17 columnas y 145 filas.
>
> wb <- cbind(Serie16)
>
> Pero no funciona. Donde esta el error? como consigo que cuando hago
>
> Serie16 <- c(wb[3]/wb[12])
>
> me retorne una variable que sea una tabla, con el mismo numero de filas,
> para poder utilizar despues la funcion cbind?
>
> Muchas gracias!
> Albert
>
> --
>
>
> *Albert Montolio Aguado*
>
>   [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es