I am getting this error
'Error: Argument 1 must have names'
can somebody help?
temp <- data.frame()
for (i in 2:3){
temp <- rbind(temp,without_first %>% filter(sz==i) %>% samp(i,replace=TRUE))
}
Data structure
id timepoint size
1001 time30 2
1001 time60 2
1001 time90 2
1002 time60 1
1002 time90 1
I am trying to randomly select 2 observations for id=1001,1 observations for id=1002 etc.I have many such subjects in dataset. My code which is given above is not working. Can someone suggest code in R ?
I have also tried
data<-%>% group_by(id)%>%sample_n(size,replace=TRUE)
does not work.Please suggest some code in R ?