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.
> 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.a...@nateko.lu.se [[alternative HTML version deleted]]
______________________________________________ R-help@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.