Hi,


I am trying to calculated various summary statistics using the dcast
function
of reshape2. This works perfectly for getting the mean, sum, length, sd. But
when I want to calculate the median I get an error. I tried it with and
without removing
NAs:

my_median <- function(x) median(x, na.rm = FALSE)
median_df <- dcast(patch_stats_dfm,formula=species~input+barriers,my_median)

Error in vapply(indices, fun, .default) : values must be type 'integer',
 but FUN(X[[1]]) result is type 'double'

What does this error mean and what is causing the error, resp. how can I
solve the problem and
get a median?

/Johannes

	[[alternative HTML version deleted]]

