[R] Need help to unzip files in Windows

Anas Jamshed @n@@j@m@hed1994 @end|ng |rom gm@||@com
Tue Aug 24 02:16:44 CEST 2021


sir after that I want to run:
#get the list of sample names
GSMnames <- t(list.files("~/Desktop/GSE162562_RAW", full.names = F))

#remove .txt from file/sample names
GSMnames <- gsub(pattern = ".txt", replacement = "", GSMnames)

#make a vector of the list of files to aggregate
files <- list.files("~/Desktop/GSE162562_RAW", full.names = TRUE)


but it is not running as after running utils::untar(FILE, exdir =
dirname(FILE)) it creates another 108 archieves

On Tue, Aug 24, 2021 at 2:03 AM Andrew Simmons <akwsimmo using gmail.com> wrote:

> Hello,
>
>
> I tried downloading that file using 'utils::download.file' (which worked),
> but then continued to complain about "damaged archive" when trying to use
> 'utils::untar'. However, it seemed to work when I downloaded the archive
> manually. Finally, the solution I found is that you have to specify the
> mode in which you're downloading the file. Something like:
>
>
> URL <- "
> https://ftp.ncbi.nlm.nih.gov/geo/series/GSE162nnn/GSE162562/suppl/GSE162562_RAW.tar
> "
> FILE <- file.path(tempdir(), basename(URL))
>
>
> utils::download.file(URL, FILE, mode = "wb")
> utils::untar(FILE, exdir = dirname(FILE))
>
>
> worked perfectly for me. It seems to also work still on Ubuntu, but you
> can let us know if you find it doesn't. I hope this helps!
>
>
>
> On Mon, Aug 23, 2021 at 3:20 PM Anas Jamshed <anasjamshed1994 using gmail.com>
> wrote:
>
>> I am trying this URL: "
>> https://ftp.ncbi.nlm.nih.gov/geo/series/GSE162nnn/GSE162562/suppl/GSE162562_RAW.tar
>> "
>>
>> but it is not giving me any file
>>
>> On Mon, Aug 23, 2021 at 11:42 PM Andrew Simmons <akwsimmo using gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>>
>>> I don't think you need to use a system command directly, I think
>>> 'utils::untar' is all you need. I tried the same thing myself, something
>>> like:
>>>
>>>
>>> URL <- "https://exiftool.org/Image-ExifTool-12.30.tar.gz"
>>> FILE <- file.path(tempdir(), basename(URL))
>>>
>>>
>>> utils::download.file(URL, FILE)
>>> utils::untar(FILE, exdir = dirname(FILE))
>>>
>>>
>>> and it makes a folder "Image-ExifTool-12.30". It seems to work perfectly
>>> fine in Windows 10 x64 build 19042. Can you send the specific file (or
>>> provide a URL to the specific file) that isn't working for you?
>>>
>>> On Mon, Aug 23, 2021 at 12:53 PM Anas Jamshed <anasjamshed1994 using gmail.com>
>>> wrote:
>>>
>>>> I have the file GSE162562_RAW. First I untar them
>>>> by untar("GSE162562_RAW.tar")
>>>> then I am running like:
>>>>  system("gunzip ~/Desktop/GSE162562_RAW/*.gz")
>>>>
>>>>
>>>> This is running fine in Linux but not in windows. What changes I
>>>> should make to run this command in windows as well
>>>>
>>>>         [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> 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.
>>>>
>>>

	[[alternative HTML version deleted]]



More information about the R-help mailing list