Combining Dataframes - veeninglab/BactMAP GitHub Wiki

Function to combine data by condition (e.g. mutant vs wild type) and/or channel (e.g. GFP/RFP), meant for BactMAP imported data.

Description

The function adds a column “condition” and/or “channel” to each dataframe in the given listofdataframes, after which it concatenates all dataframes. If not all columns in the dataframes match, it discards the columns which don’t match. The function returns the concatenated dataframe “finalframe” and/or the original list of dataframes with the “condition” and/or “channel” column added to each dataframe.

Usage

combineDataframes(listofdataframes, listofconditions, listofchannels, output="finalframe")

Arguments

  • listofdataframes list of dataframes of which the common columns need to be combined

  • listofconditions list of conditions corresponding to each dataframe. Needs to have the same order and length as listofdataframes.

  • listofchannels list of channels corresponding to each dataframe. Needs to have the same order and length as listofdataframes.

  • output either "all", "originaldata" or (default) "finalframe"; indicating what is returned in the output list (see Value below).

Value

  • finalframe concatenated dataframe with columns “condition” and/or “channel” added

  • originaldata the input list of dataframes with columns “condition” and/or “channel” added

Examples

GFPdata_WT <- extr.Oufti(file.choose())
RFPdata_WT <- extr.Oufti(file.choose())

RFPdata_mut  <- extr.Oufti(file.choose())
GFPdata_mut  <- extr.Oufti(file.choose())

combined <- combineDataframes(list(GFPdata_WT, RFPdata_WT, RFPdata_mut, GFPdata_mut),
                              listofconditions = list("WT", "WT", "mut", "mut"),
                              listofchannels=list("GFP", "RFP", "RFP", "GFP"))