Corrected antiSocialSkip6Lines antiSocialSkip6Lines = function(filename, output = paste0(filename, '_skipped')){ lines = readLines(filename) lines = lines[-(1:6)] writeLines(lines, output) }
On 26 March 2018 at 16:06, Ogan Mancarci <ogan.manca...@gmail.com> wrote: > Thanks for the clarification. > > What about a scenario where the user has enter a filename which is used as > a seed for the output file. For instance > > antiSocialSkip6Lines = function(filename, output = paste0(filename, > '_skipped')){ > lines = readLines(filename) > lines = lines[-(1:6)] > } > > Here, there is an input from the user which determines what the output is > and it is clearly spelled out in the argument list. Yet the user input is > not the name of the resulting file unless the user wants it to be. > > Cheers, > Ogan > > On 26 March 2018 at 15:29, Uwe Ligges <lig...@statistik.tu-dortmund.de> > wrote: > >> >> >> On 26.03.2018 23:48, Ogan Mancarci wrote: >> >>> This is from CRAN repository policy: >>> >>> "Packages should not write in the user’s home filespace (including >>> clipboards), nor anywhere else on the file system apart from the R >>> session’s temporary directory (or during installation in the location >>> pointed to by TMPDIR: and such usage should be cleaned up). (…) Limited >>> exceptions may be allowed in interactive sessions if the package obtains >>> confirmation from the user." >>> >>> I am unclear about the scope of this rule. For instance if I had this >>> function: >>> >>> antiSocialWriteLines = function(text, file = 'defaultFile', ...){ >>> writeLines(text , file, ...) >>> } >>> >>> >> >> Simply use file=tempfile() as the default so you do not overwrite stuff >> in the user filespace and the user can insert another filename which is the >> confirmation. >> >> Best, >> Uwe Ligges >> >> >> >> would I be allowed to add it to a package since it writes to a file by >>> default without asking for confirmation? >>> >>> Frankly reading this text, I feel like even writeLines itself violates it >>> as it writes without "confirmation" once you give it a file path. >>> >>> [[alternative HTML version deleted]] >>> >>> ______________________________________________ >>> R-package-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-package-devel >>> >>> > [[alternative HTML version deleted]] ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel