combineDataframes: Function to combine data by condition (e.g. mutant vs wild...

View source: R/combine_analyses.R

combineDataframesR Documentation

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 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

when output = "all", both 'finalframe' and 'originaldata' will be in the output list. when output = "finalframe" or "originaldata", only the given data will be in the output list.

Value

finalframe

concatenated dataframe with columns "condition" and/or "channel" added

originaldata

the input list of dataframes with columns "condition" and/or "channel" added

Author(s)

Renske van Raaphorst

Examples

## Not run: 

##download example data from https://veeninglab.com/f/example_data.zip:

##VanFL_objDM.rda
##VanFL_objWT.rda

load("VanFL_objDM.rda")
load("VanFL_objWT.rda")

##find the data documentation on https://veeninglab.com/bactmap

combined <- combineDataframes(list(VanFL_objDM, VanFL_objWT),
                              listofconditions = list("mutant", "WT""))

## End(Not run)

vrrenske/shinyspots documentation built on Oct. 28, 2023, 12:26 p.m.