[Rd] Alphanumeric tools::file_path_sans_ext() (PR#14050)

From: <arnima_at_hafro.is>
Date: Mon, 09 Nov 2009 16:35:10 +0100 (CET)

The file_path_sans_ext() function in the 'tools' package does not handle alphanumeric file extensions correctly:

   file_path_sans_ext("song.txt") # song, correct
   file_path_sans_ext("song.mp3") # song.mp3, wrong

The help page states that "only purely alphanumeric extensions are recognized", which I had expected. To fulfill this, the function body should be

   sub("([^.]+)\\.[[:alnum:]]+$", "\\1", x)

instead of the current definition:

   sub("([^.]+)\\.[[:alpha:]]+$", "\\1", x)



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 09 Nov 2009 - 15:41:26 GMT

This archive was generated by hypermail 2.2.0 : Tue 10 Nov 2009 - 20:40:22 GMT