[R] bootstraping by groups

Marna Wagley m@rn@@w@g|ey @end|ng |rom gm@||@com
Tue Mar 22 21:45:14 CET 2022


Hi All,
I have many classes and was trying to estimate the value using a
bootstrapping approach for each group with the following code. However, it
did not work when I added a group in the code. Do you have any suggestions?
thanks,


bootprop <- function(data, index){
  d <- data[index, ]
  sum(d[["BothTimes"]], na.rm = TRUE)/sum(d[["onlyoneTime"]], na.rm = TRUE)
}

daT %>%
  group_by(year) %>%
  boot.pop. <- boot(daT, bootprop, 999) %>%
boot.pop.$t0)

	[[alternative HTML version deleted]]



More information about the R-help mailing list