0

Reshape from wide to long format

Diasorin %>%
pivot_longer(
everything(),
names_to = c("ID", "ID"),
names_pattern = "(.)()"
)
g2 <- function(x)
{round(c(MEAN=mean(x,na.rm=TRUE),MEDIAN=median(x,na.rm=TRUE),
MIN=min(x,na.rm=TRUE),MAX=max(x,na.rm=TRUE),
CV=100*sd(x)/mean(x),SD=sd(x,na.rm=TRUE)),1)}
summarize(value, by=low, FUN=g2)

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'mean': object 'value' not found

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • 2
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. You are calling `summarize(value, by=low, FUN=g2)` but `value` is not defined anywhere. – MrFlick Feb 06 '22 at 01:52
  • What's the question? – camille Feb 07 '22 at 01:13
  • Please provide enough code so others can better understand or reproduce the problem. – Community Feb 12 '22 at 01:11

0 Answers0