Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9179885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:54:43+00:00 2026-06-17T17:54:43+00:00

I’ve got some R code that returns a matrix that is 12 columns wide

  • 0

I’ve got some R code that returns a matrix that is 12 columns wide with over 1M rows. When I try to use getarraytovba to return that matrix into a VBA variant, it fails. When I say it fails I mean that it runs the code without generating any errors but the VBA variable will be empty. If I shrink the R matrix to below 5000 rows then VBA will capture the variable. If it is between 5000 and 20000 (ball park) then sometimes it will work and sometimes it won’t. My system has 16GBs of ram and is only 40% utilized when I’m attempting to move the data to VBA. The memory usage doesn’t seem to change as I have task manager open as I’m running the code.

I’ve googled the subject and the only answer I’ve found is that it is limited by physical memory but since I have nearly 10GB of free memory I think there is more to it than just that. Can anyone help me shed light on why getarraytovba is so limiting?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:54:44+00:00Added an answer on June 17, 2026 at 5:54 pm

    I wrote the following in VBA to address the shortcoming…

    Public Function returnresults()
    Dim lResultsize As Long
    Dim sBigblock As Variant
    Dim lLow As Long
    Dim lHigh As Long
    Dim vTemp As Variant
    Dim i As Long
    Dim j As Long
    Dim lBigrow As Long
    Dim lFullresults As Long
    rinterface.RRun "abc<-length(vbaget[,1])"
    lFullresults = rinterface.GetRExpressionValueToVBA("abc")
    lResultsize = lFullresults
    If lResultsize > 1048575 Then
    MsgBox "Results exceed 1,048,575 rows.  Excess will be dropped."
    lResultsize = 1048575
    End If
    sBigblock = ThisWorkbook.Sheets("results").Range("a2:m" & lResultsize + 1)
    lHigh = lResultsize
    lLow = 1
    If lResultsize > 3000 Then lHigh = 3000
    
    lBigrow = 1
    Do While lHigh <= lResultsize And lLow < lHigh
        rinterface.RRun "temp<-vbaget[" & lLow & ":" & lHigh & ",]"
        vTemp = rinterface.GetArrayToVBA("temp")
            For i = 0 To UBound(vTemp, 1)
                For j = 1 To 13 'This is number of columns in array it could be dynamic
                    sBigblock(lBigrow, j) = vTemp(i, j - 1)
                Next j
                lBigrow = lBigrow + 1
            Next i
        lLow = lHigh + 1
        lHigh = lLow + 2999
        If lHigh > lResultsize Then lHigh = lResultsize
    Loop
    
    ThisWorkbook.Sheets("results").Range("a2:m" & lResultsize + 1) = sBigblock
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a small JavaScript validation script that validates inputs based on Regex. I
I am confused How to use looping for Json response Array in another Array.
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.