Unused argument error in SD code

Hi I'm trying to determine the standard deviation of one continous variable for a subset of a population that does not have a specific confounding variable.
What is wrong my code here? This is coming up with the "unused argument" error message.

sd(hers$glucose, subset=hers$D==0)

Try

xx  <- subset(hers, hers$D == 0)
sd(xx$glucose)

or using tidyverse

hers  %>% filter(D ==  0) %>%  summarize(ss = sd(glucose))

I'm not understanding how this factors in the first variable of hers$glucose. (And the tidyverse part looks like a cat walking across a keyboard to me-I don't understand how this works).

My fault. I was running through a test case and pasted the wrong code.

I'll correct it.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.