bryanhanson / readJDX

Import spectroscopic data in the JCAMP-DX format
https://bryanhanson.github.io/readJDX/
8 stars 2 forks source link

Couldn't find any variable lists. Supported formats are: XYY, XRR, XII, NMR_2D #7

Closed Philip-Braun closed 4 years ago

Philip-Braun commented 4 years ago

Hi,

Thanks for the package! I Want to read a .jdx file (attached) like:

[install.packages("readJDX")
library(readJDX)
spectra <- readJDX("2.jdx")

I get the following error message:

Couldn't find any variable lists. Supported formats are: XYY, XRR, XII, NMR_2D

What am I doing wrong?

sample.txt

bryanhanson commented 4 years ago

You are not doing anything wrong! That file format is not supported. It's a simple list of x, y values preceded by the metadata. You can read that data in using some variation of read.table setting skip to the number of lines of metadata to skip and then figuring out the separator. For that particular file, this worked:

pb <- read.table("sample.txt", sep = " ", skip = 31)

If you have a series of files, you can put this into a loop and set up a matrix to hold the results. Let me know if you have further questions!

Philip-Braun commented 4 years ago

Wow,

I did not think one could just read it so easily.

Thank you very much!

bryanhanson commented 4 years ago

Depending upon the final destination for this data, there are several other ways one might capture it, so just let me know if you need assistance.