Re: [R] Transposing forecasts results from nnetar function and turn them into a data frame

2017-03-17 Thread Rui Barradas
Hello, By running the code of the OP, I've come to the conclusion that print.forecast calls print.data.frame: forecast:::print.forecast function (x, ...) { print(as.data.frame(x)) } But I'm unable to get what the OP wants by call as.data.frame(...). Here is the code with some made up

Re: [R] Transposing forecasts results from nnetar function and turn them into a data frame

2017-03-17 Thread Paul Bernal
Dear Jim, Thank you for your valuable replies. So variable mf5 has the forecasts for a fitted nnetar model. Below is the class and the str(mf5) output. Maybe with this information I am sharing with you, hopefully you can give me some more guidance. Again, thank you so much! > class(mf5) [1]

Re: [R] Transposing forecasts results from nnetar function and turn them into a data frame

2017-03-17 Thread Jim Lemon
Hi Paul, When manipulating any R object, the first thing to ascertain is what it is: class(TSmodelForecast) should give you useful information. str(TSmodelForecast) should give you more. Because of the wealth of defined data structures in R, it is difficult to manipulate them without this

[R] SOLVED: inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Karl Schilling
Dear All: it seems I have solved my reordering issue, and to thank all those who answered, I briefly list the mistake I made. I stared out from some data.frame holding values x and a grouping factor. Actually, my factor was a number (but not numeric) which was, however, not ordered. So it

