The dqmagic package provides an R interface for the libmagic file type identification library similar to the Unix file command. This allows for file type identification based on a file’s content instead of it’s extension.
In order to install and use dqmagic you will need the libmagic
library and headers:
sudo apt-get install libmagic-dev
sudo yum install file-devel
sudo brew install libmagic
At the moment dqmagic is not on CRAN, but you can install the current version via drat:
if (!requireNamespace("drat", quietly = TRUE)) install.packages("drat")
drat::addRepo("daqana")
install.packages("dqmagic")