Quantcast

Problem with xlsx package

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Problem with xlsx package

Nikhil Joshi
I am trying to read an xlsx spreadsheet (1506 rows, 501columns) all
populated but getting the following error:
Please advise as to how to get around this issue.

> res <- read.xlsx("c:\\BSE_v2.xlsx",1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.OutOfMemoryError: Java heap space

Here is the session info:

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
 [1] xlsx_0.2.4                   xlsxjars_0.2.0               rJava_0.8-8

 [4] quantmod_0.3-15              TTR_0.20-2
Defaults_1.1-1
 [7] urca_1.2-4                   RBGL_1.26.0                  graph_1.28.0

[10] colorspace_1.0-1             spatstat_1.21-4              deldir_0.0-13

[13] mgcv_1.7-2                   reshape_0.8.4                plyr_1.4

[16] fExtremes_2100.77            fTrading_2100.76
fGarch_2110.80
[19] fBasics_2110.79              timeSeries_2130.90
timeDate_2130.91
[22] mc2d_0.1-9                   mvtnorm_0.9-96
mixtools_0.4.4
[25] boot_1.2-43                  MASS_7.3-9
SuppDists_1.1-8
[28] ghyp_1.5.4                   gplots_2.8.0                 caTools_1.11

[31] bitops_1.0-4.1               gdata_2.8.1                  gtools_2.6.2

[34] numDeriv_2010.11-1           xtable_1.5-6
PerformanceAnalytics_1.0.3.2
[37] sn_0.4-16                    mnormt_1.4-0                 xts_0.7-5

[40] zoo_1.6-4                    RODBC_1.3-2

loaded via a namespace (and not attached):
[1] lattice_0.19-13    Matrix_0.999375-46 nlme_3.1-97        tools_2.12.1

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Gabor Grothendieck
On Wed, Feb 9, 2011 at 6:12 PM, Nikhil Joshi <[hidden email]> wrote:

> I am trying to read an xlsx spreadsheet (1506 rows, 501columns) all
> populated but getting the following error:
> Please advise as to how to get around this issue.
>
>> res <- read.xlsx("c:\\BSE_v2.xlsx",1)
> Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
>  java.lang.OutOfMemoryError: Java heap space
>
> Here is the session info:
>
>> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
>
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets  methods
> base
>
> other attached packages:
>  [1] xlsx_0.2.4                   xlsxjars_0.2.0               rJava_0.8-8
>
>  [4] quantmod_0.3-15              TTR_0.20-2
> Defaults_1.1-1
>  [7] urca_1.2-4                   RBGL_1.26.0                  graph_1.28.0
>
> [10] colorspace_1.0-1             spatstat_1.21-4              deldir_0.0-13
>
> [13] mgcv_1.7-2                   reshape_0.8.4                plyr_1.4
>
> [16] fExtremes_2100.77            fTrading_2100.76
> fGarch_2110.80
> [19] fBasics_2110.79              timeSeries_2130.90
> timeDate_2130.91
> [22] mc2d_0.1-9                   mvtnorm_0.9-96
> mixtools_0.4.4
> [25] boot_1.2-43                  MASS_7.3-9
> SuppDists_1.1-8
> [28] ghyp_1.5.4                   gplots_2.8.0                 caTools_1.11
>
> [31] bitops_1.0-4.1               gdata_2.8.1                  gtools_2.6.2
>
> [34] numDeriv_2010.11-1           xtable_1.5-6
> PerformanceAnalytics_1.0.3.2
> [37] sn_0.4-16                    mnormt_1.4-0                 xts_0.7-5
>
> [40] zoo_1.6-4                    RODBC_1.3-2
>
> loaded via a namespace (and not attached):
> [1] lattice_0.19-13    Matrix_0.999375-46 nlme_3.1-97        tools_2.12.1
>

Try this to increase the heap size (or use some other size):

   options(java.parameters = "-Xmx1000m")

It should be done any time before the java machine is loaded.

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Nikhil Joshi
Gabor,
thanks for the suggestion.

I did as you have suggested- Started a clean session of R and set the java
option.  Then I sourced the library and tried to read the xlsx file but got
the same error.  I am assuming that Java machine is loaded when the package
xlsx is sourced and not when the base package is sourced (or in other words
upon starting a new R session).  Or am I totally off?

Regards
Nikhil

On Wed, Feb 9, 2011 at 8:28 PM, Gabor Grothendieck
<[hidden email]>wrote:

> On Wed, Feb 9, 2011 at 6:12 PM, Nikhil Joshi <[hidden email]>
> wrote:
> > I am trying to read an xlsx spreadsheet (1506 rows, 501columns) all
> > populated but getting the following error:
> > Please advise as to how to get around this issue.
> >
> >> res <- read.xlsx("c:\\BSE_v2.xlsx",1)
> > Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,
>  :
> >  java.lang.OutOfMemoryError: Java heap space
> >
> > Here is the session info:
> >
> >> sessionInfo()
> > R version 2.12.1 (2010-12-16)
> > Platform: i386-pc-mingw32/i386 (32-bit)
> >
> > locale:
> > [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> > States.1252
> > [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> >
> > [5] LC_TIME=English_United States.1252
> >
> > attached base packages:
> > [1] grid      stats     graphics  grDevices utils     datasets  methods
> > base
> >
> > other attached packages:
> >  [1] xlsx_0.2.4                   xlsxjars_0.2.0
> rJava_0.8-8
> >
> >  [4] quantmod_0.3-15              TTR_0.20-2
> > Defaults_1.1-1
> >  [7] urca_1.2-4                   RBGL_1.26.0
>  graph_1.28.0
> >
> > [10] colorspace_1.0-1             spatstat_1.21-4
>  deldir_0.0-13
> >
> > [13] mgcv_1.7-2                   reshape_0.8.4                plyr_1.4
> >
> > [16] fExtremes_2100.77            fTrading_2100.76
> > fGarch_2110.80
> > [19] fBasics_2110.79              timeSeries_2130.90
> > timeDate_2130.91
> > [22] mc2d_0.1-9                   mvtnorm_0.9-96
> > mixtools_0.4.4
> > [25] boot_1.2-43                  MASS_7.3-9
> > SuppDists_1.1-8
> > [28] ghyp_1.5.4                   gplots_2.8.0
> caTools_1.11
> >
> > [31] bitops_1.0-4.1               gdata_2.8.1
>  gtools_2.6.2
> >
> > [34] numDeriv_2010.11-1           xtable_1.5-6
> > PerformanceAnalytics_1.0.3.2
> > [37] sn_0.4-16                    mnormt_1.4-0                 xts_0.7-5
> >
> > [40] zoo_1.6-4                    RODBC_1.3-2
> >
> > loaded via a namespace (and not attached):
> > [1] lattice_0.19-13    Matrix_0.999375-46 nlme_3.1-97        tools_2.12.1
> >
>
> Try this to increase the heap size (or use some other size):
>
>   options(java.parameters = "-Xmx1000m")
>
> It should be done any time before the java machine is loaded.
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Gabor Grothendieck
On Thu, Feb 10, 2011 at 10:49 AM, Nikhil Joshi <[hidden email]> wrote:

> Gabor,
> thanks for the suggestion.
> I did as you have suggested- Started a clean session of R and set the java
> option.  Then I sourced the library and tried to read the xlsx file but got
> the same error.  I am assuming that Java machine is loaded when the package
> xlsx is sourced and not when the base package is sourced (or in other words
> upon starting a new R session).  Or am I totally off?
> Regards
> Nikhil
>

The JVM would be initialized when xlsx is loaded or when certain
functions in the package are called depending on how the package was
written so as long as you set the java.parameters option prior to
issuing the library(xlsx) command you should be ok.  If that does not
work and assuming the number I suggested is big enough then it must be
something else.  You could try contacting the author to see if other
users have experienced this.

If you still can't get it to work there are a number of alternatives
listed here:
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows

--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Tobias Verbeke-2
On 02/10/2011 05:30 PM, Gabor Grothendieck wrote:

> On Thu, Feb 10, 2011 at 10:49 AM, Nikhil Joshi<[hidden email]>  wrote:
>> Gabor,
>> thanks for the suggestion.
>> I did as you have suggested- Started a clean session of R and set the java
>> option.  Then I sourced the library and tried to read the xlsx file but got
>> the same error.  I am assuming that Java machine is loaded when the package
>> xlsx is sourced and not when the base package is sourced (or in other words
>> upon starting a new R session).  Or am I totally off?
>> Regards
>> Nikhil
>>
>
> The JVM would be initialized when xlsx is loaded or when certain
> functions in the package are called depending on how the package was
> written so as long as you set the java.parameters option prior to
> issuing the library(xlsx) command you should be ok.  If that does not
> work and assuming the number I suggested is big enough then it must be
> something else.  You could try contacting the author to see if other
> users have experienced this.
>
> If you still can't get it to work there are a number of alternatives
> listed here:
> http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows

There is also this recent thread on rosuda-devel which might
be of instructive:

http://mailman.rz.uni-augsburg.de/pipermail/stats-rosuda-devel/2011q1/001621.html

Best,
Tobias

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

sakaton
I have the same problem and same Java error.







> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] grDevices datasets  splines   graphics  stats     tcltk     utils     methods   base    

other attached packages:
 [1] xlsx_0.3.0            xlsxjars_0.3.0        rJava_0.9-1           plyr_1.6              stringr_0.5           sqldf_0.4-2          
 [7] chron_2.3-42          gsubfn_0.5-7          proto_0.3-9.2         RSQLite.extfuns_0.0.1 RSQLite_0.9-4         DBI_0.2-5            
[13] RODBC_1.3-3           svSocket_0.9-51       TinnR_1.0.3           R2HTML_2.2            Hmisc_3.8-3           survival_2.36-9      

loaded via a namespace (and not attached):
[1] cluster_1.14.0  grid_2.13.1     lattice_0.19-30 svMisc_0.9-63   tools_2.13.1
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Brad Schneid
In reply to this post by Nikhil Joshi
If all else fails, open it in Excel... save as .csv

read.csv()



Nikhil Joshi wrote
I am trying to read an xlsx spreadsheet (1506 rows, 501columns) all
populated but getting the following error:
Please advise as to how to get around this issue.

> res <- read.xlsx("c:\\BSE_v2.xlsx",1)
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl,  :
  java.lang.OutOfMemoryError: Java heap space

Here is the session info:

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
 [1] xlsx_0.2.4                   xlsxjars_0.2.0               rJava_0.8-8

 [4] quantmod_0.3-15              TTR_0.20-2
Defaults_1.1-1
 [7] urca_1.2-4                   RBGL_1.26.0                  graph_1.28.0

[10] colorspace_1.0-1             spatstat_1.21-4              deldir_0.0-13

[13] mgcv_1.7-2                   reshape_0.8.4                plyr_1.4

[16] fExtremes_2100.77            fTrading_2100.76
fGarch_2110.80
[19] fBasics_2110.79              timeSeries_2130.90
timeDate_2130.91
[22] mc2d_0.1-9                   mvtnorm_0.9-96
mixtools_0.4.4
[25] boot_1.2-43                  MASS_7.3-9
SuppDists_1.1-8
[28] ghyp_1.5.4                   gplots_2.8.0                 caTools_1.11

[31] bitops_1.0-4.1               gdata_2.8.1                  gtools_2.6.2

[34] numDeriv_2010.11-1           xtable_1.5-6
PerformanceAnalytics_1.0.3.2
[37] sn_0.4-16                    mnormt_1.4-0                 xts_0.7-5

[40] zoo_1.6-4                    RODBC_1.3-2

loaded via a namespace (and not attached):
[1] lattice_0.19-13    Matrix_0.999375-46 nlme_3.1-97        tools_2.12.1

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

Michael Weylandt
In reply to this post by sakaton
And did you try giving more memory to the JVM as suggested above? I'd
imagine that if you have the same problem and the same error, you
would expect to get the same advice directed at the same solution.

Otherwise, I'd personally plug the XLConnect package over xlsx. I
switched to it recently and have been very pleased with increased
speed and flexibility.

Michael

On Wed, Dec 7, 2011 at 11:23 AM, sakaton <[hidden email]> wrote:

> I have the same problem and same Java error.
>
>
>
>
>
>
>
>> sessionInfo()
> R version 2.13.1 (2011-07-08)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
> States.1252    LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C                           LC_TIME=English_United
> States.1252
>
> attached base packages:
> [1] grDevices datasets  splines   graphics  stats     tcltk     utils
> methods   base
>
> other attached packages:
>  [1] xlsx_0.3.0            xlsxjars_0.3.0        rJava_0.9-1
> plyr_1.6              stringr_0.5           sqldf_0.4-2
>  [7] chron_2.3-42          gsubfn_0.5-7          proto_0.3-9.2
> RSQLite.extfuns_0.0.1 RSQLite_0.9-4         DBI_0.2-5
> [13] RODBC_1.3-3           svSocket_0.9-51       TinnR_1.0.3
> R2HTML_2.2            Hmisc_3.8-3           survival_2.36-9
>
> loaded via a namespace (and not attached):
> [1] cluster_1.14.0  grid_2.13.1     lattice_0.19-30 svMisc_0.9-63
> tools_2.13.1
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Problem-with-xlsx-package-tp3298470p4169522.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list
> 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.

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

jholtman
I have had better luck with the XLConnect package.

On Wed, Dec 7, 2011 at 3:45 PM, R. Michael Weylandt
<[hidden email]> wrote:

> And did you try giving more memory to the JVM as suggested above? I'd
> imagine that if you have the same problem and the same error, you
> would expect to get the same advice directed at the same solution.
>
> Otherwise, I'd personally plug the XLConnect package over xlsx. I
> switched to it recently and have been very pleased with increased
> speed and flexibility.
>
> Michael
>
> On Wed, Dec 7, 2011 at 11:23 AM, sakaton <[hidden email]> wrote:
>> I have the same problem and same Java error.
>>
>>
>>
>>
>>
>>
>>
>>> sessionInfo()
>> R version 2.13.1 (2011-07-08)
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
>> States.1252    LC_MONETARY=English_United States.1252
>> [4] LC_NUMERIC=C                           LC_TIME=English_United
>> States.1252
>>
>> attached base packages:
>> [1] grDevices datasets  splines   graphics  stats     tcltk     utils
>> methods   base
>>
>> other attached packages:
>>  [1] xlsx_0.3.0            xlsxjars_0.3.0        rJava_0.9-1
>> plyr_1.6              stringr_0.5           sqldf_0.4-2
>>  [7] chron_2.3-42          gsubfn_0.5-7          proto_0.3-9.2
>> RSQLite.extfuns_0.0.1 RSQLite_0.9-4         DBI_0.2-5
>> [13] RODBC_1.3-3           svSocket_0.9-51       TinnR_1.0.3
>> R2HTML_2.2            Hmisc_3.8-3           survival_2.36-9
>>
>> loaded via a namespace (and not attached):
>> [1] cluster_1.14.0  grid_2.13.1     lattice_0.19-30 svMisc_0.9-63
>> tools_2.13.1
>>
>> --
>> View this message in context: http://r.789695.n4.nabble.com/Problem-with-xlsx-package-tp3298470p4169522.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> [hidden email] mailing list
>> 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.
>
> ______________________________________________
> [hidden email] mailing list
> 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.



--
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.

______________________________________________
[hidden email] mailing list
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
|  
Report Content as Inappropriate

Re: Problem with xlsx package

da_el
In reply to this post by Nikhil Joshi
easiest workaround, save the .xlsx to a .xls
Loading...