Re: [R-es] tips para curso introductorio de R

2016-09-06 Thread Ruben Tobalina Ramirez
Buenos días, Nunca di clases de R pero creo que la mejor forma de aprender es siempre, hacer las cosas tu mismo. Así que, como tu dices, lo mejor es hacer que los alumnos hagan pequeñas practicas sobre pequeños tips de teoria. No sé muy bien que teoria daras, pero por ejemplo enseñando a hacer

Re: [R] Run an external software in R

2016-09-06 Thread William Dunlap via R-help
You can use system() or shell(), which adds "cmd.exe /c " to the front of your command so you can use DOS syntax. Remember to add double quotes when file names have spaces in them. E.g., I can call an old version of R with the following and later read its text output into my current session. >

Re: [R] Run an external software in R

2016-09-06 Thread Bert Gunter
?system But this begs the question: WHY would you want to do this? More specifically, what should R communicate to your other software, and what should the other software communicate to R? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Bert Gunter
Jun: "My problem is the pattern has to be dynamically constructed on the input data of the function " What does that mean? How can a pattern be "dynamically constructed" when you have not made clear (at least to me, perhaps also to yourself and/or others) *how* it is to be constructed? Cheers,

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Jun Shen
Hi Ista, Thanks for the suggestion. I didn't know mapply can be used this way! Let me take one more step. Instead of defining a pattern for each string, I would like to define a set of patterns from all the possible combination of the unique values of those variables. Then I need each string to

[R-es] tips para curso introductorio de R

2016-09-06 Thread Angela Andrea Camargo Sanabria
Buen día a todos: les agradezco de antemano su ayuda sobre este tema relacionado a R pero no del lenguaje de R. Voy a dar un pequeño curso-taller de introducción al lenguaje de R a estudiantes de maestría y doctorado (primer semestre) en Ecología y quisiera conocer algunos tips o recomendaciones

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Jun Shen
Hi Jeff, Thanks for the reply. I tried your suggestion and it doesn't seem to work and I tried a simple pattern as follows and it works as expected sub("(3\\.mg\\.kg)\\.(>50-70\\.kg)\\.(.*)", '\\1', "3.mg.kg.>50-70.kg.P05") [1] "3.mg.kg" sub("(3\\.mg\\.kg)\\.(>50-70\\.kg)\\.(.*)", '\\2',

[R] Run an external software in R

