ATTENTION: Be careful, there is no coming back from the effects of this function. It only works for hashed tags.
normalize_hashtags()
lower case and remove accents and non-alphanumeric
characters from hashtags.
normalize_hashtags(dir = utils::choose.dir(), tag_line = 1)
(optional) a string indicating the directory of the files. This
function will look up just for files, directories will not be affected.
(default:: utils::choose.dir()
).
(optional) a number indicating the line where the tags are in.
An invisible NULL
. This function don't aim to return values.
file_name <- tempfile(tmpdir = tempfile())
dir_name <- dirname(file_name)
dir.create(dir_name)
file.create(file_name)
#> [1] TRUE
con <- file(file_name, "r+")
data <- c("#tEs43(23)ds", "#45&$dAAsad-dsade", "", "Test", "")
writeLines(data, con = con)
close(con)
normalize_hashtags(dir_name, tag_line = 1)
con <- file(file_name, "r+")
readLines(con)
#> [1] "#tes4323ds" "#45&$dAAsad-dsade" ""
#> [4] "Test" "" ""
#> [7] ""
close(con)