View source: R/Deprecated.Functions.R
convert.tsv.data | R Documentation |
Fix NA issue in dataframes imported by the new read.simple.tsv. Set na_rep to NA if you want to keep NA-s
convert.tsv.data(df_by_read.simple.tsv, digitz = 2, na_rep = 0)
df_by_read.simple.tsv |
Data frame (e.g. by read.simple.tsv). |
digitz |
Number of digits when rounding up, Default: 2 |
na_rep |
Replace NA?, Default: 0 |
#' @title write.simple.xlsx.old
#' @description Write out a list of matrices/ data frames WITH ROW- AND COLUMN-
#' NAMES to a file with as an Excel (.xslx) file. Your output filename will be
#' either the variable's name. The output file will be located in "OutDir"
#' specified by you at the beginning of the script, or under your current
#' working directory. You can pass the PATH and VARIABLE separately (in
#' order), they will be concatenated to the filename.
#' @param named_list A list of data frames to write out
#' @param suffix A suffix added to the filename, Default: NULL
#' @param fname A string for a manually defined filename. Default: substitute(named_list)
#' @param o Set to TRUE to open file after writing out using 'system(open ...)' on OS X., Default: FALSE
#' @param TabColor Tab Color in Excel, Default: 'darkgoldenrod1'
#' @param Creator Creator, Default: ”
#' @param HeaderCex Header color, Default: 12
#' @param HeaderLineColor Header line color, Default: 'darkolivegreen3'
#' @param HeaderCharStyle Header character style, Default: c("bold", "italic", "underline")1
#' @param row_names Have rownames? Default: TRUE
#' @param ... Multiple simple variables to parse.
#' @examples
#' ## Not run:
#' if(interactive()){
#' # write.simple.xlsx(my.list.of.data.frames)
#' }
#'
## End(Not run)
#' @seealso
#' write.xlsx
#' @export
#' @importFrom openxlsx write.xlsx createStyle
write.simple.xlsx.old <- function(named_list , filename = substitute(named_list) , suffix = NULL , o = FALSE , TabColor = "darkgoldenrod1", HeaderLineColor = "darkolivegreen3" , HeaderCex = 12, Creator = "" , HeaderCharStyle = c("bold", "italic", "underline")1 , row_names = TRUE, ...)
warning("Switched using from openxlsx to readxl package 2023.11.22")
fname <- Stringendo::sppp(filename, suffix) if ( !('list' %in% class(named_list)) ) named_list <- list(named_list) # convert to a list if needed
if (nchar(fname) > 100) fname <- kpp('_Output', idate()) FnP <- kpp(kpps(getwd(), fname), "xlsx")
hs <- openxlsx::createStyle(textDecoration = HeaderCharStyle, fontSize = HeaderCex , fgFill = HeaderLineColor)
if (row_names) FUNX <- function(x) rownames_to_column(as.data.frame(x), var = "genes") named_list <- lapply(named_list, FUNX) # named_list <- rownames_to_column(as.data.frame(named_list), var = "genes") print(named_list) print(rownames(named_list))
openxlsx::write.xlsx(x = named_list, file = FnP, rowNames = FALSE , firstRow = TRUE , firstCol = TRUE , colWidths = "auto" , headerStyle = hs, tabColour = TabColor, creator = Creator) if (o) system(paste0("open ", fix_special_characters_bash(FnP)), wait = FALSE) # fun
na.replace
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.