#Function x
string_2_matrix_x <- function(new_matrix, supplied_string, coord_x = 1, self = 0){
result = list()
reference_string = colnames(new_matrix)[coord_x]
for (i in 1:length(rownames(new_matrix))){
str1 = reference_string
str2 = rownames(new_matrix)[i]
string_search = paste0('^(?=.*', str1, ')(?=.*', str2, ')')
result[[i]] = ifelse((str1 == str2), self, sum(str_count(supplied_string, string_search)))
}
return(unlist(result))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.