
Last chance! 50% off unlimited learning
Sale ends in
Number of duplicates per line of (text) file. Per default saved to file which can be loaded into excel / libreoffice. With conditional formatting of the first column, colors show for each line how often it occurs in the file. A LibreOffice file is included. Note: OpenOffice does not provide color scales based on cell values.
dupes(file, ignore.empty = TRUE, ignore.space = TRUE, tofile = missing(n),
n = length(d))
File name (character string)
Should empty lines be ignored? DEFAULT: TRUE
Should leading/trailing whitespace be ignored? DEFAULT: TRUE
Logical: should output be directed to a file? Otherwise, a dataframe with line numbers and number of duplicates of that line will be printed in the console. DEFAULT: missing(n)
Show only the first n values if tofile=FALSE
. DEFAULT: length(d)
Either: a data.frame with line numbers of duplicate rows and the number of duplicates
Or: a file is written with the number of duplicates and the original file
content.
# NOT RUN {
file <- system.file("extdata/doublelines.txt", package="berryFunctions")
dupes(file, tofile=FALSE)
dupes(file, tofile=FALSE, ignore.empty=TRUE)
## These are skipped by rcmd check (opening external places is not allowed):
# }
# NOT RUN {
dupes(file)
# }
# NOT RUN {
# a template file (dupes.ods) for libreOffice Calc is available here:
system.file("extdata", package="berryFunctions")
# }
# NOT RUN {
system2("nautilus", system.file("extdata/dupes.ods", package="berryFunctions"))
# }
# NOT RUN {
# To open folders with system2:
# "nautilus" on linux ubuntu
# "open" or "dolphin" on mac
# "explorer" or "start" on windows
# }
Run the code above in your browser using DataLab