Nothing
## ---- echo = FALSE--------------------------------------------------------------------------------
knitr::opts_chunk$set(
collapse = TRUE,
comment = " # "
)
options(width =100)
## -------------------------------------------------------------------------------------------------
d <- data.frame(x = c(1, NA))
print(d)
## ----eval=FALSE-----------------------------------------------------------------------------------
# d$x_isNA <- is.na(d$x)
## -------------------------------------------------------------------------------------------------
library("dplyr")
packageVersion("dplyr")
mutate(d, x_isNA = is.na(x))
## -------------------------------------------------------------------------------------------------
cname <- "x" # column we are examining
rname <- paste(cname, "isNA", sep= '_') # where to land results
print(rname)
## ---- eval=FALSE----------------------------------------------------------------------------------
# d[[rname]] <- is.na(d[[cname]])
## -------------------------------------------------------------------------------------------------
# wrapr::let solution
wrapr::let(alias = list(cname = cname, rname = rname),
expr = {
mutate(d, rname = is.na(cname))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.