untar() error
On 03/05/2013 08:31, Hakim Abdi wrote:
Dear List, I have a list of 600+ *.gz files that I would like to extract and read the geotiffs contained within them. I tried using the untar() function to simplify this task but I am stumped by an error. I've combed the Internet for a solution without luck. The details are below, and any help in solving this matter is appreciated.
Those are most likely not tar files. What does file (the command-line program contained in Rtools) say they are?
files = list.files(path = "J:/GIMMS/NDVI", pattern = "data.tif.gz",
all.files = TRUE, full.names = TRUE, recursive = TRUE, ignore.case = TRUE, include.dirs = TRUE)
lapply(files, untar)
Error in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'II*\0?? <\001?? \0\0`G\0\0\fn\0\0?????\0\0d??\0\0\020??\0\0??\b\001\0h/\001\0\024V\001\0??|\001\0l??\001\0\030??\001\0????\001\0p\027\002\0\034>\002\0??d\002\0t???\002\0 ??\002\0????\002\0x??\002\0$&\003\0??L\003\0|s\003'
untar(files[1])
Error in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'II*\0?? <\001?? \0\0`G\0\0\fn\0\0?????\0\0d??\0\0\020??\0\0??\b\001\0h/\001\0\024V\001\0??|\001\0l??\001\0\030??\001\0????\001\0p\027\002\0\034>\002\0??d\002\0t???\002\0 ??\002\0????\002\0x??\002\0$&\003\0??L\003\0|s\003'
untar("J:/GIMMS/NDVI/1981/81aug15a.n07-VIg/81aug15a.n07-VIg_data.tif.gz")
Error in rawToChar(block[seq_len(ns)]) : embedded nul in string: 'II*\0?? <\001?? \0\0`G\0\0\fn\0\0?????\0\0d??\0\0\020??\0\0??\b\001\0h/\001\0\024V\001\0??|\001\0l??\001\0\030??\001\0????\001\0p\027\002\0\034>\002\0??d\002\0t???\002\0 ??\002\0????\002\0x??\002\0$&\003\0??L\003\0|s\003'
traceback()
3: rawToChar(block[seq_len(ns)]) 2: untar2(tarfile, files, list, exdir) 1: untar(files[1])
sessionInfo()
R version 2.15.2 (2012-10-26) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base
_______________________________________ Hakim Abdi Doctoral Student Physical Geography and Ecosystem Science Lund University S??lvegatan 12, 223 62 Lund, Sweden Office: +46 (0) 46 2223132 Mobile: +46 (0) 73 9300116 Email: hakim.abdi at nateko.lu.se [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595