-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdevtools_history.R
37 lines (30 loc) · 1.14 KB
/
devtools_history.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require(magrittr)
c(
"MetStaT",
"kopls",
"magrittr",
"data.table",
"ggplot2",
"plyr",
"pracma",
"ggrepel"
) %>%
lapply(., usethis::use_package)
usethis::use_build_ignore("devtools_history.R")
# DATASET 1 -----------------------------------------------------------
require(data.table)
temp <- readRDS("../../BAPTISTE/CODES/_data/681024_AMOPLS.rds")
temp$variablemetadata[, varid := paste0("Var", formatC(1:.N, width = 5, format = "d", flag = "0"))]
temp$variablemetadata[, Group := ifelse(is.na(Compound), F, T)]
setnames(temp$datamatrix, temp$variablemetadata$variableid, temp$variablemetadata$varid)
temp$variablemetadata <- temp$variablemetadata[, .(varid, Group)]
col_id <- c("class", "stage", "trt")
setnames(temp$samplemetadata, c("class", "Stage", "Mouse_treatment"), col_id)
temp$samplemetadata[, (col_id) := lapply(.SD, function(x) {factor(x) %>% as.numeric()}), .SDcols = col_id]
data_sample <- temp
usethis::use_data(data_sample, overwrite = T)
# DATASET 2 -----------------------------------------------------------
library(mixOmics)
data(liver.toxicity)
usethis::use_data(liver.toxicity)
rm(temp, data_sample, col_id, liver.toxicity)