You are NOT supposed to change these settings.
In a future release the name length restriction will be removed,
but currently this is impossible, it will break RExcel.
On Error Resume Next
..do something
if err.number <> 0 then
.. do your error checking and handling
end if
Andrew McLachlan wrote:
Hi All
I am new to R and am trying to use R via RExcel within an Excel add-in
that I am developing for a specific task here at my work.
Basically, I want to put two separate columns of (x and y) data from a
spreadsheet into R, then use R to perform lowess smoothing on these data
and finally return the smoothed values to another column in Excel.
I have hit a few problems which I describe below.
My code in ExcelVBA so far is:
'Set the x-values range
Set rngX = Range(wksCalc.Cells(lTopRow, iLeftCol),
wksCalc.Cells(lBottomRow, iLeftCol))
'Start R
rinterface.StartRServer
'Put the rngX data into R
rinterface.PutArray "x", rngX, False, False
I quickly discovered that filenames can easily be too long because I
got an error message:
"Error -2147220203
in Module RExcel.Arrays.
File name or sheet name too long,
more than 65 characters total"
This message was repeated 4 times which was a little unexpected - I
thought that once would be enough!
I have since found the settings in the Arrays module
Const UseCellAddresses = True
Const MaxFileRangeNameLength = 65
and comment 20080529 in the Comments module.
I do wonder about the consequences of changing these settings. The
people using the macro have lots of data files and I know that these
often have long, descriptive names so that they will encounter this
error a lot. I would like to avoid this problem if possible and would
appreciate any suggestions. For example, what would happen if I set
UseCellAddresses = False? What will break?
On a related issue, I want to be able to detect any errors from
RInterface in my code and deal with these situations. For example, after
"rinterface.StartRServer", can I detect whether this has been successful
or not? Similarly with "rinterface.PutArray "x", rngX, False, False",
how can I detect whether or not this has been successful?
Any advice or information would be most appreciated.
Cheers, Andrew Mc
--
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459
_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at