stRoke 23.9.1
Functions:
-
NEW:
chunks_of_n()usessplit()to separate supplied vector or data frame into chunks of n. Flags to set if all but the last chunks should be exactly size n, or if they should be evenly sized of max n. Labels can be provided including regex pattern for subject naming to include in chunk names. -
NEW:
n_chunks()is the opposite ofchunks_of_n()and is simply a wrapper for this function to create list of n chunks based of provided vector or data frame. -
NEW:
str_extract()will extract the substring of a character string given by a regex pattern. Came to be as a helper function for labelling chunks inchunks_of_n(), but will be useful on its own. Other functions doing the same exists, but this is my take only using base R. Draws onREDCapCAST::strsplitx(), where splits can be performed around a pattern. -
NEW:
add_padding()was created out of frustration. I wanted to add padding usingsprintf("%0s",string), in examples for the above, but it would fail when rendering on Windows. Say hello to another function. Just very small. Defaults to adding leading zeros, to get all string to equal length with the longer string supplied. -
Deprecation:
ds2dd()moved toREDCapCAST::ds2dd()as this is where it belongs.