drawMap: Generate a ggplot object of a plate plan

Description Usage Arguments Value Examples

View source: R/fct_draw_map.R

Description

Function to plot the input dataframe containing the Sample names, the Row, Column coordinates, the group and the status

Usage

1
drawMap(df, sample_gps, gp_levels, plate_lines, plate_cols, project_title)

Arguments

df

dataframe containing user data and special wells if any.

sample_gps

number of distinct groups in the file before adding the special wells to df

gp_levels

is Group column levels before adding the special wells to df

plate_lines

integer, number of plate's lines

plate_cols

integer, number of plate's columns

project_title

character, the user's project title

Value

g, a ggplot object corresponding to the generated plate map.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# example of data containing 5 biological samples, 2 forbidden wells,
# 2 buffers and 3 not random wells
user_data <- data.frame("Sample" = c(as.character(seq_len(5)), rep_len(NA, 7)),
                        "Group" = c(c("A","B","C","A","B"),
                                    rep_len("forbidden", 2),
                                    rep_len("buffer", 2),
                                    rep_len("fixed", 3)),
                        "ID" = c(seq_len(5),rep_len(NA,7)),
                        "Well" = c("A2","B3","C3","B4","A3","A1","A4","B2","C2","B1","C1","C4"),
                        "Status" = c(rep_len("toRandom", 5),
                                     rep_len("forbidden", 2),
                                     rep_len("buffer", 2),
                                     rep_len("fixed", 3)),
                        "Row" = c(1,2,3,2,1,1,1,2,3,2,3,3),
                        "Column" = c(2,3,3,4,3,1,4,2,2,1,1,4))
p <- "My Project"
gp_lvl <- levels(as.factor(c("A","B","C")))
drawMap(df = user_data, sample_gps = 3, gp_levels = gp_lvl, plate_lines = 3,
        plate_cols = 4, project_title = p)

# also works when giving a plate with more wells than the number of samples to place.
drawMap(df = user_data, sample_gps = 3, gp_levels = gp_lvl, plate_lines = 8,
        plate_cols = 12, project_title = p)

HelBor/wpm documentation built on June 15, 2021, 4:16 p.m.