Vectorize all comments from the file
Usage
extract_comment(file)
remove_content_in_quotes(line)
remove_comment(line)
clean_file(file, output_file)
get_func_def(file)
Arguments
- file
file to parse
- line
string vector to remove contents within quotes or comments
- output_file
file path to write the output of the new file
Examples
if (FALSE) {
ex_file1 <- "path/file1.R"
# get all comments
cmmts <- extract_comment(ex_file1)
cmmts
}
if (FALSE) {
# Ex to clean out comments from file
file_path <- ".testR"
output_file_path <- ".cleaned_script.R"
clean_file(file_path, output_file_path)
}
# example code
if (FALSE) {
# Ex to get all defined functions
# within a file
file_path <- ".testR"
get_func_def(file_path)
}