Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filetypes: .raw, .asc, .dat, .mat (MATLAB) #98

Closed
Stan125 opened this issue May 25, 2016 · 2 comments
Closed

Add filetypes: .raw, .asc, .dat, .mat (MATLAB) #98

Stan125 opened this issue May 25, 2016 · 2 comments

Comments

@Stan125
Copy link

Stan125 commented May 25, 2016

Hi there,

As I was trying out rio to maybe include it into GREA, I came across four filetypes which I occasionally use and which are not included. Including those filetypes might be a useful thing. You can look up the way I integrated them into my package here.

All the best,
Stani

@jsonbecker
Copy link
Collaborator

jsonbecker commented Jun 2, 2016

Looks like .mat uses R.matlab::readMat, but the other three extensions are just CSV files or a text file with some other separator? For .raw, .dat, and .asc, you can set format = 'delim' or txt or csv, whichever is appropriate.

For readMat, I'll defer to @leeper to see if he would want to import that function. If not, you could import/load rio and write your own function for it:

.import.rio_mat <- function(file, ...) {
  readMat(con = file, ...)
}

And then just call import(file = 'myfile.mat', format = 'mat').

This way rio can be imported into your package and have a custom method for that file type. You could theoretically provide methods the same as above for the other file types that alias to the appropriate existing .import.rio_* for that format.

@leeper
Copy link
Contributor

leeper commented Jun 10, 2016

I think @jsonbecker's answer here is the right way to handle these text files. I don't think .raw, .dat, or .asc are sufficiently standardized to merit handling them in a particular way, given that the format argument should provide sufficient flexibility here.

In terms of matlab support, there is a feature branch on this repo with experimental support for this. I'd appreciate any feedback on it since I do not regularly work with Matlab files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants