Description Usage Arguments Examples
View source: R/filename_extension.R
Iterates through the provided list of files (alphabetically). If a filename has part length length_with_extension (as defined by strsplit using "_"), it is assigned as having an extension/appendix. This function takes the identified extension/appendix part of the filename and appends it to following filenames identified as missing an extension/appendix. Designed for triplicate files in which first file of each group is comprehensively labelled and the others are not, but should work with any number of replicates, provided the filepath contains them in the correct order.
1 2 | filename_extension(filepath = ".", length_with_extension = a,
length_noextension = b, verbose = TRUE)
|
filepath |
Path to files. Defaults to current directory. |
length_with_extension |
Number of parts to the basename of a file WITH an extension after splitting by "_". Defaults to a. |
length_noextension |
Number of parts to the basename of a file WITHOUT an extension after splitting by "_". Defaults to b. |
verbose |
Logical. Should it print descriptions of any changes? |
1 2 3 4 | folder <- "FCS_trimmed"
a <- length( unlist(strsplit(basename(list.files(folder)[1]), "_")) )
b <- length( unlist(strsplit(basename(list.files(folder)[2]), "_")) )
filename_extension(filepath = folder, length_with_extension = a, length_noextension = b)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.