Re: [R] Stacking two graphs with different x and y scale on the same graph

2019-11-26 Thread Ogbos Okike
Dear Rui, Many thanks. It is indeed close to what I am looking for apart from the issues on the axes. I am attaching the result plot. The minimum and maximum values of y1 are respectively -5.470919 and 1.298329 while they are 0.0002937659 and 4.808186 for y2. New problems are: (1) I can't

Re: [R] Stacking two graphs with different x and y scale on the same graph

2019-11-26 Thread Rui Barradas
Hello, The following is not a complete solution, the axis ranges are wrong, but it gets you closer, I think. op <- par(mar = c(5, 5, 5, 5)) plot(c(x1, x2), c(y1, y2), type = "n",xaxt="n", yaxt="n", ylim = range(c(y1, y2))) par(new=TRUE) plot(x1,y1,pch=0,type="b",col="red",yaxt="n",

Re: [R] Conditions

2019-11-26 Thread William Michels via R-help
Hi Val, Here's an answer using a series of ifelse() statements. Because the d4 column is created initially using NA as a placeholder, you can check your conditional logic at the end using table(!is.na(dat2$d4)): > dat2 <-read.table(text="ID d1 d2 d3 + A 0 25 35 + B 12 22 0 + C 0 0 31 + E 10

Re: [R] Conditions

2019-11-26 Thread Jim Lemon
Hi val, You had a "conditional leak" in your ifelse statements: dat2 <-read.table(text="ID d1 d2 d3 A 0 25 35 B 12 22 0 C 0 0 31 E 10 20 30 F 0 0 0", header=TRUE,stringsAsFactors=FALSE) dat2$d4<- ifelse(dat2$d1,dat2$d1,ifelse(dat2$d2,dat2$d2,ifelse(dat2$d3,dat2$d3,0))) Even though it works, it

Re: [R] Conditions

2019-11-26 Thread Bert Gunter
I generally find nested ifelse's to be confusing and prone to error, so I usually prefer to proceed sequentially using subsetting with logicals or replicated, but not nested ifelse's. In your example, the translation to logical indexing seems pretty straightforward. Using your example: > dat2

[R] Stacking two graphs with different x and y scale on the same graph

2019-11-26 Thread Ogbos Okike
Dear Contributors, I have two data. A is of the form: 05 01 01 -0.00376058013285748 05 01 02 -0.0765481943910918 05 01 03 -1.28158758599964 05 01 04 -1.51612545416506 05 01 05 -1.39481276373467 05 01 06 -1.17644992095997 05 01 07 -0.788249311582716 05 01 08 -0.925737027403825 05 01 09

[R] Conditions

2019-11-26 Thread Val
HI All, I am having a little issue in my ifelse statement, The data frame looks like as follow. dat2 <-read.table(text="ID d1 d2 d3 A 0 25 35 B 12 22 0 C 0 0 31 E 10 20 30 F 0 0 0",header=TRUE,stringsAsFactors=F) I want to create d4 and set the value based on the following conditions. If

Re: [R] giving priority to stats package

2019-11-26 Thread Greg Snow
I was thinking of using length(search())+1 to be safe and simple. Using grep gives higher priority than length while still solving your issue. On Mon, Nov 25, 2019 at 3:06 PM Gabor Grothendieck wrote: > > Goold idea. This seems to work. > > library(dplyr, pos = grep("package:stats", search())

Re: [R-es] Como enfocar un problema

2019-11-26 Thread Edgardo Rodriguez
Estimado Jesús Para Fernández Siguiendo el razonamiento de Javier, creo que la variable respuesta es cantidad de ciclos hasta que se produce la rotura. Que es equivalente a pensar en tiempo (horas, días, mes o años) hasta que se produce el evento y por lo tanto un análisis de supervivencia podría

Re: [R-es] Como enfocar un problema

2019-11-26 Thread Javier Marcuzzi
Estimado Jesús Para Fernández Usted nombra supervivencia y que todas las piezas se rompen, en este caso se podría responder a qué tiempo y con que factores. Yo pienso que su idea no es mala. Javier Rubén Marcuzzi El mar., 26 nov. 2019 a las 16:29, Jesús Para Fernández (<

[R-es] Como enfocar un problema

2019-11-26 Thread Jesús Para Fernández
Buenas Tengo que analizar unos datos, donde tengo unas piezas fabricadas y el n�mero de ciclos qie aguantan hasta q se parten. Algunas piezas son de un fabricante, otras de otro,.. En cada ciclo a algunas piezas se le somete a algun tipo de tratamiento termico, a otras a otro, algunas se

Re: [R-es] Restar datetime, resultado erróneo

2019-11-26 Thread Javier Marcuzzi
Estimados Depende, el paso de un día a otro da problemas, el ejemplo más simple es comparar los valores de la bolsa de valores, suponiendo una acción de Tokio contra la misma en Alemania, por decir algo, la cotización a las 12:25 del 22 de marzo. Desde mi punto de vista, siempre es conveniente

Re: [R-es] Modelo Poisson con endogeneidad

2019-11-26 Thread Javier Marcuzzi
Estimada Miriam Comparto lo escrito por Carlos Gil Bellosta, pero hay una salvedad, dependiendo de la base de datos que utiliza, pueden aparecer NA que en R son interpretados como caracteres o el espacio colocando esto en lugar de los nulos, como también de los ceros que suelen aparecer por ahí,

Re: [R-es] Modelo Poisson con endogeneidad

2019-11-26 Thread Carlos J. Gil Bellosta
¿Tienes nulos en los datos originales? La función lm, por defecto, usa na.action = na.omit... Lo que quieras hacer con los nulos, de tenerlos, es otra historia... Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com El mar., 26 nov. 2019 a las 17:23, escribió: > Buenas tardes, > >

[R-es] Modelo Poisson con endogeneidad

2019-11-26 Thread miriam . alzate
Buenas tardes, Tengo una pregunta sobre un error que me da R. Estoy usando un modelo Poisson con función de control para corregir la endogeneidad (de instrumentos) y tengo que calcular primero los residuos de una regresión lineal para posteriormente introducirlos en la segunda etapa. Cuando los

[R] Hyperparameter tuning

2019-11-26 Thread Neha gupta
I am using xgboost hyperparameter tuning for the value of rmse. I used the following method which returns two values ; mean which is like - 1200.12 and Best value like - 960. I guess the first value is average value and the second is the best rmse value returned by the algorithm. Now if we have

Re: [R] Error while installing xml2 package in R

2019-11-26 Thread Jeff Newmiller
This may or may not fix your problem but I avoid installing R packages in system libraries... using user libraries without running R as root or with sudo makes life much simpler unless you are a professional sysadmin. On November 26, 2019 7:06:48 AM PST, Manish Gupta wrote: >I am getting

[R] Error while installing xml2 package in R

2019-11-26 Thread Manish Gupta
I am getting following error while installing xml2 package in R. install.packages("xml2") Error : unable to load shared object '/usr/local/lib/R/site-library/00LOCK-xml2/00new/xml2/libs/xml2.so': libiconv.so.2: cannot open shared object file: No such file or directory it seems it require