#' Add soomo_id to tidied SNHU data
#'
#' Allows users to add the soomo_id of students whose USER_PK1 value is known
#'
#' Returns the original tidied SNHU assignments dataframe with the soomo_id added. This is a necessary step before analytics
#' data from the admin space can be attached.
#'
#' @param snhu_assignments An object. This is null by default and if using the pipe is not necessary. If NOT using the pipe
#' this is the name of the object containing the tidied SNHU assignments dataframe.
#' @param file_name A text string. This is the name of the .csv file that contains the mapping between USER_PK1 and soomo_id. If
#' you follow the convention of naming this file "user_pk1_to_soomo_id.csv", you won't need to input this.
#' @param pk1_name A text string. This is the name of the column in your mapping that contains the SNHU Blackboard USER_PK1 value.
#' If this is already named "USER_PK1" you will not need to input this.
#' @param soomo_name A text string. This is the name of the column in your mapping that contains the soomo_id value.
#' If this is already named "soomo_id" you will not need to input this.
#' @import dplyr
#' @import tidyr
#' @export
snhu_add_soomo_id <- function(snhu_assignments = NULL, file_name = "user_pk1_to_soomo_id.csv", pk1_name = "USER_PK1", soomo_name = "soomo_id"){
look_up_table <- read.csv(file_name, header = TRUE, sep = ",", quote = "\"")
if(!is.null(snhu_assignments)){
left_join(snhu_assignments, look_up_table, by = "USER_PK1") %>%
distinct()
} else {
left_join( , look_up_table, by = "USER_PK1") %>%
distinct()
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.