I would like to read a hdf5 file in a zipped file. The issue here is that this hdf5 file is also double zipped as a bzip2ed (.bz2) file.
Please refer to the figure shown below.
The zip file is "g2_BIOPAR_SWI_201012250000_GLOBE_ASCAT_V2_0_0.ZIP".
The target bz2 file is "g2_BIOPAR_SWI_201012250000_GLOBE_ASCAT_V2_0_0.h5.bz2".
Could someone show me some tips or guidances in how to do it?
Give a look at this question:
Extract bz2 file in R
It explains how to read a.bz2 file and I think the last answer is the right one for you,; or just type ?bzfile.
After that for hdf5 files you can give a look at rhdf5 package from Bioncoductor; here is the link:
http://www.bioconductor.org/packages/release/bioc/html/rhdf5.html
Related
I have some files in some folders/subfolders
subfolder1/file1.csv
subfolder2/file2.csv
when using r to zip these files, with the following code
zip::zip("test.zip",files=c("subfolder1/file1.csv","subfolder2/file2.csv"))
It will create a zip file, but the files will be in their subfolders.
How can I create a zip file without the structure of the subfolders? which means that the files will be in the test.zip directly.
Thanks to stefan's comment, I tried some arguments in the zip::zip function and found out the argument to do so:
zip(..., mode="cherry-pick")
I have a zipped sas file and there are couple sas files inside that. Just want to know if there is a chance that I can use read_sas function to read specific file under that zipped file? Couldn't find anything online about that.
Checked the ?read_sas nothing mentioned about that.
code I used :
# zipped file name: example.zip
# files inside example.zip file are file1.sas7bdat, file2.sas7bdat and targetfilename.sas7bdat
file <- read_sas(example.zip, 'targetfilename.sas7bdat')
outcome: read_sas only read the first file inside that zipped file.
Sorted solution:
read_sas(unz("examp;e.zip", "'targetfilename.sas7bdat'"))
solved:
read_sas(unz("examp;e.zip", "'targetfilename.sas7bdat'"))
I tried to download a file from LSData, but it brings me to a page full of weird characters. The first few are:
7z¼¯'�DÙ™µUa�����b�������’³_èÚ†à]�&Jgl›Ü)ÉZKŒP7þò|¤ˆëÁëxŠ§u6²ã]’“Àé3lGê7ñ"!èÞ’ïjP³
l½Öv<¹-žøZ¹Æ âäùëOKä#;cÞ Žmï•&?^¢Ø"Á.=ù‚u|õ9žG<އ趽ÈËŒøÂtŠÍÝê/ÂG×à×–R§Ýj×zÛ¥™éwG—ï‘ývíõåò ÂÑ\‡W�ܱò§úßxlø¾Ö¾EºáPnÚR"økv§}6“SLÒ¢ø€m]-Ì«gÐáÅMŠWGU�µOÿDõ™}u¦HŠ_qŠ,/¦lÔ}Áô|,Òäêÿ2l«ª»°úö¡]+€™´í¿¢«|Ãw#êñ:t!
I have no clue what I'm looking at. How can I convert this entire page into a CSV, or in whatever file so I can use it in R?
it is a 7z zipped file, you can download and unzip it to get the CSV file
I've been trying to read xlsb files into R.
I've tried using excel.link and readxlsb packages and they do work for reading the file but i also need to read the sheet names.
For a normal xlsx i would go gor GetSheets but it does not work for XLSB.
Any suggestion?
Thanks
I have a large number of files in .hdf format. These are sadly not the hdf5 files that I know are readable in R. Is there a way to load and read hdf files in R? Or is there a way to convert .hdf to hdf5? I downloaded the C-based h4toh5 tool, but it is not useful. Are there any other ways to convert? Many thanks.
I wouldn't describe hdf4 as a legacy format #mdsummer. NASA still provides a lot of its data in hdf4.
This is similar to a few posts where people (myself included) haven't been sure whether their .hdf files are hdf4 or hdf5. You can use a program called HDFView which is free to download and really easy to use to find out if you've got hdf4/5 files. Just load a file in and look under "properties".
If you've got hdf4 files then you should check out the gdal_translate from the gdalUtils package. There's some more info here including the code I used for my hdf files:
Reading hdf files into R and converting them to geoTIFF rasters
You can use ncdf4 or rgdal packages as we explain here:
https://hdfeos.org/software/r.php
If you don't like h4toh5, h4tonccf is another tool that you can try:
http://hdfeos.org/software/h4cflib.php