[R] One column listing on wide monitors too
Hi, it is probably very basic question, but I can't get answer still. R shows listings in more columns on wider monitors. Like on this picture: http://i.imgur.com/GLF70r9.png Is there a way to set R to show listings like this, in one column only? [1] String 1 [2] String 2 [3] String 3 ... [16] String 16 Thank you -- View this message in context: http://r.789695.n4.nabble.com/One-column-listing-on-wide-monitors-too-tp4703781.html Sent from the R help mailing list archive at Nabble.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.
[R] R crashes with Error in UseMethod(depth) when resizing ggplot windows
Hello everyone, Quite frequently I encounter crashes when resizing ggplot windows. The error message is always as follows: Error in UseMethod(depth) : no applicable method for 'depth' applied to an object of class NULL Process R exited abnormally with code 255 at Tue Feb 24 21:51:18 2015 The error seems to occur rather unpredictably when I do several resizings, e.g. moving a plot window from one monitor to another using Windows+Arrow Key several times. It only seems to happen when plotting rather large data frames. I was about to file this as a ggplot2 issue, but then I realized that I can't reproduce it using RStudio - normally, I use emacs/ESS (on Windows 7). So maybe this is a bug related to the plot engine...? The problem is that I can't even do a traceback(), since R is crashed. How should I proceed? Are there any other options to retrieve valuable debug information? Kind regards, Eike __ 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] Environment error in the car package Anova.lme function
On Feb 24, 2015, at 10:24 AM, William Randall Henner wrote: When I call the Anova function on a lme object from inside a function environment I get an error: Error in eval(expr, envir, enclos) : object 'y' not found However, if I call the exact same code in the global environment there is no error. My theory is that for some reason the Anova.lme function always searches the global environment for variables rather than starting in its parent environment. Regression functions are generally set up to first look for the tokens/symbols that are in the formulae first in that data argument column-names and then in the calling environment. It's not finding an x or a y in either of those locations (R being case sensitive). You _should_ try to pass a dataframe with column-names that match the tokens in the formula argument exactly to a `data=` parameter. Since the function runs correctly on lmerMod objects, and I typically prefer lme4 to nlme this is just of academic interest. # # Steps to reproduce the error # Load Packages library(car) library(lme4) library(nlme) # Create random data. Y - rnorm(50) X - rnorm(50) Subject - factor(rep(LETTERS[1:5],each=10)) # Define function to fit a MEM and run the ANOVA. fun - function(y,x,sub){ #mod - lmer(y ~ x +(1 | sub) ) mod - lme(y~x,random=~1|sub) print('lme model ran successfully.') Anova(mod) print('Anova function ran successfully.') } # Function produces an error message. fun(Y,X,Subject) # if run outside of a function, it runs cleanly. mod - lme(Y~X,random=~1|Subject) Anova(mod) mod1 - lmer(Y ~ X +(1 | Subject) ) Anova(mod1) [[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.
[R] Environment error in the car package Anova.lme function
When I call the Anova function on a lme object from inside a function environment I get an error: Error in eval(expr, envir, enclos) : object 'y' not found However, if I call the exact same code in the global environment there is no error. My theory is that for some reason the Anova.lme function always searches the global environment for variables rather than starting in its parent environment. Since the function runs correctly on lmerMod objects, and I typically prefer lme4 to nlme this is just of academic interest. # # Steps to reproduce the error # Load Packages library(car) library(lme4) library(nlme) # Create random data. Y - rnorm(50) X - rnorm(50) Subject - factor(rep(LETTERS[1:5],each=10)) # Define function to fit a MEM and run the ANOVA. fun - function(y,x,sub){ #mod - lmer(y ~ x +(1 | sub) ) mod - lme(y~x,random=~1|sub) print('lme model ran successfully.') Anova(mod) print('Anova function ran successfully.') } # Function produces an error message. fun(Y,X,Subject) # if run outside of a function, it runs cleanly. mod - lme(Y~X,random=~1|Subject) Anova(mod) mod1 - lmer(Y ~ X +(1 | Subject) ) Anova(mod1) [[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] Problema con bucle for
Puedes usar la orden is.na() que comprueba si un valor es NA o no y cuando lo sea hacer que pase al siguiente paso del bucle. Algo así: x- c(24,12,45,68,NA,45) n-length(x) res-numeric() for(i in c(1:n)){ print(i) print(x[i]) if (is.na(x[i])) next for(j in c(i+1:n)){ if (is.na(x[j])) next res- sum(x[i]*x[j]) print(res) } } res Espero que te sirva :-) El 24 de febrero de 2015, 10:02, mora...@us.es escribió: Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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] Error with using windRose function from the open air package
Hi Alexandra, As Jeff mentioned, cbind is probably causing the conversion to factors. One thing I would suggest is keeping the names: windSFO-data.frame(ws=ws,wd=wd,stn=stn,yearSite=yearSite) as it looks like the windRose function expects the names to be there. If the error persists after using the above, try: windSFO$ws-as.numeric(as.character(windSFO$ws)) windSFO$ww-as.numeric(as.character(windSFO$ww)) Jim On Tue, Feb 24, 2015 at 4:38 PM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: I have no magic answer for you, just some suggestions until you can clarify your problem. Your description of loading one column in at a time is a bit odd... It is much more typical to use one of the read.table variants. Don't use cbind to make data frames. If you have any non-numeric columns then you will make them all into character or factor columns. That is almost never a good thing. In fact it is probably at the root of your current woes. windSFO - data.frame(ws,wd,stn,yearSite) Learn to use the str function... e.g. str(windSFO) Not that we cannot tell how your data are stored given the way you gave supplied it to us. Read about the use of dput (e.g. [1]) and make your example reproducible (what package exactly are you talking about? package names don't have spaces in them). Note that the Posting Guide directs you to verify that your problem occurs when you use the latest version (3.1.2 at this time). If you want to keep old versions around for some reason, at least install the latest version and verify that your problem happens with it before posting. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. 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 February 23, 2015 11:13:20 AM PST, Alexandra Catena amc5...@gmail.com wrote: Hello All, I have a data frame called windSFO of four columns, wind speed, wind direction, station number, and date (mmdd). I downloaded the gz data from a site online and then unzipped it using readLines. I then concatenated these four columns from the unzipped data into a dataframe using cbind. windSFO = data.frame(cbind(ws,wd,stn,yearSite)) Here are the first four rows as an example: ws wd stn yearSite 1 36 290 724940-23234 20090101 2 77 280 724940-23234 20090101 3 72 290 724940-23234 20090101 4 46 290 724940-23234 20090101 I'm trying to make a wind rose using the windRose function but I keep getting an error that I don't understand. I type in: windRose(windSFO,ws='ws',wd='wd') I then get the error: Error in Summary.factor(c(27L, 35L, 34L, 29L, 28L, 25L, 25L, 24L, 24L, : max not meaningful for factors In addition: Warning messages: 1: In Ops.factor(mydata[[wd]], 10) : %% not meaningful for factors 2: In Ops.factor(mydata[[wd]], angle) : / not meaningful for factors Can anyone tell me what this means/what I'm doing wrong? Also, I have R version 3.1.1 Thank you! Alexandra __ 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. [[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-es] Problema con bucle for
Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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] Problema con bucle for
O solo R sum(combn(x, 2, prod)) [1] 14121 Saludos, Jorge.- 2015-02-24 21:00 GMT+11:00 Carlos Ortega c...@qualityexcellence.es: Hola, Otra forma de hacerlo, es as�: #--- x- c(24,12,45,68,45) sum(apply(combn(x,2),2,prod)) [1] 14121 #--- Y te ahorras los l�os del bucle y de los �ndices... Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 10:36, Francisco Rodr�guez fjr...@hotmail.com escribi�: Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45)n-length(x)res=0for(i in 2:n-1){ for(j in (i+1):n){res- res + (x[i]*x[j])print(res) }} Cuya salida es: [1] 288[1] 1368[1] 3000[1] 4080[1] 4620[1] 5436[1] 5976[1] 9036[1] 11061[1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posici�n 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operaci�n que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no deber�a hacer nada Tienes que definir res para que se sume as� misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el c�digo me aparecen una serie de NA que me impiden calcular la suma. �Alguna sugerencia? El c�digo es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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-es] Problema con bucle for
En mi opini�n en R siempre es preferible soluciones como la de Carlos, al ser una operaci�n vectorial, todo es much�simo m�s r�pido, de este modo si tu vector fuese muy grande, mi soluci�n ser�a lenta pero imagino que la de Carlos ser�a bastante r�pida Un saludo Date: Tue, 24 Feb 2015 11:00:26 +0100 Subject: Re: [R-es] Problema con bucle for From: c...@qualityexcellence.es To: fjr...@hotmail.com CC: mora...@us.es; r-help-es@r-project.org Hola, Otra forma de hacerlo, es as�: #--- x- c(24,12,45,68,45) sum(apply(combn(x,2),2,prod)) [1] 14121 #--- Y te ahorras los l�os del bucle y de los �ndices... Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 10:36, Francisco Rodr�guez fjr...@hotmail.com escribi�: Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45)n-length(x)res=0for(i in 2:n-1){ for(j in (i+1):n){ res- res + (x[i]*x[j])print(res) }} Cuya salida es: [1] 288[1] 1368[1] 3000[1] 4080[1] 4620[1] 5436[1] 5976[1] 9036[1] 11061[1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posici�n 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operaci�n que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no deber�a hacer nada Tienes que definir res para que se sume as� misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el c�digo me aparecen una serie de NA que me impiden calcular la suma. �Alguna sugerencia? El c�digo es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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-es] Problema con bucle for
Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45)n-length(x)res=0for(i in 2:n-1){ for(j in (i+1):n){ res- res + (x[i]*x[j])print(res) }} Cuya salida es: [1] 288[1] 1368[1] 3000[1] 4080[1] 4620[1] 5436[1] 5976[1] 9036[1] 11061[1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posici�n 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operaci�n que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no deber�a hacer nada Tienes que definir res para que se sume as� misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el c�digo me aparecen una serie de NA que me impiden calcular la suma. �Alguna sugerencia? El c�digo es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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-es] Problema con bucle for
Muchas gracias por la solución. El 24/02/2015 10:36, Francisco Rodríguez escribió: Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45) n-length(x) res=0 for(i in 2:n-1){ for(j in (i+1):n){ res- res + (x[i]*x[j]) print(res) } } Cuya salida es: [1] 288 [1] 1368 [1] 3000 [1] 4080 [1] 4620 [1] 5436 [1] 5976 [1] 9036 [1] 11061 [1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posición 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operación que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no debería hacer nada Tienes que definir res para que se sume así misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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-es] Problema con bucle for
Hola, Otra forma de hacerlo, es así: #--- x- c(24,12,45,68,45) sum(apply(combn(x,2),2,prod)) [1] 14121 #--- Y te ahorras los líos del bucle y de los índices... Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 10:36, Francisco Rodríguez fjr...@hotmail.com escribió: Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45)n-length(x)res=0for(i in 2:n-1){ for(j in (i+1):n){res- res + (x[i]*x[j])print(res) }} Cuya salida es: [1] 288[1] 1368[1] 3000[1] 4080[1] 4620[1] 5436[1] 5976[1] 9036[1] 11061[1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posición 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operación que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no debería hacer nada Tienes que definir res para que se sume así misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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-es] Problema con bucle for
Muchas gracias de nuevo por las soluciones aportadas. El 24/02/2015 11:10, Jorge I Velez escribió: O solo R sum(combn(x, 2, prod)) [1] 14121 Saludos, Jorge.- 2015-02-24 21:00 GMT+11:00 Carlos Ortega c...@qualityexcellence.es: Hola, Otra forma de hacerlo, es así: #--- x- c(24,12,45,68,45) sum(apply(combn(x,2),2,prod)) [1] 14121 #--- Y te ahorras los líos del bucle y de los índices... Saludos, Carlos Ortega www.qualityexcellence.es [1] El 24 de febrero de 2015, 10:36, Francisco Rodríguez fjr...@hotmail.com escribió: Si he entendido bien el problema, lo que quieres hacer realmente es esto: x- c(24,12,45,68,45)n-length(x)res=0for(i in 2:n-1){ for(j in (i+1):n){ res- res + (x[i]*x[j]) print(res) }} Cuya salida es: [1] 288[1] 1368[1] 3000[1] 4080[1] 4620[1] 5436[1] 5976[1] 9036[1] 11061[1] 14121 Varias observaciones: 1:n-1 define un vector que empieza en 0, cuando la posición 1 en R es el 1 por tanto x[0] no existe y no da resultado sum(x[i]*x[j]) es una operación que calcula la suma de un vector, en tu caso tienes un escalar y por tanto no debería hacer nada Tienes que definir res para que se sume así misma Un saludo Francisco J. Date: Tue, 24 Feb 2015 10:02:11 +0100 From: mora...@us.es To: r-help-es@r-project.org Subject: [R-es] Problema con bucle for Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es [2] [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es [2] -- Saludos, Carlos Ortega www.qualityexcellence.es [1] [[alternative HTML version deleted]] ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es [2] Links: -- [1] http://www.qualityexcellence.es [2] 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-es] Problema con bucle for
Prueba esto: x- c(24,12,45,68,45) tmp - outer(x, x, *) sum(tmp[lower.tri(tmp)]) Un saludo, Carlos J. Gil Bellosta http://www.datanalytics.com El día 24 de febrero de 2015, 10:02, mora...@us.es escribió: Hola, quiero obtener la suma del producto de los elementos de un vector y cuando construyo el código me aparecen una serie de NA que me impiden calcular la suma. ¿Alguna sugerencia? El código es el siguiente: x- c(24,12,45,68,45) n-length(x) res-numeric() for(i in 1:n-1){ for(j in i+1:n){ res- sum(x[i]*x[j]) print(res) } } res [[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
[R] Packages not installing on XP
I have an installation problem; on installing MethComp either from repository or local zip file on Win XP (!) I get Warning: unable to move temporary installation 'C:\Program Files\R\R-3.1.2\library\filefbc44fe1354\MethComp' to ‘C:\Program Files\R\R-3.1.2\library\MethComp’ The same occurs with other packages. The 'obvious' reason for this is that subsequent inspection shows that there is no temporary installation at the location given. I appreciate that R is not now tested on XP as XP is no longer supported by MS, but since I've yet to switch to Win7+ on this otherwise serviceable small laptop and it'll be a while before I get back to my desktops, I'd appreciate any clues as to what - if anything - I could to do in the mean time to get a working package install. S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] intercalar elementos de vectores
Fernando, Podrias intentar R a - rep('a', 5) R b - rep('b', 5) R a [1] a a a a a R b [1] b b b b b R c(rbind(a, b)) [1] a b a b a b a b a b Saludos, Jorge.- 2015-02-24 23:49 GMT+11:00 Fernando Macedo ferm...@gmail.com: Buenas a todos. Relato el problema: - tengo un archivo de 316 columnas por 562000 filas (aprox.). - esas 316 columnas representan 158 sujetos, o sea dos columnas por cada individuo conteniendo informaci�n que debe ser condensada en una sola. Lo que necesito es ir tomando las dos columnas de cada individuo e intercalar los elementos de los vectores formando uno solo. Ejemplificando ser�a algo as�: a [1] a a a a a b [1] b b b b b c [1] a b a b a b a b a b Estoy haciendo con un loop for pero es realmente muy lento. He buscado por alg�n paquete que ya lo haga directamente pero no he tenido mucho �xito. Me imagino que con sapply o apply pueda ser mucho m�s efectivo pero me ha resultado complicado para entender la sintaxis de estas funciones cuando involucra m�s de un objeto (vector, matriz, etc...). Desde ya agradezco las sugerencias que puedan verter sobre este problema. -- Fernando Macedo [[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] Packages not installing on XP
On 24/02/2015 10:52, S Ellison wrote: I have an installation problem; on installing MethComp either from repository or local zip file on Win XP (!) I get Warning: unable to move temporary installation 'C:\Program Files\R\R-3.1.2\library\filefbc44fe1354\MethComp' to ‘C:\Program Files\R\R-3.1.2\library\MethComp’ The same occurs with other packages. The 'obvious' reason for this is that subsequent inspection shows that there is no temporary installation at the location given. But R CMD INSTALL cleaned it up. I appreciate that R is not now tested on XP as XP is no longer supported by MS, but since I've yet to switch to Win7+ on this otherwise serviceable small laptop and it'll be a while before I get back to my desktops, I'd appreciate any clues as to what - if anything - I could to do in the mean time to get a working package install. 1) Check the permissions on :\Program Files\R\R-3.1.2\library, or perhaps better, use a separate library directory (see the rw-FAQ). 2) Switch off any anti-virus runtime checking. There is a comment in the sources ## Move the new package to the install lib ## To avoid anti-virus interference, wait a little Sys.sleep(0.5) S Ellison -- Brian D. Ripley, rip...@stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford 1 South Parks Road, Oxford OX1 3TG, UK __ 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-es] intercalar elementos de vectores
Buenas a todos. Relato el problema: - tengo un archivo de 316 columnas por 562000 filas (aprox.). - esas 316 columnas representan 158 sujetos, o sea dos columnas por cada individuo conteniendo información que debe ser condensada en una sola. Lo que necesito es ir tomando las dos columnas de cada individuo e intercalar los elementos de los vectores formando uno solo. Ejemplificando sería algo así: a [1] a a a a a b [1] b b b b b c [1] a b a b a b a b a b Estoy haciendo con un loop for pero es realmente muy lento. He buscado por algún paquete que ya lo haga directamente pero no he tenido mucho éxito. Me imagino que con sapply o apply pueda ser mucho más efectivo pero me ha resultado complicado para entender la sintaxis de estas funciones cuando involucra más de un objeto (vector, matriz, etc...). Desde ya agradezco las sugerencias que puedan verter sobre este problema. -- Fernando Macedo [[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] xtable caption knitr
On 02/24/2015 05:16 AM, AURORA GONZALEZ VIDAL wrote: I have a problem with the caption option on the xtable function. Using Rmarkdown, knitr generates correctly a pdf when I write something like this: ```{r xtable, results=asis} library( xtable ) variableName - c( V03_1 ) age - c( rep(1,10),rep(2,10),rep(3,10) ) gender - c( rep(m,15), rep(f,15) ) df - data.frame( age, gender ) t - xtable( df, caption = hello ) print( t, caption.placement = 'top',comment = FALSE ) ``` But if I change to t - xtable(df, caption = variableName) wich is what I really want it retuns a pandoc error Hello: It is, indeed, the underscore in the variable name. You should define it as: variableName - c(V03\\_1) And now: t - xtable(df, caption = variableName) print(t, caption.placement = 'top',comment = FALSE) Will work. -- Ulises M. Alvarez http://sophie.unam.mx/ __ 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] Parallel for that does not keep the results
Hi all,I am working in a multi core machine and I am trying to make some parallel code to speed up the process. I have seen already the foreach packet but it looks like that it always combine the results on a list. My case though is simpler since I am plotting and saving in external files, inside the loop, and thus I do not need to keep anything from the loop.My code looks like expandMeanSigmaOn-expand.grid(1:100,100:200,5:10,5000:6000) for (i in 1:length(expandMeanSigmaOn$Var1)){ mean1-expandMeanSigmaOn$Var1[i] mean2-expandMeanSigmaOn$Var2[i] sd1-expandMeanSigmaOn$Var3[i] sd2-expandMeanSigmaOn$Var4[i] fitcass1-mix(mydata,mixparam(c(mean1,mean2),(c(sd1,sd2)),gamma))) pdf(file=paste(filename,ON.pdf,sep=));plot(fitcass1);dev.off() # plotting and saving save(OnFitList,file=paste(filename,ON.Rdata,sep=)) # plotting and saving } } } as you can see from the code above, given some input values I am trying some fits, which then I am saving the results. Do you think that the foreach packaget would be suitable (since the returning list can grow very large and eat up memory) or should I try some alternative package? I would like to thank you in advance for your replyRegardsAlex [[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] xtable caption knitr
Dear all, I have a problem with the caption option on the xtable function. Using Rmarkdown, knitr generates correctly a pdf when I write something like this: ```{r xtable, results=asis} library( xtable ) variableName - c( V03_1 ) age - c( rep(1,10),rep(2,10),rep(3,10) ) gender - c( rep(m,15), rep(f,15) ) df - data.frame( age, gender ) t - xtable( df, caption = hello ) print( t, caption.placement = 'top',comment = FALSE ) ``` But if I change to t - xtable(df, caption = variableName) wich is what I really want it retuns a pandoc error: ! Missing $ inserted. inserted text $ l.112 \caption{V03_1} pandoc: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 I don't know why because variableName is also a character variable! Any idea? Thank you very much! -- Aurora González Vidal Sección Apoyo Estadístico. Servicio de Apoyo a la Investigación (SAI). Vicerrectorado de Investigación. Universidad de Murcia Edif. SACE . Campus de Espinardo. 30100 Murcia @. aurora.gonzal...@um.es T. 868 88 7315 F. 868 88 7302 www.um.es/sai www.um.es/ae [[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] Convert windows source package for Mac use
On Feb 24, 2015, at 7:19 AM, Warthog arjarvis.wart...@gmail.com wrote: Hi, I am on a Mac. Is there a way to convert a Windows source package so it can be installed on a Mac? I have a package in zip form from a friend who runs Windows. I THINK that it is in compiled format for Windows. The Description says: Built: R 3.1.2 x86_64-w64-mingw32windows I tried to convert it to a tgz then Install/Load on Mac R, but I get the error message: Error: package 'package' was built for x86_64-w64-mingw32 I can run Windows on Parallels Desktop, and the original zip format installs and loads OK. I'd prefer to run R on my Mac. Sorry if this is a stupid question: I read the R-exts and it doesn't say if you can or cannot do this. Thanks, Alan Hi, Just as an FYI, there is a Mac specific SIG list: https://stat.ethz.ch/mailman/listinfo/r-sig-mac Next, the Windows .zip file is a *binary*, not source package, specifically compiled for Windows, as you hint at above. If the package contains any C/C++/FORTRAN code, then that code is also compiled for Windows and is not portable. The source package would/should have a .tar.gz extension and you would want your friend to provide that version of his/her package, presuming that he/she created this package and that it is not otherwise available (eg. from CRAN or a third party location). If you can get that version of the package, then you may be able to install it on OS X, using: install.packages(PackageFileName, repos = NULL, type = source) That presumes that there is no C/C++/FORTRAN code that requires compilation. If so, you would also need to install required development related tools which are referenced in the R FAQ for OSX and the Installation and Admin manual. Regards, Marc Schwartz __ 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] xtable caption knitr
Dear Aurora I suspect the underscore character in your variable name is the problem. On 24/02/2015 11:16, AURORA GONZALEZ VIDAL wrote: Dear all, I have a problem with the caption option on the xtable function. Using Rmarkdown, knitr generates correctly a pdf when I write something like this: ```{r xtable, results=asis} library( xtable ) variableName - c( V03_1 ) age - c( rep(1,10),rep(2,10),rep(3,10) ) gender - c( rep(m,15), rep(f,15) ) df - data.frame( age, gender ) t - xtable( df, caption = hello ) print( t, caption.placement = 'top',comment = FALSE ) ``` But if I change to t - xtable(df, caption = variableName) wich is what I really want it retuns a pandoc error: ! Missing $ inserted. inserted text $ l.112 \caption{V03_1} pandoc: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 I don't know why because variableName is also a character variable! Any idea? Thank you very much! -- Aurora González Vidal Sección Apoyo Estadístico. Servicio de Apoyo a la Investigación (SAI). Vicerrectorado de Investigación. Universidad de Murcia Edif. SACE . Campus de Espinardo. 30100 Murcia @. aurora.gonzal...@um.es T. 868 88 7315 F. 868 88 7302 www.um.es/sai www.um.es/ae [[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. - No virus found in this message. Checked by AVG - www.avg.com Version: 2015.0.5645 / Virus Database: 4299/9172 - Release Date: 02/24/15 -- Michael http://www.dewey.myzen.co.uk __ 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] intercalar elementos de vectores
Gracias, Carlos. Habia pensado en algo similar usando sapply(): sapply(seq(1, ncol(vtmp), by = 2), function(i) c(rbind(as.character(vtmp[, i]), as.character(vtmp[, i+1] Dependiendo de la dimension de los datos, quizas mapply() sea mas eficiente que sapply(). Saludos cordiales, Jorge.- 2015-02-25 1:01 GMT+11:00 Carlos Ortega c...@qualityexcellence.es: Hola, Este otro ejemplo a partir de la idea de Jorge, de c�mo procesar toda la tabla que tienes: #Creo un data.frame de ejemplo todo con letras vtmp - as.data.frame(lapply(letters,function(x) { rep(x,each=50) })) names(vtmp) - paste(col,LETTERS,sep=) head(vtmp) colA colB colC colD colE colF colG colH colI colJ colK colL colM colN colO colP colQ colR colS colT colU colV colW colX colY colZ 1abcdefghijklmn opqrstuvwxyz 2abcdefghijklmn opqrstuvwxyz 3abcdefghijklmn opqrstuvwxyz 4abcdefghijklmn opqrstuvwxyz 5abcdefghijklmn opqrstuvwxyz 6abcdefghijklmn opqrstuvwxyz #Los n�meros de columnas impares de mi data.frame matIndex - seq(1, dim(vtmp)[2], by=2) #Funci�n para juntar dos columnas (idea de Jorge) mifun - function(x,y) c(rbind(as.vector(vtmp[,x]),as.vector(vtmp[,y]))) #Resulado aplicando mapply. Coge dos columnas consecutivas y las alterna #y as� de forma iterativa para cada una de las columnas que indica matIndex y la siguiente columna matIndex+1 resultado - mapply(mifun,matIndex, matIndex+1) head(kk) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] a c e g i k m o q s u w y [2,] b d f h j l n p r t v x z [3,] a c e g i k m o q s u w y [4,] b d f h j l n p r t v x z [5,] a c e g i k m o q s u w y [6,] b d f h j l n p r t v x z Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 14:10, Fernando Macedo ferm...@gmail.com escribi�: Excelente! Ahora corre muy r�pido. No conoc�a ese m�todo, creo que me va a resultar muy �til. Muchas gracias y saludos. Fernando Macedo El 24/02/15 a las 10:51, Jorge I Velez escribi�: Fernando, Podrias intentar R a - rep('a', 5) R b - rep('b', 5) R a [1] a a a a a R b [1] b b b b b R c(rbind(a, b)) [1] a b a b a b a b a b Saludos, Jorge.- 2015-02-24 23:49 GMT+11:00 Fernando Macedo ferm...@gmail.com: Buenas a todos. Relato el problema: - tengo un archivo de 316 columnas por 562000 filas (aprox.). - esas 316 columnas representan 158 sujetos, o sea dos columnas por cada individuo conteniendo informaci�n que debe ser condensada en una sola. Lo que necesito es ir tomando las dos columnas de cada individuo e intercalar los elementos de los vectores formando uno solo. Ejemplificando ser�a algo as�: a [1] a a a a a b [1] b b b b b c [1] a b a b a b a b a b Estoy haciendo con un loop for pero es realmente muy lento. He buscado por alg�n paquete que ya lo haga directamente pero no he tenido mucho �xito. Me imagino que con sapply o apply pueda ser mucho m�s efectivo pero me ha resultado complicado para entender la sintaxis de estas funciones cuando involucra m�s de un objeto (vector, matriz, etc...). Desde ya agradezco las sugerencias que puedan verter sobre este problema. -- Fernando Macedo [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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] Convert windows source package for Mac use
Hi, I am on a Mac. Is there a way to convert a Windows source package so it can be installed on a Mac? I have a package in zip form from a friend who runs Windows. I THINK that it is in compiled format for Windows. The Description says: Built: R 3.1.2 x86_64-w64-mingw32windows I tried to convert it to a tgz then Install/Load on Mac R, but I get the error message: Error: package 'package' was built for x86_64-w64-mingw32 I can run Windows on Parallels Desktop, and the original zip format installs and loads OK. I'd prefer to run R on my Mac. Sorry if this is a stupid question: I read the R-exts and it doesn't say if you can or cannot do this. Thanks, Alan [[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] Packages not installing on XP
2) Switch off any anti-virus runtime checking. Thanks; that seems to have been it - probably because of a recent Norton update, as previous package installations worked smoothly. S *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] How to Deploy a 'poLCA' Model?
Looking at package poLCA I see functions poLCA.predcell() and poLCA.table(). If these do not do what you want, you will need to be clearer and provide a reproducible example. - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of sagnik chakravarty Sent: Monday, February 23, 2015 6:06 AM To: d...@votamatic.org Cc: r-help Subject: [R] How to Deploy a 'poLCA' Model? Hi Drew, I was working with 'poLCA' to fit latent-class model with covariates [formula: f=cbind(y1,y2,y3) ~ x1*x2*x3*x4]. The output contains a fit table with coefficients, t-value, std_error and P-value for different combinations of the covariates. Now if I want to deploy this model to a new dataset like we do for any other model with 'predict' function, how to proceed? I couldn't find any predict function described in the package documentation. Kindly help. Thanks, -- Regards, SAGNIK CHAKRAVARTY [[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-es] intercalar elementos de vectores
Hola, Este otro ejemplo a partir de la idea de Jorge, de cómo procesar toda la tabla que tienes: #Creo un data.frame de ejemplo todo con letras vtmp - as.data.frame(lapply(letters,function(x) { rep(x,each=50) })) names(vtmp) - paste(col,LETTERS,sep=) head(vtmp) colA colB colC colD colE colF colG colH colI colJ colK colL colM colN colO colP colQ colR colS colT colU colV colW colX colY colZ 1abcdefghijklmn opqrstuvwxyz 2abcdefghijklmn opqrstuvwxyz 3abcdefghijklmn opqrstuvwxyz 4abcdefghijklmn opqrstuvwxyz 5abcdefghijklmn opqrstuvwxyz 6abcdefghijklmn opqrstuvwxyz #Los números de columnas impares de mi data.frame matIndex - seq(1, dim(vtmp)[2], by=2) #Función para juntar dos columnas (idea de Jorge) mifun - function(x,y) c(rbind(as.vector(vtmp[,x]),as.vector(vtmp[,y]))) #Resulado aplicando mapply. Coge dos columnas consecutivas y las alterna #y así de forma iterativa para cada una de las columnas que indica matIndex y la siguiente columna matIndex+1 resultado - mapply(mifun,matIndex, matIndex+1) head(kk) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] a c e g i k m o q s u w y [2,] b d f h j l n p r t v x z [3,] a c e g i k m o q s u w y [4,] b d f h j l n p r t v x z [5,] a c e g i k m o q s u w y [6,] b d f h j l n p r t v x z Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 14:10, Fernando Macedo ferm...@gmail.com escribió: Excelente! Ahora corre muy rápido. No conocía ese método, creo que me va a resultar muy útil. Muchas gracias y saludos. Fernando Macedo El 24/02/15 a las 10:51, Jorge I Velez escribió: Fernando, Podrias intentar R a - rep('a', 5) R b - rep('b', 5) R a [1] a a a a a R b [1] b b b b b R c(rbind(a, b)) [1] a b a b a b a b a b Saludos, Jorge.- 2015-02-24 23:49 GMT+11:00 Fernando Macedo ferm...@gmail.com: Buenas a todos. Relato el problema: - tengo un archivo de 316 columnas por 562000 filas (aprox.). - esas 316 columnas representan 158 sujetos, o sea dos columnas por cada individuo conteniendo información que debe ser condensada en una sola. Lo que necesito es ir tomando las dos columnas de cada individuo e intercalar los elementos de los vectores formando uno solo. Ejemplificando sería algo así: a [1] a a a a a b [1] b b b b b c [1] a b a b a b a b a b Estoy haciendo con un loop for pero es realmente muy lento. He buscado por algún paquete que ya lo haga directamente pero no he tenido mucho éxito. Me imagino que con sapply o apply pueda ser mucho más efectivo pero me ha resultado complicado para entender la sintaxis de estas funciones cuando involucra más de un objeto (vector, matriz, etc...). Desde ya agradezco las sugerencias que puedan verter sobre este problema. -- Fernando Macedo [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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] Convert windows source package for Mac use
Is there a way to convert a Windows source package so it can be installed on a Mac? The .zip format yo mention is not a source package; it is a compiled binary. The _source_ packages are .tar.gz files. Those do not need to be converted for different platforms (provided the package supports different platforms) because R can install from the tar.gz. If a .zip exists, though, the .tar.gz should too, or if it doesn't (typically because the developer is a local Windows developer and hasn't bothered to create a tar.gz they don't need) the tar.gz can be created more or less trivially using R CMD from the package source code. The documentation you're looking for on installation is 6.3 of 'R Installation and Administration. For building packages locally from your own R source code, look at 'Writing R Extensions' S Ellison *** This email and any attachments are confidential. Any use...{{dropped:8}} __ 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] intercalar elementos de vectores
Muchas gracias a los dos, los ejemplos de uso de las funciones *apply siempre son bienvenidos. Saludos Fernando Macedo El 24/02/15 a las 12:12, Jorge I Velez escribió: Gracias, Carlos. Habia pensado en algo similar usando sapply(): sapply(seq(1, ncol(vtmp), by = 2), function(i) c(rbind(as.character(vtmp[, i]), as.character(vtmp[, i+1] Dependiendo de la dimension de los datos, quizas mapply() sea mas eficiente que sapply(). Saludos cordiales, Jorge.- 2015-02-25 1:01 GMT+11:00 Carlos Ortega c...@qualityexcellence.es: Hola, Este otro ejemplo a partir de la idea de Jorge, de cómo procesar toda la tabla que tienes: #Creo un data.frame de ejemplo todo con letras vtmp - as.data.frame(lapply(letters,function(x) { rep(x,each=50) })) names(vtmp) - paste(col,LETTERS,sep=) head(vtmp) colA colB colC colD colE colF colG colH colI colJ colK colL colM colN colO colP colQ colR colS colT colU colV colW colX colY colZ 1abcdefghijklmn opqrstuvwxyz 2abcdefghijklmn opqrstuvwxyz 3abcdefghijklmn opqrstuvwxyz 4abcdefghijklmn opqrstuvwxyz 5abcdefghijklmn opqrstuvwxyz 6abcdefghijklmn opqrstuvwxyz #Los números de columnas impares de mi data.frame matIndex - seq(1, dim(vtmp)[2], by=2) #Función para juntar dos columnas (idea de Jorge) mifun - function(x,y) c(rbind(as.vector(vtmp[,x]),as.vector(vtmp[,y]))) #Resulado aplicando mapply. Coge dos columnas consecutivas y las alterna #y así de forma iterativa para cada una de las columnas que indica matIndex y la siguiente columna matIndex+1 resultado - mapply(mifun,matIndex, matIndex+1) head(kk) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [1,] a c e g i k m o q s u w y [2,] b d f h j l n p r t v x z [3,] a c e g i k m o q s u w y [4,] b d f h j l n p r t v x z [5,] a c e g i k m o q s u w y [6,] b d f h j l n p r t v x z Saludos, Carlos Ortega www.qualityexcellence.es El 24 de febrero de 2015, 14:10, Fernando Macedo ferm...@gmail.com escribió: Excelente! Ahora corre muy rápido. No conocía ese método, creo que me va a resultar muy útil. Muchas gracias y saludos. Fernando Macedo El 24/02/15 a las 10:51, Jorge I Velez escribió: Fernando, Podrias intentar R a - rep('a', 5) R b - rep('b', 5) R a [1] a a a a a R b [1] b b b b b R c(rbind(a, b)) [1] a b a b a b a b a b Saludos, Jorge.- 2015-02-24 23:49 GMT+11:00 Fernando Macedo ferm...@gmail.com: Buenas a todos. Relato el problema: - tengo un archivo de 316 columnas por 562000 filas (aprox.). - esas 316 columnas representan 158 sujetos, o sea dos columnas por cada individuo conteniendo información que debe ser condensada en una sola. Lo que necesito es ir tomando las dos columnas de cada individuo e intercalar los elementos de los vectores formando uno solo. Ejemplificando sería algo así: a [1] a a a a a b [1] b b b b b c [1] a b a b a b a b a b Estoy haciendo con un loop for pero es realmente muy lento. He buscado por algún paquete que ya lo haga directamente pero no he tenido mucho éxito. Me imagino que con sapply o apply pueda ser mucho más efectivo pero me ha resultado complicado para entender la sintaxis de estas funciones cuando involucra más de un objeto (vector, matriz, etc...). Desde ya agradezco las sugerencias que puedan verter sobre este problema. -- Fernando Macedo [[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 -- Saludos, Carlos Ortega www.qualityexcellence.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] Not finding superclass in library
Thank you so much for your help. Will aim at making a reproducible example next time, maybe if I had done that I would realized that the issue was that I was using Rscript, which does not load the methods library, which was the source of the problem. From: Charles C. Berry [ccbe...@ucsd.edu] Sent: Monday, February 23, 2015 10:20 PM To: Ramiro Barrantes Cc: Rolf Turner; r-help@r-project.org Subject: Re: Not finding superclass in library On Mon, 23 Feb 2015, Ramiro Barrantes wrote: Thank you for pointing this out. I had no idea about the distinction but there are some good references on the matter (http://www.r-bloggers.com/packages-v-libraries-in-r/). I am pasting the corrected version below, any suggestions appreciated: I have a package that I created that defines a parent class, assayObject. I created other classes that inherit from it, say assayObjectDemo. Each one of those classes I wanted to make in its own directory separate from where the assayObject is defined (there are reasons for that). But now if I do: library(assayObject) #--- where parent object is defined source(assayObjectDemo.R) where assayObjectDemo.R is just: setClass(assayObjectDemo,contains=assayObject) createDemoAssayObject - function() { df - data.frame() assay-new(Class=assayObjectDemo) assay } I get: Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, : no definition was found for superclass “assayObject” in the specification of class “assayObjectDemo” What can I do? Start with a reproducible example. Here is one: library(Matrix) tmpf - tempfile(fileext=.R) cat('setClass(MatrixDemo,contains=Matrix)',file=tmpf) source(tmpf) slotNames(MatrixDemo) And it produces the expected output without error: [1] Dim Dimnames Since this works fine for a widely used package and fails for your (unspecified) package, I suspect there is a problem with your package. If I had to guess, I'd say it is a NAMESPACE issue. Be sure your exportClasses directive is correctly formed per Section 1.5.6 Namespaces with S4 classes and methods of R-exts. r-devel might be a better venue for this discussion. HTH, Chuck __ 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
I try to create a dot plot loop for 6 protein, that mean that i want to do dot plot to 36 pairs of protein in a loop library(seqinr) Seq1 - read.fasta(file =C:/D.fasta) Protinename1 - Seq1[[1]] Protinename2 - Seq1[[2]] Protinename3 - Seq1[[3]] Protinename4 - Seq1[[4]] Protinename5 - Seq1[[5]] Protinename6 - Seq1[[6]] dotPlot(Protinename1 , Protinename3) i have no idea how to create a loop for this script thank you for your 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] Not finding superclass in library
Rolf Turner r.tur...@auckland.ac.nz on Tue, 24 Feb 2015 09:41:42 +1300 writes: On 24/02/15 09:35, Ramiro Barrantes wrote: Hello, I have a library that I created . SNIP No you ***DO NOT***. You have a ***PACKAGE***. If you cannot even get your terminology straight, what hope is there for you? cheers, Rolf Turner Thank you, Rolf! You saved my day as the say ;-) if(!require(fortunes)) install.packages(fortunes) fortune(58) fortune(161) Regards, Martin __ 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] decimal places
I am very new to R and I'm trying to increase my decimal places (from 2 to 4) for this code: with(longitudinal, pairwise.wilcox.test(DV, Time, p.adjust.method=holm, paired=TRUE)) Right now the output is: Pairwise comparisons using Wilcoxon signed rank test data: DV and Time yr15 yr2 yr5 yr2 0.03 -- yr5 0.03 0.05 - yr8 0.03 0.05 0.03 I have tried various codes and they didn't work: options(digits=4) with(longitudinal, pairwise.wilcox.test(DV, Time, p.adjust.method=holm, paired=TRUE)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE), + options(digits=4)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE, + digits=4)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE), + signif(digits=4)) thanks, Linh [[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] Not finding superclass in library
RB == Ramiro Barrantes ram...@precisionbioassay.com on Tue, 24 Feb 2015 16:34:13 + writes: RB Thank you so much for your help. Will aim at making a RB reproducible example next time, maybe if I had done that RB I would realized that the issue was that I was using RB Rscript, which does not load the methods library, which RB was the source of the problem. But Ramiro, you already forgot what you learned from Rolf: fortune(161) (3 times...gh...) and why do you think the mailing list is called R-*packages* ??? Please do for(i in 1:20) cat(It's a package!\n) -- Martin Maechler (after a newly released *package* has been called *library* three times in its announcement on R-packages) R-help (March 2006) === :-) === Martin __ 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] decimal places
On 24/02/2015 9:11 AM, Linh Nguyen Vaccarello wrote: I am very new to R and I'm trying to increase my decimal places (from 2 to 4) for this code: with(longitudinal, pairwise.wilcox.test(DV, Time, p.adjust.method=holm, paired=TRUE)) Right now the output is: Pairwise comparisons using Wilcoxon signed rank test data: DV and Time yr15 yr2 yr5 yr2 0.03 -- yr5 0.03 0.05 - yr8 0.03 0.05 0.03 Many functions in R produce objects with a class, and there are special methods to print many classes. In the case of pairwise.wilcox.test the object produced is of class pairwise.htest. You can see the code using stats:::print.pairwise.htest and you'll see it hard-codes 2 significant digits. (Which surprises me a bit, but I guess your p-values are all 0.030 and 0.050.) You can edit the definition for a temporary change: print.pairwise.htest - function (x, digits = 5, ...) { cat(\n\tPairwise comparisons using, x$method, \n\n) cat(data: , x$data.name, \n\n) pp - format.pval(x$p.value, digits, na.form = -) attributes(pp) - attributes(x$p.value) print(pp, quote = FALSE, ...) cat(\nP value adjustment method:, x$p.adjust.method, \n) invisible(x) } Your definition of this method will override the default one, so defining that function is enough, R will call it for printing. Duncan Murdoch I have tried various codes and they didn't work: options(digits=4) with(longitudinal, pairwise.wilcox.test(DV, Time, p.adjust.method=holm, paired=TRUE)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE), + options(digits=4)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE, + digits=4)) with(longitudinal, pairwise.wilcox.test(DV, Time, + p.adjust.method=holm, + paired=TRUE), + signif(digits=4)) thanks, Linh [[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
Where did 36 pairs come from? 6 things taken 2 at a time is 15 pairs. Here is an example of how it might be done: library(seqinr) Seq1 - read.fasta(file =C:/D.fasta) # are you doing each pair so that you have 6 taken 2 at a time for 15 plots? pairs - combn(6, 2) # create the pairings # now the loop for the plots for (col in seq(ncol(pairs))){ dotPlot(Seq1[[pairs[1, col]]], Seq1[[pairs[2, col]]]) } Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Tue, Feb 24, 2015 at 10:32 AM, Ron Flatau ronfla...@gmail.com wrote: I try to create a dot plot loop for 6 protein, that mean that i want to do dot plot to 36 pairs of protein in a loop library(seqinr) Seq1 - read.fasta(file =C:/D.fasta) Protinename1 - Seq1[[1]] Protinename2 - Seq1[[2]] Protinename3 - Seq1[[3]] Protinename4 - Seq1[[4]] Protinename5 - Seq1[[5]] Protinename6 - Seq1[[6]] dotPlot(Protinename1 , Protinename3) i have no idea how to create a loop for this script thank you for your 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] Barplot
i want to plot the following data in barplot Year Gender revenue 2001 M 100 2001 F 150 2002 M75 2002 F200 2003 M150 2003 F 75 I want to compare performance of gender in year wise fashion . How to do ? Parth __ 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] decimal places
On 24 Feb 2015, at 18:24 , Duncan Murdoch murdoch.dun...@gmail.com wrote: stats:::print.pairwise.htest and you'll see it hard-codes 2 significant digits. (Which surprises me a bit, but I guess your p-values are all 0.030 and 0.050.) It was a decade and a half ago, but I think the general idea of the hardcoded value was that by default you want a display as compact as possible, and 2 digits after adjustment for multiple testing should be enough for most. If you want more, just extract the p.value component and print it to whatever precision you need. -- 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] One column listing on wide monitors too
Here are several ways: a - paste(String, 1:16) a [1] String 1 String 2 String 3 String 4 String 5 String 6 [7] String 7 String 8 String 9 String 10 String 11 String 12 [13] String 13 String 14 String 15 String 16 matrix(a, length(a)) [,1] [1,] String 1 [2,] String 2 . . . [15,] String 15 [16,] String 16 t(t(a)) [,1] [1,] String 1 [2,] String 2 . . . [15,] String 15 [16,] String 16 b - a dim(b) - c(16, 1) b [,1] [1,] String 1 [2,] String 2 . . . [15,] String 15 [16,] String 16 cat(a, sep=\n) # But no numbering String 1 String 2 . . . String 15 String 16 - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of marekl Sent: Tuesday, February 24, 2015 2:09 PM To: r-help@r-project.org Subject: [R] One column listing on wide monitors too Hi, it is probably very basic question, but I can't get answer still. R shows listings in more columns on wider monitors. Like on this picture: http://i.imgur.com/GLF70r9.png Is there a way to set R to show listings like this, in one column only? [1] String 1 [2] String 2 [3] String 3 ... [16] String 16 Thank you -- View this message in context: http://r.789695.n4.nabble.com/One-column-listing-on-wide-monitors-too-tp4703781.html Sent from the R help mailing list archive at Nabble.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. __ 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] R crashes with Error in UseMethod(depth) when resizing ggplot windows
On 24/02/2015 4:13 PM, Eike Petersen wrote: Hello everyone, Quite frequently I encounter crashes when resizing ggplot windows. The error message is always as follows: Error in UseMethod(depth) : no applicable method for 'depth' applied to an object of class NULL Process R exited abnormally with code 255 at Tue Feb 24 21:51:18 2015 The error seems to occur rather unpredictably when I do several resizings, e.g. moving a plot window from one monitor to another using Windows+Arrow Key several times. It only seems to happen when plotting rather large data frames. I was about to file this as a ggplot2 issue, but then I realized that I can't reproduce it using RStudio - normally, I use emacs/ESS (on Windows 7). So maybe this is a bug related to the plot engine...? The problem is that I can't even do a traceback(), since R is crashed. How should I proceed? Are there any other options to retrieve valuable debug information? It's not easy, but you can run R under a debugger, and it will show you the location of the crash. As far as I know only gdb supports debugging R on Windows (there's a copy in the Rtools collection), but perhaps that will change now that Microsoft has purchased Revolution Analytics. 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] problem in R2JAGS
Hi everyone, I need your help to correct R code using R2JAGS. The problem is when i defined testJAGSdata which contains on all the data as following testJAGSdata - read.bugsdata(bugsdata.R) bugsdata.R-read.table(F:/JAGS/bugsdata.R) i found this error testJAGSdata - read.bugsdata(bugsdata.R) Error in file(filename, r) : cannot open the connection In addition: Warning message: In file(filename, r) : cannot open file 'bugsdata.R': No such file or directory bugsdata.R-read.table(F:/JAGS/bugsdata.R) Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 2 did not have 3 elements and Error in jags(data = testJAGSdata, inits = testJAGSinits, model.file = testJAGS.txt, : object 'testJAGSdata' not found How can i solve this problem? because i think the problem in bugsdata.R but this file works correctly. Any help would be highly appreciated Many thanks in advance -- 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] One column listing on wide monitors too
options(width=10) On Wed, Feb 25, 2015 at 4:08 AM, marekl mare...@lutonsky.net wrote: Hi, it is probably very basic question, but I can't get answer still. R shows listings in more columns on wider monitors. Like on this picture: http://i.imgur.com/GLF70r9.png Is there a way to set R to show listings like this, in one column only? [1] String 1 [2] String 2 [3] String 3 ... [16] String 16 Thank you -- View this message in context: http://r.789695.n4.nabble.com/One-column-listing-on-wide-monitors-too-tp4703781.html Sent from the R help mailing list archive at Nabble.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. __ 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] Getting Rmarkdown to generate custom LaTEX environment
Hi all, I was struggling trying to make my Rmarkdown document to generate \begin{figure*} instead of \begin{figure} So that the figure spans on two columns (I'm using a custom template). in my figure. I have read the Rmarkdown Reference Guide, and searched for it on StackOverflow, and the general idea seems to be that I could somehow pass the fig.env variable to the figure, but I have tried it with no success: Something like this still doesn't have any effect whatsoever on the latex code generated: ```{r test-plot, echo=FALSE, fig.cap = Test plot.\\label{fig:test-plot}, fig.env='figure*' } options(fig.env='figure*') plot(blah) ``` I know I must have missed something but couldn't figure out what I'm missing after hours of struggling. Any help is much appreciated. I have a smaller problem where I want to customize the [htbp] option of the figure, and facing the same problem. Cheers, - Huan. -- Eccentric Graduate Student Google Talk/Jabber hu...@tnhh.net - Website tnhh.net - Phone 1-858-848-ROFL __ 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 asin transformation
Le 22/02/2015 19:28, CHIRIBOGA Xavier a écrit : Dear all, I attempted to transform my data using asin but a WARNING message appears: dat1$Abu.tr-asin(sqrt(dat1$Abundance/100)) Warning message: In asin(sqrt(dat1$Abundance/100)) : NaNs produced What does it mean? Is it a problem? How can I solve this? One or more of your Abundance data is negative, higher than 100 or non-finite: asin(seq(from=-2, to=2, by=0.1)) [1]NaNNaNNaNNaNNaN NaNNaN [8]NaNNaNNaN -1.5707963 -1.1197695 -0.9272952 -0.7753975 [15] -0.6435011 -0.5235988 -0.4115168 -0.3046927 -0.2013579 -0.1001674 0.000 [22] 0.1001674 0.2013579 0.3046927 0.4115168 0.5235988 0.6435011 0.7753975 [29] 0.9272952 1.1197695 1.5707963NaNNaN NaNNaN [36]NaNNaNNaNNaNNaN NaN Message d'avis : In asin(seq(from = -2, to = 2, by = 0.1)) : production de NaN sqrt(seq(from=-2, to=2, by=0.1)) [1] NaN NaN NaN NaN NaN NaN NaN NaN [9] NaN NaN NaN NaN NaN NaN NaN NaN [17] NaN NaN NaN NaN 0.000 0.3162278 0.4472136 0.5477226 [25] 0.6324555 0.7071068 0.7745967 0.8366600 0.8944272 0.9486833 1.000 1.0488088 [33] 1.0954451 1.1401754 1.1832160 1.2247449 1.2649111 1.3038405 1.3416408 1.3784049 [41] 1.4142136 Message d'avis : In sqrt(seq(from = -2, to = 2, by = 0.1)) : production de NaN But take a look at this also about arcsine transformation: Warton, D.I., Hui, F.K.C., 2011. The arcsine is asinine: the analysis of proportions in ecology. Ecology 92, 3-10. Sincerely, Marc __ 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 asin transformation
Le 22/02/2015 19:28, CHIRIBOGA Xavier a écrit : Dear all, I attempted to transform my data using asin but a WARNING message appears: dat1$Abu.tr-asin(sqrt(dat1$Abundance/100)) Warning message: In asin(sqrt(dat1$Abundance/100)) : NaNs produced What does it mean? Is it a problem? How can I solve this? One or more of your Abundance data is negative, higher than 100 or non-finite: asin(seq(from=-2, to=2, by=0.1)) [1]NaNNaNNaNNaNNaN NaNNaN [8]NaNNaNNaN -1.5707963 -1.1197695 -0.9272952 -0.7753975 [15] -0.6435011 -0.5235988 -0.4115168 -0.3046927 -0.2013579 -0.1001674 0.000 [22] 0.1001674 0.2013579 0.3046927 0.4115168 0.5235988 0.6435011 0.7753975 [29] 0.9272952 1.1197695 1.5707963NaNNaN NaNNaN [36]NaNNaNNaNNaNNaN NaN Message d'avis : In asin(seq(from = -2, to = 2, by = 0.1)) : production de NaN sqrt(seq(from=-2, to=2, by=0.1)) [1] NaN NaN NaN NaN NaN NaN NaN NaN [9] NaN NaN NaN NaN NaN NaN NaN NaN [17] NaN NaN NaN NaN 0.000 0.3162278 0.4472136 0.5477226 [25] 0.6324555 0.7071068 0.7745967 0.8366600 0.8944272 0.9486833 1.000 1.0488088 [33] 1.0954451 1.1401754 1.1832160 1.2247449 1.2649111 1.3038405 1.3416408 1.3784049 [41] 1.4142136 Message d'avis : In sqrt(seq(from = -2, to = 2, by = 0.1)) : production de NaN But take a look at this also about arcsine transformation: Warton, D.I., Hui, F.K.C., 2011. The arcsine is asinine: the analysis of proportions in ecology. Ecology 92, 3-10. Sincerely, Marc __ 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] Barplot
Hi Homework? We do not solve your homeworks here. barplot(temp$revenue) and play with col and names.arg together with ?interaction of Year and Gender Or use ggplot2 Cheers Petr -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Partha Sinha Sent: Wednesday, February 25, 2015 8:33 AM To: r-help Subject: [R] Barplot i want to plot the following data in barplot Year Gender revenue 2001 M 100 2001 F 150 2002 M75 2002 F200 2003 M150 2003 F 75 I want to compare performance of gender in year wise fashion . How to do ? Parth __ 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 may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. __ 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.