Description Usage Arguments Details Author(s) Examples
View source: R/generate_adj_matrix.R
Generates a blank adjacency matrix from a specified string
1 | generate_adj_matrix(string_data, data_separator = ",", remove_spaces = F)
|
string_data |
The 'string_data' argument is the string from which the unique values and matrix will be generated. |
data_separator |
The 'data_separator' argument is the chracter separating specified substrings in the given string. Default is ','. |
remove_spaces |
The 'remove_spaces' argument will remove spaces from the header values (thus disrupting the search unless all spaces are removed in the given string in next steps). This is useful for separating strings with an irregular number of spaces between the same substrings. |
Generates an adjacency matrix from a given string. Detects unique values and generates a blank matrix with colnames and rownames of each unique value in supplied string. Data must be provided as a character string.
Tom Drake
1 2 3 4 5 6 7 8 9 10 11 | ##Example
library(String2AdjMatrix)
#Start with character string to generate an adjacency matrix from
string_in = c('apples, pears, bananas', 'apples, bananas', 'apples, pears')
#Generate a new blank matrix
blank_matrix = generate_adj_matrix(string_in)
#Now fill the matrix
string_2_matrix(blank_matrix, string_in)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.