I have seen several questions about writing .bin (binary) files from R, but I am wondering what function or package R has that could read in .bin files?
Is R capable of reading in .bin files?
You need the hexView package, and you need to know a lot about the content of the files.
Dump the bytes using hexView::viewRaw(readRaw(filename)), then figure out the structure using what you know about the file. Then figure out what is in there, and use a more specific dump function like viewFormat. See the package documentation.
It's a lot of work, and requires a lot of knowledge specific to the creation of the file. You're unlikely to succeed, but that's how you should do it.
Related
I have to work in R with .gbl files. So far I'm using NOAA .gbl files, but I'm looking to generate my own.
I have been working with R openair and purr libraries. I know that I can use purr::walk() function to work with the files, but that still doesn't tell me what exactly do the files contain
I am trying to copy a file using Julia functions with the hope of manipulating the file and then use that copied version for various tasks in the Julia programming language. Can someone provide some example code of copying a file in Julia?
I guess I could do use read then write but it seems like I would be reinventing the wheel.
Is there a standard library function for this?
Inspired by this question.
Just use the built in function cp(src, dst).
Copy the file, link, or directory from src to dst. force=true will first remove an existing dst.
Afterwards you can open the file and manipulate it. Of course you could also open both source an destination files simultaneously and copy and manipulate it line by line.
Similar to the question below, I was wondering whether there is a way to open .yxdb files in R?
Open Alteryx .yxdb file in Python?
YXDB is Alteryx's own native format. I haven't seen or heard of anything else that can open it.
You could change your workflow to write to a CSV (or other compatible file) as well as writing to the YXDB file.
AFAIK there is no way yet for R to read yxdb files. I also export my Alteryx workflows to CSVs or use the R tool, read.Alteryx, and saveRDS to save it as a fast-loading binary file.
I have downloaded a xls file from business objects and want to read it in R.
I have tried several options, the easiest one being:
library("readxl")
txt=read_excel("file.xls", sheet = 2)
The problem is that it gives me an empty tibble. However, if I open the xls file, do absolutely nothing, save it and try again, it does work!
Since I need to make a data pipeline I want it to work right away without this weird workaround.
Any idea what the problem is? My own thoughts went to some kind of security, read-only, adminstrator permission kind of property but couldn't figure it out.
Kind regards!
Piet
I always try to avoid importing .xls files due to such problems. Where possible I always import it as a .csv file. Depending on the structure of the .xls file, however, this is not always possible or may be extra work if you have many tabs within your .xls file.
If possible, export your .xls as an .csv file and then import it using read.table() or use a function through the many available packages such as data.table or tidyverse.
I don't know much, but it's a bug with the package. You can go down to readxl 1.0.0 and it works.
GitHub issue mentioning dropping versions: https://github.com/tidyverse/readxl/issues/474
How to go down to the version you want: https://support.rstudio.com/hc/en-us/articles/219949047-Installing-older-versions-of-packages
You can use the package data.table that provides a very easy and faster method to read and write .csv or .xls/.xlsx with the fwrite and fread functions. It package already has an automatic separate detector.
You cand find more information about this package here.
While developing a package I encountered the problem of supplementary data import - this has been 'kind of' solved here.
Nevertheless, I need to make use of a function of another package, which needs a path to the used file. Sadly, using GlobalEnvironment variables here is not an option.
[By the way: the file needs to be .txt, while supplementary data should be .RData. The function is quite picky.]
So I need to know how to get the path supplementary data file of a package. Is this even possible to do?
I had the idea of reading the .RData into the global environment and then saving it into a tmpfile for further processing. I would really like to know a clean way - the supplementary data is ~100MB large...
Thank you very much!
Use system.file() to reliably find the path to the installed package and sub-directories, typically these are created in your-pkg-source/inst/extdata/your-file.txt and then referenced as
system.file(package="your-pkg", "extdata", "your-file.txt")