2016-09-06 Thread Marino David
Hi all R users: Does anybody have the experience of running an external software in R? I try to use R to run ANSYS software, which is a engineering simulation package. I ever have done this task in Matlab platform by executing the following code line: system('"C:\Program Files\Ansys

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Jun Shen
Hi Bert, In the final.pattern, there are ten patterns. >sub(final.pattern, '\\1', test.string) Expected results: "240.m.g" "3.mg.kg" "240.m.g" Current results: "" "" "240.m.g" >sub(final.pattern, '\\2', test.string) Expected results: ">110.kg" ">110.kg" ">50-70.kg" Current results: "" ""

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Jeff Newmiller
I am not near my computer today, but each parenthesis gets its own result number, so you should put the parenthesis around the whole pattern of alternatives instead of having many parentheses. I recommend thinking in terms of what common information you expect to find in these various strings,

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Jun Shen
Hi Bert, I still couldn't make the multiple patterns to work. Here is an example. I make the pattern as follows final.pattern <-

[R-es] igraph edges busqueda

2016-09-06 Thread javier.ruben.marcuzzi
Estimados Tengo una duda E(datos.network)[[inc('LoQueBusco')]] + 20/6795 edges (vertex names): E(datos.network)[E(datos.network)$Cosa=="'LoQueBusco'"] + 78/6795 edges (vertex names): La primer forma es 20/… la segunda 78/… ¿Los resultados no tendrían que ser idénticos? Estos datos son pocos

Re: [R-es] Ayuda con gráfico típico de histograma más linea

2016-09-06 Thread Carlos Ortega
Hola, Dell es los pocos que yo sepa que ofrecen equipos con Linux instalado como SO de base: http://www.dell.com/es/empresas/p/xps-13-9350-laptop-ubuntu/pd?oc=bnx9333 Saludos, Carlos Ortega www.qualityexcellence.es El 6 de septiembre de 2016, 21:33, Ruben Tobalina Ramirez <

Re: [R-es] Gráfico de Barras

2016-09-06 Thread Carlos Ortega
Hola, En los gráficos "base", las barras se construyen repartiéndolas sobre el eje "X". Para saber sobre qué punto cae el punto intermedio, la forma de hacerlo es recuperando los valores del objeto "barplot" como has hecho. Y una vez recuperados, utilizas estos puntos para pintar líneas de forma

[R-es] Gráfico de Barras

2016-09-06 Thread Mauricio Monsalvo
Hola. Siguiendo a Mittal (2001); R Graph Cookbook creo haber logrado construir el gráfico de barras que buscada. La matriz que utilizo para el "height" va adjunta. Y mi sintaxis: barplot(t(barras), col=col.segmentos, border=F , names.arg=Meses, las=2, cex=.75, cex.axis=0.8 ,

Re: [R-es] Ayuda con gráfico típico de histograma más linea

2016-09-06 Thread Ruben Tobalina Ramirez
Buenas, gracias a los que me ayudaron, he conseguido hacer el código más o menos como queria. Lo pego por aqui por si a alguien le interesa. Me hubiese gustado hacerlo en dos ejes pero tengo que entregar la practica de la especialidad en 3 dias y hay muchas cosas que revisar, pero ya que he visto

Re: [R-es] usar un for para cambiar indice

2016-09-06 Thread Jorge I Velez
Es más fácil si usas matplot. Mira ?matplot para más información. Saludos cordiales. --JIV 2016-09-06 13:48 GMT-05:00 Sebastian Kruk : > Estimados usuarios-de-R: > > Tengo un problema. > > Si por ejemplo tengo una lista conformada por la serie historia del PBI de >

[R-es] usar un for para cambiar indice

2016-09-06 Thread Sebastian Kruk
Estimados usuarios-de-R: Tengo un problema. Si por ejemplo tengo una lista conformada por la serie historia del PBI de 10 paìses. >Tiempo <- seq(1:100) >plot(Tiempo, PP$"Serie 1", type="l",col="1") >lines(Tiempo, PPcapita$"Serie 2") >lines(Tiempo, PPcapita$"Serie 3") >lines(Tiempo,

Re: [R] save R object into a remote directory

2016-09-06 Thread Henrik Bengtsson
On Tue, Sep 6, 2016 at 2:00 AM, Rainer M Krug wrote: > Please reply to the mailing list to keep the conversation available for > everybody. I Send this mail to the mailing list as well. > > Simone Tenan writes: > >> Thanks Rainer, >> it's very kind of

Re: [R] graph together 4 series after HP filter

2016-09-06 Thread Giorgio Garziano
Hi Sebastian, here are examples with ggplot2 and basic graphic. http://stackoverflow.com/questions/3777174/plotting-two-variables-as-lines-using-ggplot2-on-the-same-graph http://stackoverflow.com/questions/17150183/r-plot-multiple-lines-in-one-graph You may also impress your audience by using

Re: [R] R-square prob is not calculated by randomization in lmPerm::lmp

2016-09-06 Thread Cade, Brian
For a linear model without an intercept term as in this example, neither the usual permutation scheme for testing Ho: B1 = 0 nor usual definition of R-squared apply. So you need to check what the developer of this code chose to do. If I'm recalling correctly, in a linear model with an intercept

Re: [R] graph together 4 series after HP filter

2016-09-06 Thread Bert Gunter
?lines ?points to add to an existing base graphics graph. There are other ways to do this in the other graph systems (ggplot, lattice,...) used in R. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka

Re: [R] R-square prob is not calculated by randomization in lmPerm::lmp

2016-09-06 Thread Jeff Newmiller
That is contributed code. It could do anything the author felt like. I recommend reading the source code. -- Sent from my phone. Please excuse my brevity. On September 5, 2016 11:52:15 PM PDT, Agustin Lobo wrote: >Any reason why the R-square prob is not calculated by

Re: [R] Factor analysis and time as an offset variable

2016-09-06 Thread Tahereh Dehdarirad
Thank you for your reply. I am grouping citation and some social media indictors ( number of tweets, mendeley readers, etc). The number of citaions a paper recievs or the number of social media indicators that a papers receives depends on time. For example a paper published in 2009 has more time

Re: [R] Factor analysis and time as an offset variable

2016-09-06 Thread Jeff Newmiller
That step is easy, but context is hard. You really need to provide a reproducible example. There are many models, many analysis tools, and many timescales to choose from. In fact, this could easily be mistaken for a question about statistics (not really on-topic here) since you have failed to

Re: [R] (no subject)

2016-09-06 Thread Jeff Newmiller
It is not the implementation of regex that requires double backslashes, but the R string parser. You can use cat to see what the pattern looks like to the parser. Try cat( "\\(.*?\\)" ) -- Sent from my phone. Please excuse my brevity. On September 6, 2016 6:33:15 AM PDT, Sarah Goslee

Re: [R-es] igraph V a partir de E y subgrafos

2016-09-06 Thread javier.ruben.marcuzzi
Estimado Luisfo Gracias por la acotación, tendía que ver ese cambio, hora ¿el resultado sería el mismo al crear el subgrafo o hay una diferencia entre el subgrafo entre: subgraph.edges y induced.subgraph? Yo pienso que colocando correctamente los parámetros el resultado no debería ser

Re: [R] Conditional gap time frailty cox model for recurrent events

2016-09-06 Thread Therneau, Terry M., Ph.D.
You can ignore the message below. The maximizing routine buried within the frailty() command buried with coxph() has a maximizer that is not the brightest. It sometimes gets lost but then finds its way again. The message is from one of those. It likely took a not-so-good update step, and

Re: [R] save R object into a remote directory

2016-09-06 Thread peter dalgaard
On 06 Sep 2016, at 11:00 , Rainer M Krug wrote: > Please reply to the mailing list to keep the conversation available for > everybody. I Send this mail to the mailing list as well. > > Simone Tenan writes: > >> Thanks Rainer, >> it's very kind of you.

[R] graph together 4 series after HP filter

2016-09-06 Thread Sebastian Kruk
Dear R-users: Let's see if you can help. I have an matrix of class "ts" of 100 rows by 4 columns which called PP. In each column I have the time series of quarterly GDP from 4 countries. They applied the Hodrick -Prescott filter and now I want to plot simultaneously cyclical component of the 4

Re: [R] (no subject)

2016-09-06 Thread Sarah Goslee
R's implementation of regex requires double backslashes. Reading ?regex will tell you more. cleanBetweenBrackets <- function(String) { return(gsub("\\(.*?\\)", "", String)) } Str <- "The cat is crazy (but not too crazy)" cleanBetweenBrackets(Str) > cleanBetweenBrackets(Str) [1] "The cat is

[R] Factor analysis and time as an offset variable

2016-09-06 Thread Tahereh Dehdarirad
Hi, Is it possible to use time as an offset (exposure variable) in factor analysis? If yes, would you please advise how? Thanks, Tahereh Tahereh Dehdarirad PhD Student of Library and Information Science University of Barcelona, Spain [[alternative HTML version deleted]]

Re: [R] outliers in Box Plot

2016-09-06 Thread Giorgio Garziano
Hi Rosa, you may take advantage of the extremevalues package. https://cran.r-project.org/web/packages/extremevalues/extremevalues.pdf An example: set.seed(1023) v3 <- c(rnorm(100, 0, 0.2), rnorm(5, 4, 0.1), rnorm(5, -4, 0.1)) v4 <- sample(v3, length(v3)) nam <- as.character(1:length(v4)) df <-

[R] Fwd:

2016-09-06 Thread Audrey Riddell
Hello, I have been able to figure this out using \\ (two back slashes for escape) Working R code for what I wanted is... cleanBetweenBrackets <- function(String) { return(gsub("\\(.*?\\)", "", String))} I thought I had tried that (the \\) before I emailed the list. Please ignore my previous

Re: [R] Help with a code in R

2016-09-06 Thread Bert Gunter
?traceback ?debug ?trace R has built-in debugging tools. Learn to use them. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Sep 5, 2016 at

Re: [R] element wise pattern recognition and string substitution

2016-09-06 Thread Bert Gunter
Just noticed: My clumsy do.call() line in my previously posted code below should be replaced with: pat <- paste(pat,collapse = "|") > pat <- c(pat1,pat2) > paste(pat,collapse="|") [1] "a+\\.*a+|b+\\.*b+" replace this ** > pat <- do.call(paste,c(as.list(pat),

[R] (no subject)

2016-09-06 Thread Audrey Riddell
Hello, I am trying to remove brackets and the text contained in brackets. I tried to do a user defined formula... my attempt at this is pasted below. cleanBetweenBrackets <- function(String) { return(gsub("\(.*?\)", "", String))} I keep getting errors (namely that there is an unrecognised

[R] R-square prob is not calculated by randomization in lmPerm::lmp

2016-09-06 Thread Agustin Lobo
Any reason why the R-square prob is not calculated by randomization in lmPerm::lmp? The help pages states "Either permutation test p-values or the usual F-test p-values will be output", but I always get the F test for R-square as with lm(): require(lmPerm) x <- 1:1000 set.seed(1000) y1 <-

Re: [R] finegray function in survival package

2016-09-06 Thread Ahalya Sivathayalan
Dear R-Team, I have been trying to use the finegray routine that creates a special data so that Fine and Gray model can be fit. However, it does not seem to work. Could you please help me with this issue? Thanks, Ahalya. [[alternative HTML version deleted]]

Re: [R-es] igraph V a partir de E y subgrafos

2016-09-06 Thread Luisfo via R-help-es
Estimado Javier, Me alegra que hayas avanzado con tu error. Te respondo a esto último. La función induced.subgraph() espera como segundo parámetro una lista de los IDs de los vértices, mientras que tú le estás pasando una lista de 'edges'. Prueba lo siguiente: c <-

Re: [R] Iteration over variables

2016-09-06 Thread Rolf Turner
You need to *print* results explicitly within a for-loop. E.g. print(head(d_dataset[, c(paste0("v_turnover_",year), paste0("v_customer_", year))])) See FAQ 7.16 for a related discussion. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University

[R] Iteration over variables

2016-09-06 Thread G . Maubach
Hi All, I would like to write a program that iterates over a set of dynamically generated variables and produces some stats or prints parts of the data. # --- data v_turnover_2011 <- c(10, 20, 30, 40 , 50) v_customer_2011 <- c(0, 1, NA, 0, 1) v_turnover_2012 <- c(10, 20, 30, 40 , 50)

Re: [R-es] R SE QUEDA PEGADO e imposibilitado de trabajar.

2016-09-06 Thread miguel.angel.rodriguez.muinos
Hola Javier. Por lo que comentas (que como bien dice Carlos Ortega, es una información incompleta) parece que el detonante del error es que la máquina entre en suspensión/economode. Varias preguntas - Es un portátil? un sobremesa? - Has probado si te pasa eso (en esas condiciones) con otro

Re: [R] save R object into a remote directory

2016-09-06 Thread Rainer M Krug
Please reply to the mailing list to keep the conversation available for everybody. I Send this mail to the mailing list as well. Simone Tenan writes: > Thanks Rainer, > it's very kind of you. > Unfortunately, I cannot save the (large) R object where the current R

Re: [R] save R object into a remote directory

2016-09-06 Thread Rainer M Krug
Simone Tenan writes: > Hi all, > I'm using R remotely via ssh connection in linux. I need to save a large R > object from the remote server to my laptop. How can I specify the path in > the save() function? You are working on the remote machine and there is no way that

[R] save R object into a remote directory

2016-09-06 Thread Simone Tenan
Hi all, I'm using R remotely via ssh connection in linux. I need to save a large R object from the remote server to my laptop. How can I specify the path in the save() function? Thanks much for your help, Simone [[alternative HTML version deleted]]

Re: [R] Help with a code in R

2016-09-06 Thread PIKAL Petr
Hi Well, it seems to me that it is coded in different language like C++. The code is not reproducible but the error seems to be from your call of ts You can check it line by line with setting i to arbitrary value and inspect how your objects look like, however some of your constructions seems