how to unzip .nc.gz files

I'm new to r, and I have to open more than 1000 .nc files that are compressed as .nc.gz, I don't know how to create a loop that unzips the files in that folder so that I can read them later.

Another option is to read the files without decompressing them.


1 Like

You can do something like this


list_of_files <- list.files(path = "path/to/your/folder",
           pattern = "\\.gz$",
           full.names = TRUE)

list_of_files %>% 
1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.