ap_excel: Export data from Autoimmunity Profiling analysis to excel

View source: R/ch_functions.R

ap_excelR Documentation

Export data from Autoimmunity Profiling analysis to excel

Description

Exports chosen list elemnts to sheets in an Excel-file. Default elements are based on output from ap_norm2(), and ap_reactsummary2() or ap_agresults()

Usage

ap_excel(
  x,
  elements = c("MFI", "MADS", "SCORE", "BINARY_CO", "REACTIVITIES", "FISHER",
    "DIFFERENCES", "ANTIGEN_CUTOFFS", "CUTOFF_KEY", "ANTIGENS", "SAMPLES", "COUNT"),
  filename = "DataOutput.xlsx",
  shouldround = TRUE,
  row.names = TRUE,
  save_rdata = TRUE,
  ...
)

Arguments

x

list with at least the elements to export, see Deatils for more information and exceptions to the rule.

elements

character vector of names of the list elements to export. The sheets will be ordered in the same order as the vector. Specific MAD-cutoffs are not included in the default output but can be added, eg. "25xMAD".

filename

string with filename and desired path, end with .xlsx.

shouldround

logical, if TRUE MFI values are rounded to integers and MADs to two decimals.

row.names

logical. If TRUE, the row names of the data frames are included in the Excel file worksheets. Deafult altered from WriteXLS().

save_rdata

logical. If TRUE, an RData-file is saved, containg a list matching the Excel-file content.

...

arguments passed to WriteXLS().

Details

The x list needs to include at least the elements specified under elements. It is recommended to append the output from ap_reactsummary2() or ap_agresults() to the output from ap_norm2() and use the combined list as function input.

Exceptions for input element names:
- If an element is named BEADS in the input data, its name will be changed to ANTIGENS. Therefore, ANTIGENS is a default element to export while BEADS is not.
- Sums and frequencies at the cutoffs assigned by ap_cutoff_selection2() will be combined into a new element called REACTIVITIES if the output from ap_reactsummary2() or ap_agresults() is included in the output Therefore, REACTIVITIES is a default element to export although it is not present in the input data.
- If samplegorups were provided in ap_reactsummary2() the resulting Fisher's exact test p-values and frequency differences will be extracted for the the cutoffs assigned by ap_cutoff_selection2() and formatted into the new elements FISHER and DIFFERENCES. Therefore, FISHER and DIFFERENCES are default elements to export although they are not present in the input data.

Line breaks (backslash n) in row and column names will be changed to underscore ("_").

If other list structures are used, it is most likely more convenient to just use WriteXLS(), which this function is built on.


cekehe/rappp documentation built on May 17, 2022, 8:54 a.m.