Quick troubleshooting installing xlsx and XML packages on Debian Wheezy
I’m doing Coursera’s Specialization in Data Science and right now I’m in the third course of it, called Getting and Cleaning Data.
In order to answer this week quiz, I needed to install some R packages to load files in different formats. It took me some time to do it, so I’ll document my steps here for anyone that may have trouble doing it.
Installing xlsx package
I needed to install a package to read xlsx files. I naively attempted to install it in R Studio, running under Debian Wheezy, but I got the following error:
As you can see, it suggested me to run a command to add Java support to R, so I did it:
Another error! This time, something was wrong with the Java library linking.
First thing I tryed was to change the Java version to 7:
It didn’t work. So I took a drastic measure and installed everything from Java 7:
And then the R CMD javareconf command worked! But I wasn’t done.
Back to RStudio I got another error when installing package rjava, needed by xlsx and the reason why I had to setup Java in the first place. This time the error message was complaining about a missing lzma library. Unfortunately, I can’t show you the exact error messsage, as I can’t find the log in my system, but anyway, here is the solution:
And then it worked! I could finally load my xlsx file and answer the quiz!
Install XML package
After sucessfully installing xlsx, I had to install the XML package, but this one was a lot easier. The only dependency missing in my system was xml2-config, which happend to be part of the libxml2-dev package:
After succesfully installing XML package at RStudio, I could finally finish this week quiz.