How can I read a .wk1 file in r?

288 views Asked by At

I have a feeling this is a longshot, but is there a way to read a .wk1 file in R? My boss has a lot of data she wants me to process, but I'm struggling to even open it. Here's what I've tried:

  • I tried using the gnumeric package, but it requires ssconvert and that package isn't available for my version of R (4.0.2).
  • I know it can be read in Quattro pro, but I don't have access to that plus I'd rather only use R and not jump between applications.
  • I tried having R pass it to MatLab to open it but that was frustrating, given I can't open the file in R to begin with and I don't know MatLab that well.

I think the easiest way to do this is to get the gnumeric package to work. Is there a way I can reset R to an older version for just this script? It would be a pain to switch back and forth. To that end, I haven't been able to find what the last version of R was that was compatible with ssconvert.

10/11 edit: I got ssconvert to install (I had to do it in terminal, not R) but now I get the following error message:

theData <- read.gnumeric.sheet("~/filepath/filename.WK1", head = FALSE)

Error in read.table(file = file, header = header, sep = sep, quote quote, : 
no lines available in input

I used one of the online conversion websites to get this in an .xlsx so I know that the first two lines are blank. I would still prefer to do this whole process in R because it would take a long time to convert each file one at a time. Any ideas? I know when R reads a .csv it'll skip empty lines but I'm not sure if the gnumeric does this. How can I skip any blank lines before the data starts? Since I don't know if they all have the same format, is there a way I don't have to hard code which lines are empty?

Here's the structure of one of my files (as an .xlsx):

[1,] 
[2,] 
[3,] 
[4,]    sample factor1 factor2 factor3
[5,] 
[6,]      1      23      54      63
[7,]      2      54      73      76
[8,]      3      76      82      13
[9,]      4      86      64      52
0

There are 0 answers