Is there any other function or package to obtain extensions in filenames?
I tried using file_ext() function from R package library(R.utils), it works on Rtsudio server but fails to work on shiny server.
If all else fails, there is always regex:
gsub("(.+)\\.(.+?$)","\\2", "file.info")
># info
gsub("(.+)\\.(.+?$)","\\2", "htmls.peeples")
># peeples
Combine with basename() to clean up file paths.
2 Likes
file_ext() is in the tools package, which isn't automatically loaded.
1 Like