## ----------------------------------------------------------------------------- #| echo: false #| output: false library(dplyr) library(amp.dm) ## ----------------------------------------------------------------------------- #| echo: true #| output: true library(dplyr) library(amp.dm) xmpl <- system.file("example/NM.theoph.V1.csv",package="amp.dm") # The read data function can read most common formats, for less common formats # a manual function can passed to enable documenting the process dat <- read_data(xmpl, comment="Read example data") # We can filter data with logging dat2 <- filterr(dat,STIME<2, comment = "remove time-points") %>% select(ID,STIME) %>% mutate(FLAG=1) # We can also join with logging dat3 <- left_joinr(dat2, dat, comment = "example join") ## ----------------------------------------------------------------------------- #| echo: true #| output: true get_log() ## ----------------------------------------------------------------------------- #| echo: true #| output: false cmnt("**Be aware** that *ID 1* is removed using `subset`") dat4 <- subset(dat,ID!=1, select=-BMI) srce(BMI,c(dat4.WEIGHT,dat4.HEIGHT),'d') dat4$BMI <- dat4$WEIGHT/(dat4$HEIGHT)^2 ## ----------------------------------------------------------------------------- #| echo: true #| output: asis # Note it is easier to directly use inline code, e.g.: `r cmnt_print()` cat(cmnt_print()) ## ----------------------------------------------------------------------------- #| echo: true #| output: true # This is also available in tabulation functions e.g. define_tbl get_log()$srce_nfo ## ----------------------------------------------------------------------------- general_tbl(data.frame(result="this is a test"))