Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rcall command: "too many numeric literals, r(130)"

    Rcall command: "too many numeric literals, r(130)"

    Today, 05:36
    I have started to use Rcall-command in Stata 14.2 and I get after each R: command message "too many numeric literals
    r(130);". Otherwise the commands go throught well. Any idea how to get rid of this error message?

    keep if lat<. & lon<. & kaivolat<. & kaivolon<.
    (1 observation deleted)

    . mkmat lon lat , matrix(p1)

    . R: p11=st.matrix(p1)
    too many numeric literals
    r(130);

  • #2
    Hi Jukka

    I can help you if you provide me more information. It would be nice to know the version of Rcall you are using. So that is my first question...

    Next, the error you get is really strange! based on the error code it is clear that it is happening in Stata and not in R. but I can't help more unless I see your matrix. You can save your matrix to Stata dataset and upload it here. I will have a look at it. see the link below to learn how to do it. http://www.stata.com/support/faqs/pr...ving-matrices/

    PS, make sure you have the latest version of Rcall installed. If you have github package installed, you can install the latest version using:

    Code:
    github install haghish/Rcall
    ——————————————
    E. F. Haghish, IMBI, University of Freiburg
    [email protected]
    http://www.haghish.com/

    Comment


    • #3
      I have the latest Rcall from github.

      Sorry I could not use attachement function, so I paste the data.
      Jukka
      set matsize 11000, permanently
      keep if lat<. & lon<. & kaivolat<. & kaivolon<.
      mkmat lon lat , matrix(p1)
      mkmat kaivolon kaivolat , matrix(p2)
      R: library(geosphere)
      R: p11=st.matrix(p1)
      R: p22=st.matrix(p2)
      R: dd<-distGeo(p11, p22, a=6378137, f=1/298.257223563)


      <moderator edit to prune dataset>
      Last edited by sladmin; 19 Nov 2016, 07:15. Reason: User requested removal of data.

      Comment


      • #4
        So Stata does not fail to pass the matrices to R? p11 and p22 will be accessed in R, before you call the distGeo function?
        ——————————————
        E. F. Haghish, IMBI, University of Freiburg
        [email protected]
        http://www.haghish.com/

        Comment


        • #5
          hi, example: In stata, years-variable is:
          list Tilastointivuosi in 1/10
          +----------+
          | Tilast~i |
          |----------|
          1. | 1995 |
          2. | 1998 |
          3. | 1996 |
          4. | 2005 |
          5. | 1996 |
          |----------|
          6. | 2006 |
          7. | 1996 |
          8. | 2004 |
          9. | 1996 |
          10. | 2012 |
          +----------+


          And then:

          Rcall clear
          (R memory cleared)

          . R: z=st.var( Tilastointivuosi )

          . R: z[1:10]
          [1] 19951 19952 19953 19954 19955 19956 19957 19958 19959 199510

          . return list

          scalars:
          r(rc) = 0

          macros:
          r(z) : "19951 19952 19953 19954 19955 19956 19957 19958 19959 199510 199511 199512 199513 199514 199515 199516 199517 19951.."

          So now I found this kind of error...!?

          Comment


          • #6
            However, if data contains Tilastointivuosi-variable only

            R: z=st.data()

            . R: z[1:10,1]
            [1] 1995 1998 1996 2005 1996 2006 1996 2004 1996 2012
            This is a right result and no error too many numeric literals.

            Comment


            • #7
              Jukka in these examples I see no error... Perhaps you find the Rall homepage useful? It has a lot of examples and the working paper, which is not yet published. But it can provide you a deep understanding of the logic and workflow of the package.
              ——————————————
              E. F. Haghish, IMBI, University of Freiburg
              [email protected]
              http://www.haghish.com/

              Comment


              • #8
                Jukka, please use dataex (SSC) and CODE delimiters as requested in the Statalist FAQ Advice #12 for data examples.

                Comment


                • #9
                  Yes, I looked the Rall homepage. But still I cannot find the reason why I cannot have that second value of the variable = 1998 but in R it is 19952 etc. Is this some kind of factor value but the original is integer in Stata. I could not find explanation for st.var in Rall homepage at all. I'll sent some data if needed but maybe st.var is functioning conditional on something. Some formatting?

                  Comment


                  • #10
                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    input int Tilastointivuosi
                    1995
                    1998
                    1996
                    2005
                    1996
                    2006
                    1996
                    2004
                    1996
                    2012
                    end
                    
                    R: z<-st.var( Tilastointivuosi )
                    R: z[1:10]
                    return list

                    Comment


                    • #11
                      Code:
                      clear
                      input int Tilastointivuosi
                      1995
                      1998
                      1996
                      2005
                      1996
                      2006
                      1996
                      2004
                      1996
                      2012
                      end
                      
                      mkmat Tilastointivuosi , matrix(p1)
                      R: p11=st.matrix(p1)
                      R: p11[1:10,1]
                      **This is fine

                      Comment


                      • #12
                        What is wrong with this example? What is the problem?

                        I see no error here and after running your example, I got no error. Please make a reproducible example, when I can follow everything and get to the error (or bug). Then upload the do-file here and I will debug it and get back to you here. It would be most helpful if you use one of the datasets that comes with Stata.I still want to know what was the initial error you reported i.e. "too many numeric literals." It'd be very helpful if you could reproduce that error using one of Stata's datasets and Rcall.

                        Then I will follow your do-file and look see what is wrong. Thanks.
                        Last edited by haghish; 22 Nov 2016, 09:55.
                        ——————————————
                        E. F. Haghish, IMBI, University of Freiburg
                        [email protected]
                        http://www.haghish.com/

                        Comment


                        • #13
                          The problem is that I got z is 19951 19952 19953.... But I wonder why these are not the original values 1995 1998 1996 etc...z above means something like first value is 1995, the second value is 1 after 1995 etc...I cannot recognize what is the structure of z in relation to original variable Tilastointivuosi. St.var is some kind of function of the original values. st.matrix is keeping the original values but it requires large matrices (above p1).

                          Comment


                          • #14
                            There are no errors in stata running but now the values are different from original values when using st.var. Before Rcall was running OK but stata gave message "too many numeric literals" . Now there is no message but values are peculiar or at least difficult to interpret??

                            Comment


                            • #15
                              Hi! I am sorry but I cannot get this message "Too many numeric literals" anymore. Sometimes this Stata 14.2 is running in a peculiar way. For example, to install Rcall I have to change the working directory to c: from the server. Otherwise the installation was impossible. Also, sometimes stata (network version) is not at all running some commands from do-file etc. Installation of Stata 14 has been checked but it seems that there are some problems.

                              Jukka

                              Comment

                              Working...
                              X