#' idd_interviews
#'
#' Read in the IDD interview notes and transform it into an easier-to-use format
#' @param file The file name
#' @param method Whether 'excel' or 'google_sheets'
#' @param names The names of the team members interviewed (should correspond to the columns)
#' @param team What function in Neugelb
#' @param location Where do they work
#' @param date The date of the interview
#' @param confluence_url The URL of the interview on Confluence
#' @param sheet_nr The worksheet number
#' @export
idd_interviews <- function(file,method,names,team,location,date,confluence_url,sheet_nr = 1) {
require(tidyverse)
require(neugelbtools)
require(readxl)
require(googlesheets)
require(lubridate)
if (method == 'excel') {
idd <- read_excel(file)
} else if (method == 'google_sheets') {
idd <- gs_quickread(file,ws_nr = sheet_nr)
}
idd <- idd %>%
tidycols() %>%
fill(topic,.direction = 'down') %>%
fill(questions,.direction = 'down')
idd_names <- tibble(names = names,
col_nr = seq(3,2+length(names),by=1))
idd2 <- tibble()
for (i in 1:nrow(idd_names)) {
temp <- idd_format(idd,idd_names$col_nr[[i]],idd_names$names[[i]])
idd2 <- bind_rows(idd2,temp)
}
idd2 <- idd2 %>%
mutate(neugelb_function = team,
interview_location = location,
interview_team = paste(location,team,sep=' '),
interview_date = as_date(date),
interview_url = confluence_url,
id = paste(str_replace(str_to_lower(interviewee),' ','_'),question_nr,sep='_'))
ids <- idd2 %>%
distinct(id) %>%
pull()
idd3 <- tibble()
for (i in 1:length(ids)) {
a <- idd2 %>%
filter(id == ids[[i]])
answer <- a %>%
pull(answers)
b <- paste(answer[!is.na(answer)],collapse = "\n")
c <- a %>%
mutate(answers = b) %>%
distinct()
idd3 <- bind_rows(idd3,c)
}
return(idd3)
}
#' idd_format
#'
#' Format the IDD interview
#' @param df The data frame
#' @param col_nr The column number
#' @param name The employee name
#' @export
idd_format <- function(df,col_nr,name) {
questions <- df %>%
distinct(questions) %>%
mutate(question_nr = row_number())
df2 <- df %>%
select(1:2,col_nr) %>%
rename(answers = 3) %>%
mutate(interviewee = name) %>%
left_join(questions,by='questions')
return(df2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.