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 -- Andrew McLachlan, Biometrician Crop & Food Research, Palmerston North, New Zealand. Tel +64-6-356-8300, +64-6-355-6110 (DDI) Visit our website at http://www.crop.cri.nz ______________________________________________________ CAUTION: The information contained in this email is privileged and confidential. If you read this message and you are not the intended recipient, you are hereby notified that any use, dissemination, distribution or reproduction of all or part of the contents is prohibited. If you receive this message in error, please notify the sender immediately. Any opinions or views expressed in this message are those of the individual sender and may not represent those of their employer. _______________________________________________ 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