The goal of medpsytueR is to provide an easy way of sharing functions commonly used in the Insitute of Medical Psychology. Feel free to contribute to this package, and don't forget to add a short description below.
You can install medpsytueR from GitHub with:
# install.packages("devtools")
devtools::install_github("medpsytuebingen/medpsytueR")
clean_cases
: this function will exclude data from subjects with any missing values
in a specified column.
df_nomiss <- clean_cases(df, id, value)
load_calorimetry
: will import all files from the calorimeter, so long they all
follow the same naming convention. For example for files named "study-id-session", e.g. insuso-03-N3:
df <- load_calorimetry(path = "myproject/data", col_names = c("study", "id", "condition"))
load_excel
: will import all sheets from an excel file into separate dataframes. You can specify sheets to skip with the skip_sheets
argument. This function only works properly if all sheets are perfectly tabular, without any special formatting. Make sure the
spreadsheet is clean before attempting to import.
load_excel(path = "myproject/data/allmydata.xlsx", skip_sheets = c("README", "intermediate_calc"))
load_pvt
: will import all .dat files with data from an ePrime Psychomotor Vigilance Task into a single dataframe, so long they all follow the same naming convention. For example for files named "study-id-session", e.g. insuso-03-N3:
df <- load_pvt(path = "myproject/data", col_names = c("study", "id", "condition"))
load_rat_eeg
: will import all .txt files with data from sleep scoring with Spike2.
df <- load_rat_eeg(path = "myproject/data", col_names = c("study", "id", "condition"))
export_list
: this function is useful for exporting multiple data frames, for
example after an initial data cleaning step.
## gather your data frames into a list
l <- mget(c("rat_eeg_clean",
"digit_span",
"pvt_clean"))
## export into individual CSV files
export_list(list = l, folder = "clean_data/", format = "csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.