Warning: Unknown or uninitialised column

I had datframe (pls see image)


and here my code

data1 <- lien2 %>% dplyr::filter(Age <=10)

cilogimmunity <- function(data1, ...) {
GMC = sum(data1$Immunity, na.rm = TRUE)
meanGMC = mean(data1$Immunity, na.rm = TRUE)
dplyr::tibble(
GMC = GMC,
meanGMC = meanGMC
)
}

cilogimmunity(trial)

This is result:
Warning: Unknown or uninitialised column: Immunity.
Warning: Unknown or uninitialised column: Immunity.
Warning in mean.default(data1$Immunity, na.rm = TRUE) :
argument is not numeric or logical: returning NA

Pls help me to slove this problems

Hello. If you could provide a reproducible example , that would allow us to better assist you.

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.