Re: [R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread William Dunlap via R-help
But note that m:n does not always produce an integer sequence. It does when the output can be accurately represented as an integer sequence, it does not care if the inputs were integer or numeric. > class( (2^31-10):(2^31-2) ) [1] "integer" > class( (2^31-10):(2^31) ) # biggest integer is

Re: [R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Rui Barradas
Hello, Not an answer to the OP's statement, but > class(1L:4L) [1] "integer" > class(1:4) [1] "integer" When using m:n there's no need for mL or nL. Rui Barradas Em 17-03-2017 16:58, Jeff Newmiller escreveu: Reprex confirming Bert: A <- data.frame( y = 1L:4L ) B <- data.frame(

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-17 Thread Bert Gunter
Evan: Yes, I stand partially corrected. You have the concept correct, but R implements it differently than SAS. I think what you want for your approach is diff(): evens <- (seq_len(nrow(mydata)) %% 2) == 0 newdat <-data.frame(exp=mydata[evens,1 ],reslt= diff(mydata[,2])[evens[-1]]) ... which

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-17 Thread Bert Gunter
Evan: You misunderstand the concept of a lagged variable. Ulrik: Well, yes, that is certainly a general solution that works. However, given the *specific* structure described by the OP, an even more direct (maybe more efficient?) way to do it just uses (logical) subscripting: odds <-

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-17 Thread Ulrik Stervbo
Hi Evan you can easily do this by applying diff() to each exp group. Either using dplyr: library(dplyr) mydata %>% group_by(exp) %>% summarise(difference = diff(rslt)) Or with base R aggregate(mydata, by = list(group = mydata$exp), FUN = diff) HTH Ulrik On Fri, 17 Mar 2017 at 17:34 Evan

Re: [R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Jeff Newmiller
Reprex confirming Bert: A <- data.frame( y = 1L:4L ) B <- data.frame( x = 1L:4L ) A$x <- B$x plot(B$x) #' ![](http://i.imgur.com/cXSFsBh.png) Care to demonstrate for us, Karl? https://cran.r-project.org/web/packages/reprex/README.html On Fri, 17 Mar 2017, Bert Gunter wrote: You are

[R] lagging over consecutive pairs of rows in dataframe

2017-03-17 Thread Evan Cooch
Suppose I have a dataframe that looks like the following: n=2 mydata <- data.frame(exp = rep(1:5,each=n), rslt = c(12,15,7,8,24,28,33,15,22,11)) mydata exp rslt 11 12 21 15 327 428 53 24 63 28 74 33 84 15 95 22 10 5 11 The

Re: [R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Thierry Onkelinx
Dear Karl, This is hard to investigate without a reproducible example. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht

Re: [R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Bert Gunter
You are wrong. No reordering occurs. 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 Fri, Mar 17, 2017 at 8:05 AM, Karl Schilling

[R] inadverted reordering of a df column when it is copied to another df

2017-03-17 Thread Karl Schilling
Dear all: I have two data.frames A and B of the same number of rows (about 40,000). I realized that when I copy column x from data.frame A to B, the order of this column gets changed. This seems to affect only values in rownumbers > ~ 35/36,000. It also happens in any of the following three

Re: [R] add median value and standard deviation bar to lattice plot

2017-03-17 Thread Bert Gunter
If I understand you correcty, I suggest you consult a local statistician. Individual data points *cannot* have "confidence intervals." So you clearly need some statistical guidance, which is not what this list is about. Cheers, Bert Bert Gunter "The trouble with having an open mind is that

Re: [R] [FORGED] standard error for regression coefficients corresponding to factor levels

2017-03-17 Thread Doran, Harold
Just to do a better job in what is perhaps more "R-ish" w.r.t least squares calculations, here is perhaps a better example ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2, 10, 20, labels = c("Ctl","Trt"))

Re: [R-es] ebook sobre R, gratuitos donde bajar?

2017-03-17 Thread Mauricio Monsalvo
Hola. No sé si el formato es el que querés, pero a mi me resultan muy útiles: http://r4ds.had.co.nz/ https://bookdown.org/rdpeng/artofdatascience/ https://bookdown.org/rdpeng/exdata/ Otrosí: Gráficos: https://bookdown.org/paulcbauer/idv2/ Una esquelita muy útil, al menos para mi:

Re: [R] weird ggplot geom_segment behaviour

2017-03-17 Thread PIKAL Petr
Hi John Thierry already pointed me to propper direction. The key for such „zooming“ is to use coord_cartesian(xlim ...) which is stated, as I finally found, in xlim help page. Thanks Petr From: John Kane [mailto:jrkrid...@yahoo.ca] Sent: Friday, March 17, 2017 2:44 PM To: PIKAL Petr

[R-es] ebook sobre R, gratuitos donde bajar?

2017-03-17 Thread Horacio
Buenas y perdón si se preguntó antes donde es posible bajar libros sobre R en formato ebook de manera gratuita,,, Saludos y Gracias,,, ___ R-help-es mailing list R-help-es@r-project.org https://stat.ethz.ch/mailman/listinfo/r-help-es

Re: [R] weird ggplot geom_segment behaviour

2017-03-17 Thread John Kane via R-help
Hi Petr,It "seems" to be linked to the =/- 14 days that you are using for the limits. The code below should  restore one more bar. After that I don't know. p2 <- p+geom_segment(alpha=.4, size=3)+xlim(c(today()-21, today()+21))+   geom_vline(xintercept=as.numeric(today()), colour="pink", size=5)

Re: [R] weird ggplot geom_segment behaviour

2017-03-17 Thread PIKAL Petr
Dear Thierry Thanks, works great. My bad, after your advice I went through help page for xlim and found, that this behaviour is quite clearly stated there. I focused on geom_segment where I did not (obviously) find any clue. Best regards Petr > -Original Message- > From: Thierry

Re: [R] Reversing table()

2017-03-17 Thread Mark Sharp
Kevin, The short answer is no. The function table() takes in the vectors provided as arguments, counts the number of occurrences of each category by adding the integer 1L to a bin (one for each category or factor level), and at the end it returns the counts in each bin. Since it does not

Re: [R] Reversing table()

2017-03-17 Thread PIKAL Petr
Is this what you want? http://opensourceconnections.com/blog/2016/09/17/expanding-data-frequency-table-r-stata/ Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin E. > Thorpe > Sent: Friday, March 17, 2017 1:23 PM > To: r-help

Re: [R] weird ggplot geom_segment behaviour

2017-03-17 Thread Thierry Onkelinx
Dear Petr, Don't use xlim() but rather coord_cartesian(xlim = ...). See https://rpubs.com/INBOstats/zoom_in Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance

Re: [R-es] Pregunta (debate) sobre licencia R

2017-03-17 Thread javier.ruben.marcuzzi
Estimado Miguel Se entiende lo que usted dice, por estos lados todo está realizado por el IMPI, que es el organismo estatal que tiene como función la protección de lo relacionado a propiedad intelectual, registro de marcas, etc. Hay distintas formas, puse el ejemplo de un cuadro porque en una

[R] weird ggplot geom_segment behaviour

2017-03-17 Thread PIKAL Petr
Dear all I try to limit geom segment plot by xlim and encounter weird behaviour. Here is my data > dput(temp) temp <- structure(list(ukol = c("externí kalcinace", "povrchová úprava UVS30", "Testy mletí UVS30", "změna koncentrace olejových disperzí", "Mletí povrchově upravené UVS30",

[R] Reversing table()

2017-03-17 Thread Kevin E. Thorpe
I am wondering if there is a way to undo the results of table(). For example if you had a table that looked like the result of table(x, y) or table(x, y, z) is there a simple/elegant way to reverse the process to get the "original" x, y and z vectors? Thanks, Kevin -- Kevin E. Thorpe Head

Re: [R-es] Pregunta (debate) sobre licencia R

2017-03-17 Thread miguel.angel.rodriguez.muinos
Hola Javier. No hay que confundir el registro de patentes (que tiene que ver con las "invenciones") o, como lo llama vuestro INPI, "la propiedad industrial", con los derechos de autor de una obra. La Monalisa no es patentable puesto que no es una invención; es una creación artistica y, como

Re: [R-es] Pregunta (debate) sobre licencia R

2017-03-17 Thread Fernando Arce via R-help-es
blockquote, div.yahoo_quoted { margin-left: 0 !important; border-left:1px #715FFA solid !important; padding-left:1ex !important; background-color:white !important; } Puedes escribir el código que quieras y darle l licencia que quieras, siempre que no violes licencias de otros paquetes (welcome

Re: [R-es] Pregunta (debate) sobre licencia R

2017-03-17 Thread miguel.angel.rodriguez.muinos
Efectivamente, la protección y cobertura legal, frente al incumplimiento de la licencia, es la misma independientemente del tipo elegido para la obra. En caso de conflicto o incumplimiento, la última palabra la tienen las autoridades competentes. Tampoco es necesario registrarla en ningún

Re: [R-es] Pregunta (debate) sobre licencia R

2017-03-17 Thread miguel.angel.rodriguez.muinos
Hola Francisco. Todavía hoy en día existen muchas dudas sobre las licencias de software (propiedad, derechos, costes, ...). Voy a intentar hacer un pequeño resumen de cómo veo yo el tema: Por un lado está la AUTORÍA; es decir, quién es el autor intelectual de la obra en cuestión (programa y/o

Re: [R] bnlearn impute problem

2017-03-17 Thread Marco Scutari
Dear Ross, On 17 March 2017 at 06:25, wrote: > I am having a problem running the "impute" function from the bnlearn > package. I assume you referred to the online documentation instead of the manuals that come with the package? I included impute() in bnlearn 4.1,

Re: [R] [FORGED] standard error for regression coefficients corresponding to factor levels

2017-03-17 Thread Doran, Harold
A slightly more ³R-ish² way of doing S <- solve(t(X)%*%X) Is to instead use S <- solve(crossprod(X)) And the idea idea of inverting the SSCP matrix only and not actually solving the linear system is not so great, which is why it is better to do as Rolf is suggesting and get all things you need

Re: [R] add median value and standard deviation bar to lattice plot

2017-03-17 Thread Luigi Marongiu
dear Bert, the code as I read it draws 30 median lines, one for each cluster. what I am looking for is a function that will plot 190 individual confidence intervals, one for each measurement. would the code cover even that instance? regards luigi On Thu, Mar 16, 2017 at 2:41 PM, Bert Gunter

Re: [R] Percent transformation

2017-03-17 Thread Christoph Puschmann
Dear All, Thank you for helping me out. First, I am sorry for adding a HTML element. I was not aware of it. I simply copy and pasted the output of mat_data from R studio. Second, no it is not homework. It was part of a side project at work. Third, thank you Jeff. Your comment was really

[R] bnlearn impute problem

2017-03-17 Thread ross.chapman
Hi all, I am having a problem running the "impute" function from the bnlearn package. I have tried running the example in the documentation as follows: with.missing.data = gaussian.test with.missing.data[sample(nrow(with.missing.data), 500), "F"] = NA fitted =