Skip to content
Prev 390972 / 398506 Next

stdev error

Hallo

with(my_tbl, aggregate(Bse_bwt, list(Cat), function(x) c(n=length(x), mean=mean(x), st_dev=sd(x))))

Or am I missing something?

Cheers
Petr


-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Chris Evans
Sent: Friday, March 11, 2022 3:22 PM
To: reichmanj at sbcglobal.net
Cc: r-help at r-project.org
Subject: Re: [R] stdev error

Can't see your data but perhaps:

my_tbl %>%
  mutate(Bse_bwt = round(Bse_bwt * 2) / 2) %>%
  group_by(Cat, Bse_bwt) %>%
  summarize(count = n(),
     Bse_ftv = mean(Bse_ftv),
     stdev = if_else(count > 1,
                     sd(Bse_ftv),
                     NA_real_))


----- Original Message -----
--
Chris Evans (he/him) <chris at psyctc.org> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor, University of Roehampton, London, UK.
Work web site: https://www.psyctc.org/psyctc/
CORE site:     https://www.coresystemtrust.org.uk/
Personal site: https://www.psyctc.org/pelerinage2016/
OMbook:        https://ombook.psyctc.org/book/

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch partner? PRECHEZA a.s. jsou zve?ejn?ny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner?s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
D?v?rnost: Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a podl?haj? tomuto pr?vn? z?vazn?mu prohl??en? o vylou?en? odpov?dnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/