Re: [R] Creating a conditional lag variable in R

2019-07-27 Thread Faradj Koliev
Re-post, now in *plain text*. Dear R-users, I’ve a rather complicated task to do and need all the help I can get. I have data indicating whether a country has signed an agreement or not (1=yes and 0=otherwise). I want to simply create variable that would capture the years before the agree

Re: [R] [FORGED] Re: Regarding R licensing usage guidance

2019-07-27 Thread Bob Rudis
Hey Anamika, I only caught the tail end of what became an off-topic thread, but backed up a bit to your original q. If I'm duplicating anything previous, apologies. If you are going to ship your "product" to end users directly (vs provide via an API or web application) I'm not sure how you get

Re: [R] Creating a conditional lag variable in R

2019-07-27 Thread peter dalgaard
Some pointers (not tested, may contain blunders...) (a) you likely need some sort of split-operate-unsplit construct, by country. E.g., myfun <- function(d) {operate on data frame with only one country} ll <- split(data, data$country) ll.new <- lapply(ll, myfun) data.new <- unsplit(ll.n

Re: [R] Creating a conditional lag variable in R

2019-07-27 Thread Faradj Koliev
Peter Dalgaard, Thanks for this. I’ll try to think of ways to apply this logic. At the moment, I’m trying to do this with “mutate” using dplyr package. But it’s not easy.. > On 27 Jul 2019, at 10:33, peter dalgaard wrote: > > Some pointers (not tested, may contain blunders...) > > (a) you

Re: [R] Creating a conditional lag variable in R

2019-07-27 Thread Faradj Koliev
Thank you all. I now have the right solution for this (perhaps of interest to some): check_pre <- function(idx, k) { pre_vec <- sapply(1:length(idx), function(x) +any(idx[x:(pmin(x + k, length(idx)))] %in% 1)); pre_vec[idx == 1] <- 0; return(pre_vec) } df %>% group_by(country) %>% mutate(

[R] Modelos neural netwok

2019-07-27 Thread Agustín Alonso Rodriguez
Estimados miembros de la Lista: Me dirijo a vosotros para que, si pod�is, ilumin�is mi confusi�n. Estoy trabajando con los modelos neural netwok del libro Forecasting, Principles and Practice, de Hyndman y Athanasopoulos, segunda edici�n. Mi confusi�n se debe al hecho de que para trabajar

[R] mapply, quantmod::chart_Series, MoreArgs error with chart_pars(), chart_theme()

2019-07-27 Thread Anuj Goyal
R version 3.6.0 (2019-04-26) on Mac 10.14.5 What is the proper way to pass chart_pars() as well as chart_theme() into MoreArgs for use in quantmod::chart_Series? p.txt === s,n ABBV,AbbVie BMY,Bristol sof.r === # R --silent --vanilla < sof.r library(quantmod) options("getSymbols.warning4.

Re: [R] Modelos neural netwok

2019-07-27 Thread Rui Barradas
Hello, This is an English language list, please ask questions in English. As for the question, package fpp2 is a package described as Data for "Forecasting: principles and practice" (2nd ed, 2017) And in fact there are no examples in the package. If you are talking about examples in t

Re: [R] Modelos neural netwok

2019-07-27 Thread Richard O'Keefe
Splitting a data set into a part to be used for fitting a model (the training set) and a part to be used for evaluating the quality of the model on new cases (the test set) has been good practice for a long time. If the architecture of the model is to be learned as well as parameters, a three-way

Re: [R] Survey Data - comparing multiple groups

2019-07-27 Thread Abby Spurdle
> I would like to be able to get p-values between the groups and be able to adjust for multiple comparisons and would appreciate if someone can guide me. > I did convert my df into a svrepdesign object as follows: > > df<-svrepdesign (data=df1, scale=1, repweights = df1[, 496:995], type="BRR", com

Re: [R] CoxPH multivariate frailty model with coxph (survival)

2019-07-27 Thread David Winsemius
On 7/19/19 10:19 AM, Denise b wrote: Dear R users, I am interested in estimating the effects of a treatment on two time-to-event traits (on simulated data), accounting for the dependency between the two time-to-event outcomes. I precise that the events are NOT recurrent, NOT competitive, NO