Displaying 1 result from an estimated 1 matches for "patch_stats_dfm".
2013 Jun 26
1
Error when using median as aggregation function in dcast
...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
[[a...