stdev error
? Fri, 11 Mar 2022 08:14:52 -0600 "Jeff Reichman" <reichmanj at sbcglobal.net> ?????:
I get the following error:
Error: `stdev` refers to a variable created earlier in this summarise(). Do you need an extra mutate() step?
I suspect it is because the standard deviation of a length-one vector is NA and R is errorerrors out on the standard deviation of 1.
My interpretation of the error message is that summarise() thinks that you're creating a variable (Bse_ftv = mean(Bse_ftv)) and then asking summarise() to compute its standard deviation (stdev = sd(Bse_ftv)) in the same call. This is apparently not always supported, according to ?summarise [1]. You know that you meant the previously available Bse_ftv column, not the newly created Bse_ftv = mean(Bse_ftv), but this is not how the call is interpreted. Try setting a different name for the result of mean(Bse_ftv).
Best regards, Ivan [1] https://search.r-project.org/CRAN/refmans/dplyr/html/summarise.html