Although it seems to be pretty weird to enter a numeric vector of length one
that is not an integer as the first argument to sample(), the results do not
seem to match what is documented in the manual. In addition, the results below
do not support the use of round rather than truncate in the doc
A potential solution, at least in terms of producing the desired output, is the
base R function alist:
> alist(1+2, "a", rnorm(3))
[[1]]
1 + 2
[[2]]
[1] "a"
[[3]]
rnorm(3)
> str(alist(1+2, "a", rnorm(3)))
List of 3
$ : language 1 + 2
$ : chr "a"
$ : language rnorm(3)
luke
[[altern
Be aware that the object that aggregate returns with bar() is more complicated
than you think.
str(aggregate(iris$Sepal.Length, by = list(iris$Species), FUN = bar))
'data.frame': 3 obs. of 2 variables:
$ Group.1: Factor w/ 3 levels "setosa","versicolor",..: 1 2 3
$ x : num [1:3, 1:2] 5.