How to programmatically extract / unzip a .7z (7-zip) file with R

This can be done with the archive package.

library(archive)
tf <- tempfile() ; td <- tempdir()
file.path <- "ftp://ftp.ibge.gov.br/Orcamentos_Familiares/Pesquisa_de_Orcamentos_Familiares_2008_2009/Microdados/Dados.zip"
download.file( file.path , tf , mode = "wb" )
archive(tf)

See https://github.com/jimhester/archive


If you have 7z executable in your path, you can simple use system command

system('7z e -o <output_dir> <archive_name>')

Tags:

R

Unzip

Zip

7Zip

Rar