Description Usage Arguments Details Value Examples
Read in plate format data from an xlsx file and return a melted data frame with the contents and well coordinates.
1 2 | melt_plate_xlsx(file, rows, cols, sheet = 1, col_names = FALSE, ...,
.id = "content")
|
file |
A valid file path for the xlsx file. |
rows |
A numeric vector of the rows to read |
cols |
A vector of columns to be read. Can be integers or characters, see examples |
sheet |
The name or index of the sheet. |
col_names |
Boolean. Should the first non-empty row be converted to column names. |
... |
Arguments passed to |
.id |
The name of the well content column. |
A special case is when the first row of contents is empty.
The suggested pattern then is to include an extra row with column names from the Excel Sheet and set col_names = TRUE
.
So for a a 8-row plate you would include a 9-row range, see examples. This is because of behavior in
the underlying function openxlsx::read.xlsx()
that skips empty rows at the start
of a read-in region if the contents are blank.
A melted data frame.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Not run:
# generic assay with layouts in 96 well format
meta_file <- "data/plate_layouts.xlxs"
# all equivilant
melt_plate_xlsx(meta_file, rows = 2:9, cols = 2:13, sheet = 1)
melt_plate_xlsx(meta_file, rows = 2:9, cols = LETTERS[2:13], sheet = 1)
melt_plate_xlsx(meta_file, rows = 2:9, cols = "B:M", sheet = 1)
# if the first row was empty
melt_plate_xlsx(meta_file, rows = 1:9, cols = "B:M", col_names = T, sheet = 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.