В Thu, 22 Aug 2024 08:46:03 +0200 SIBYLLE STÖCKLI via R-help <r-help@r-project.org> пишет:
> rr2s <- stack(r, r2,s) > > names(rs) <- c('r', 's', 'r2') > > Error in `names<-`(`*tmp*`, value = c("r", "s", "r2")) : > > incorrect number of layer names The error must be happening because the variable named 'rs' in your workspace originates from some other code you have previously run. The code "works" if you replace names(rs) by names(rr2s), but the plot isn't very useful because d$s are real numbers in this example and they don't form groups for d$r. Are you interested in a boxplot where the boxes are grouped by two, one for 'r' and one for 'r2'? I'm sure they are not impossible to produce manually using the boxplot function, but the 'lattice' or 'ggplot2' packages would make them much easier. You will need to reshape your data into long format, with the "value" column for the r/r2 value, the "kind" column saying "r" or "r2", and the "s" column: https://stackoverflow.com/q/20172560 -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.