dunlin
provides a variety of data tools to reformat and manipulate a subset of the tables in a data set.
# install.packages("pak")
pak::pak("insightsengineering/dunlin@*release")
Alternatively, you might also use the development version.
# install.packages("pak")
pak::pak("insightsengineering/dunlin")
library(dunlin)
df1 <- data.frame(
"id" = c("a", "b", NA, "a", "k", "x"),
"id2" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
"val" = letters[1:6]
)
df2 <- data.frame(
"id" = c("a", "b", NA, "a", "k", "x"),
"id2" = factor(c("f1", "f2", NA, NA, "f1", "f1")),
"num" = 1:6
)
db <- list(df1 = df1, df2 = df2)
prop_db <- propagate(db, "df1", "val", c("id", "id2"))
new_format <- list(
df1 = list(
id = rule("No ID available" = c("", NA, "<Missing>")),
id2 = rule("<Missing>" = c("", NA, "<Missing>"))
)
)
res <- reformat(prop_db, new_format, .na_last = TRUE)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4