[R] [FORGED] bootstrapping results in table format
Rolf Turner
r.turner at auckland.ac.nz
Sat Oct 7 22:32:36 CEST 2017
On 07/10/17 12:16, Peter Wagey wrote:
> Hi R users,
> I was struggling to put the results into table format. Would you mind to
> show using following data and code how we can put the results into table? I
> further would like to have a confidence interval for each group.
>
>
> set.seed(1000)
> data <- as.data.table(list(x1 = runif(200), x2 = runif(200), group =
> runif(200)>0.5))
> data.frame(data)
> head(data)
> stat <- function(x, i) {x[i, c(m1 = mean(x1))]}
> A<-data[, list(list(boot(.SD, stat, R = 10))), by = group]$V1
(1) Don't post in html.
(2) Don't send code that makes use of packages that you don't mention
(in this case "data.table").
(3) Don't use "data" as the name of a data object. There is a base
function called "data" whence you run the risk of getting toadally
incomprehensible error messages as the result of certain syntax errors.
Also see fortune("dog").
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help
mailing list