#' Writes template for traits
#'
#' @return
#' @export
#'
#' @importFrom xlsx write.xlsx
#'
#'
createTraitTable <- function() {
require(xlsx)
traitsTable <- data.frame(matrix(c("id", "name", "group", 0, "N", "G"), nrow = 2, byrow = TRUE))
if(length(raw.data) > 0) {
if(readline("Should IDs be filled in? (ja/nein) ") == "ja") {
ok <- FALSE
while(!ok) {
data <- getDataFrame()
ids <- getNames(data)
ids <- modifyNames(ids)
ok <- ok("Ready to print?")
}
traitsTable[3:(length(ids) + 2), 1] <- ids
}
}
write.xlsx(traitsTable, paste(info[["working directory"]], "traits.xlsx", sep = "/"), col.names = F, row.names = F, showNA = FALSE)
if(file.exists(paste(info[["working directory"]], "traits.xlsx", sep = "/"))) {
message("Traits template written.")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.