read.xlsx function crashing R Studio

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

read.xlsx function crashing R Studio

Kevin Kowitski
Hey everyone, 

   I have used read.xlsx in the past rather than XLConnect for importing Excel data to R.  However, I have been finding now that the read.xlsx function has been causing my R studio to Time out.  I thought it might be because the R studio I had was out of date so I installed R studio X64 3.3.1 and reinstalled the xlsx package but it is still failing.  I have been trying to use XLConnect in it's place which has been working, excpet that I am running into memory error:
              Error: OutOfMemoryError (Java): GC overhead limit exceeded
      
I did some online searching and found an option to increase memory:
              "options(java.parameters = "-Xmx4g" )

but it resulted in this new memory Error:

             Error: OutOfMemoryError (Java): Java heap space

Can anyone provide me with some help on getting the read.xlsx function working?

-Kevin

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: read.xlsx function crashing R Studio

jholtman
try the openxlsx package


Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitski <[hidden email]>
wrote:

> Hey everyone,
>
>    I have used read.xlsx in the past rather than XLConnect for importing
> Excel data to R.  However, I have been finding now that the read.xlsx
> function has been causing my R studio to Time out.  I thought it might be
> because the R studio I had was out of date so I installed R studio X64
> 3.3.1 and reinstalled the xlsx package but it is still failing.  I have
> been trying to use XLConnect in it's place which has been working, excpet
> that I am running into memory error:
>               Error: OutOfMemoryError (Java): GC overhead limit exceeded
>
> I did some online searching and found an option to increase memory:
>               "options(java.parameters = "-Xmx4g" )
>
> but it resulted in this new memory Error:
>
>              Error: OutOfMemoryError (Java): Java heap space
>
> Can anyone provide me with some help on getting the read.xlsx function
> working?
>
> -Kevin
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: read.xlsx function crashing R Studio

hadley wickham
Or readxl.

Hadley

On Mon, Aug 22, 2016 at 5:54 AM, jim holtman <[hidden email]> wrote:

> try the openxlsx package
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitski <[hidden email]>
> wrote:
>
>> Hey everyone,
>>
>>    I have used read.xlsx in the past rather than XLConnect for importing
>> Excel data to R.  However, I have been finding now that the read.xlsx
>> function has been causing my R studio to Time out.  I thought it might be
>> because the R studio I had was out of date so I installed R studio X64
>> 3.3.1 and reinstalled the xlsx package but it is still failing.  I have
>> been trying to use XLConnect in it's place which has been working, excpet
>> that I am running into memory error:
>>               Error: OutOfMemoryError (Java): GC overhead limit exceeded
>>
>> I did some online searching and found an option to increase memory:
>>               "options(java.parameters = "-Xmx4g" )
>>
>> but it resulted in this new memory Error:
>>
>>              Error: OutOfMemoryError (Java): Java heap space
>>
>> Can anyone provide me with some help on getting the read.xlsx function
>> working?
>>
>> -Kevin
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
http://hadley.nz

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: read.xlsx function crashing R Studio

Rainer Hurling
In reply to this post by Kevin Kowitski
Hi Kevin,

Am 21.08.2016 um 19:30 schrieb Kevin Kowitski:

> Hey everyone,
>
>    I have used read.xlsx in the past rather than XLConnect for importing
> Excel data to R.  However, I have been finding now that the read.xlsx
> function has been causing my R studio to Time out.  I thought it might
> be because the R studio I had was out of date so I installed R studio
> X64 3.3.1 and reinstalled the xlsx package but it is still failing.  I
> have been trying to use XLConnect in it's place which has been working,
> excpet that I am running into memory error:
>               Error: OutOfMemoryError (Java): GC overhead limit exceeded
>      
> I did some online searching and found an option to increase memory:
>               "options(java.parameters = "-Xmx4g" )
>
> but it resulted in this new memory Error:
>
>              Error: OutOfMemoryError (Java): Java heap space
>
> Can anyone provide me with some help on getting the read.xlsx function
> working?
>
> -Kevin

There are interesting alternatives with other packages, as mentioned
before by Jim Holtman and Hadley Wickham.

If there are serious reasons to use the xlsx package, I had success with
the following, somewhat ugly workaround:


# Increase before package loading
options(java.parameters = "-Xmx8000m")
# Java garbage collection function
jgc <- function() .jcall("java/lang/System", method = "gc")
library(xlsx)
# if you like to use ISO dates
options(xlsx.date.format="yyyy-mm-dd")
# ATTENTION:  Loading of package xlsx changes decimal point
# to comma in a German locale
Sys.setlocale(category = "LC_NUMERIC", locale="C")  # UGLY HACK !!!


# Later in your code, i.e. before using addDataFrame(), use
jgc()


HTH,
Rainer Hurling

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.