Re: [R-es] Tasa variación diaria COVID-19

2020-03-22 Thread Javier Gómez Gonzalez
Muchas gracias a todos por su ayuda. Hace un rato antes de abrir el correo, he encontrado dos soluciones a mi problema de como calcular el porcentaje de variación. La primera es usando el paquete dplyr:

Re: [R-es] Tasa variación diaria COVID-19

2020-03-22 Thread Carlos Ortega
Hola, Te sale error porque has cargado el fichero con read.csv(). Si pruebas a cargarlo con "fread()" tus datos tendrán clase data.table. El error que obtienes es porque el objeto df (igual que datos) no es un data.table. Saludos, Carlos Ortega www.qualityexcellence.es El dom., 22 mar. 2020 a

Re: [R-es] Tasa variación diaria COVID-19

2020-03-22 Thread Javier Marcuzzi
Eric ¿Que dataset utilizo? Por curiosidad probé su código, pero me salen errores. Copio y pego todo como me sale en la consola. > # https://raw.githubusercontent.com/datasets/covid-19/master/data/time-series-19-covid-combined.csv > datos <-

Re: [R-es] Tasa variación diaria COVID-19

2020-03-22 Thread Javier Marcuzzi
Eric Gracias por compartir. Javier Marcuzzi El dom., 22 mar. 2020 a las 16:52, neo () escribió: > Hola Javier, yo lo hice de la siguiente forma: > > library(data.table) > library(ggplot2) > library(anytime) > > df <- fread("/home/neo/Desktop/rhelp/spain.csv") > df[, fec:=anytime(fec)] >

Re: [R-es] Tasa variación diaria COVID-19

2020-03-22 Thread neo
Hola Javier, yo lo hice de la siguiente forma: library(data.table) library(ggplot2) library(anytime) df <- fread("/home/neo/Desktop/rhelp/spain.csv") df[, fec:=anytime(fec)] setkey(df,com,fec)     # newc: son los nuevos casos df[, newc:=ct - shift(ct), by=.(com)]     # tasa: es la tasa de

Re: [R] cannot coerce class '"expression"' to a data.frame

2020-03-22 Thread Troels Ring
Thanks a lot - this does indeed do the trick! -Oprindelig meddelelse- Fra: peter dalgaard Sendt: 21. marts 2020 18:08 Til: Troels Ring Emne: Re: [R] cannot coerce class '"expression"' to a data.frame Oops, disregard previous... I'm no ggplot expert, but google "ggplot plotmath"

Re: [R] Fwd: Package PCMBaseCpp stops the R process on Fedora-clang

2020-03-22 Thread Jeff Newmiller
Wrong list. Way wrong. Pay attention to the Posting Guide. The correct list would be the Rcpp-devel. If your question were less specific, then r-package-devel. But absolutely not r-help. There are known issues with Rcpp being fixed right now on the fly... go read the recent archives for

[R] Fwd: Package PCMBaseCpp stops the R process on Fedora-clang

2020-03-22 Thread Venelin Mitov
Dear R-help-list, In an e-mail received yesterday from a member of the CRAN maintainer team, I was informed that the package PCMBaseCpp (https://CRAN.R-project.org/package=PCMBaseCpp) is going to be removed from CRAN on April 4th, due to an R-process crash during unit-tests on the fedora-clang

Re: [R] Error in FastTau(formula, data = d) : unused argument(s) (data = d)

2020-03-22 Thread varin sacha via R-help
Hi Rui, Many thanks... it perfectly works Best, Sacha Le dimanche 22 mars 2020 à 11:02:49 UTC+1, Rui Barradas a écrit : Correction: In MSE modmat <- model.matrix(as.formula(formula), data = d) doesn't need as.formula, it should be modmat <- model.matrix(formula, data = d)

Re: [R] No predict method for hbrfit

2020-03-22 Thread varin sacha via R-help
Hi Jeff, Hi David, Thanks for your responses. As the predict function does not work with hbrfit, I have tried  something without the predict function. There is an error message (Error in .subset2(x, i, exact = exact)) unclear to me. Many thanks for your help. # # # # # # # # # # # # # # # #

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread peter dalgaard
Or even split -> lapply -> unsplit, in cases where you want the results put back in the original order. (Doesn't matter here, but it would, had it been, say, ordered 1,2,3,1,2,2,3). -pd > On 22 Mar 2020, at 08:44 , Deepayan Sarkar wrote: > > Another possible approach is to use split ->

Re: [R] Error in FastTau(formula, data = d) : unused argument(s) (data = d)

2020-03-22 Thread Rui Barradas
Correction: In MSE modmat <- model.matrix(as.formula(formula), data = d) doesn't need as.formula, it should be modmat <- model.matrix(formula, data = d) Sorry, rui Barradas Às 09:59 de 22/03/20, Rui Barradas escreveu: Hello, 1. There is no need to install package 'boot', it's a base

Re: [R] Error in FastTau(formula, data = d) : unused argument(s) (data = d)

2020-03-22 Thread Rui Barradas
Hello, 1. There is no need to install package 'boot', it's a base package. 2. The question. The problem is that FastTau returns an object of class "list" and there is no 'predict' method for lists, you will have to define your own. This is easy, it's just a matrix multiply. And you are not

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Rolf Turner
On 22/03/20 8:44 pm, Deepayan Sarkar wrote: Another possible approach is to use split -> lapply -> rbind, which I often find to be conceptually simpler: d <- data.frame(Serial = c(1, 1, 2, 2, 2, 3, 3), Measurement = c(17, 16, 12, 8, 10, 19, 13)) dlist <- split(d, d$Serial)

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Deepayan Sarkar
Another possible approach is to use split -> lapply -> rbind, which I often find to be conceptually simpler: d <- data.frame(Serial = c(1, 1, 2, 2, 2, 3, 3), Measurement = c(17, 16, 12, 8, 10, 19, 13)) dlist <- split(d, d$Serial) dlist <- lapply(dlist, within, { Serial_test

Re: [R] [FORGED] Grouping Question

2020-03-22 Thread Rolf Turner
On 22/03/20 4:01 pm, Thomas Subia via R-help wrote: Colleagues, Here is my dataset. Serial Measurement Meas_test Serial_test 1 17 failfail 1 16 passfail 2 12 passpass 2 8

Re: [R] Grouping Question

2020-03-22 Thread Chris Evans
Here's a very "step by step" example with dplyr as I'm trying to teach myself the Tidyverse way of being library(dplyr) # SerialMeasurementMeas_testSerial_test # 117failfail # 116passfail # 2

Re: [R] Grouping Question

2020-03-22 Thread Ivan Krylov
On Sat, 21 Mar 2020 20:01:30 -0700 Thomas Subia via R-help wrote: > Serial_test is a pass, when all of the Meas_test are pass for a given > serial. Else Serial_test is a fail. Use by/tapply in base R or dplyr::group_by if you prefer tidyverse packages. -- Best regards, Ivan