> The standard solution is to use use GetArrayToVBA("dim(object)") to retrieve > the size information into VBA from R.
Ok. > The idea here is to bring together Excel's data lists and R dataframes. > In Excel, data lists always have to have column names. > If what you transfer is all numeric, as.matrix(dataframe) will allow you to > avoid transferring the column names. > But I still think that if you get a dataframe in Excel, it should and as a > data list, and if you want something different, you can do it, but you are > responsible in your code. Ok, I see the logic. Just for you to understand my use-case scenario, the problem arises when I'm building an Excel-based application, where data has fixed positions (as if it was a form). In many of these cases, I need to transform the R column names into friendly names that are understandable to final users, and also translate them at times. In these cases the column names are already "hardcoded" on the excel sheet. The obvious workaround is to make the column headers row hidden, but this may affect other parts of the worksheet. > I do not check for merged cells. > But R does not have a concept of merged cells, therefore the target range in > Excel should not have merged cells. > I do no explicit chech here because I do not think it is worth the effort. Same as previous point, if I'm building an excel-based application where users know nothing about R, I must format the sheets carefully to have a friendly user interface, and in Excel this unavoidably forces me to merge some cells. It seems to me that RExcel interface is more oriented to the "scratchpad" mode of "free" R data transfer than to an application-type scenario. I'll continue to use my own wrappers for this and some other functionallity. They're available if anyone is interested. Thanks again Erich for your answers and such an splendid tool. Best, Enrique -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erich Neuwirth Sent: jueves, 02 de octubre de 2008 0:03 To: R (D)COM and RExcel server related issues Subject: Re: [Rcom-l] Suggestions for RExcel Bengoechea Bartolomé Enrique (SIES 73) wrote: > Hi, > > I've been using RExcel 3.0.1 from VBA a lot lately, using the > RInterface API. A great tool. I have a number of suggestions and > issues. I'm not sure whether the right procedure is to post them here, > submit them directly to Erich, modify the Wiki.... > > I have source code patches available for all these suggestions except > the last one. > > 1) I find no way to directly determine the excel range modified by > GetDataframe and GetArray. This range is built from the upper-left > cell of the argument SheetRange, but the number of rows and cells > depends on the data, and is not returned to the client code, as far as > I've been able to determine (but I may be missing something!!). > Without this information, it's not possible to safely post-process the > returned data from VBA. The standard solution is to use use GetArrayToVBA("dim(object)") to retrieve the size information into VBA from R. > > One solution could be to make GetDataframe and GetArray be functions > instead of subroutines. They could return a reference to the whole > range where the data is written. This would not break the existing API > as VBA allows invoking functions without assignment of the return object. This is not the kind of programming style I want to use. See my earlier suggestion. > > 2) GetDataframe does not have a WithColnames argument like GetArray. I > find this argument would be very useful, as I often need to transfer > data frames into Excel without the column names. If it is added as a > new optional argument with default value True, the current API would > not be broken. The idea here is to bring together Excel's data lists and R dataframes. In Excel, data lists always have to have column names. If what you transfer is all numeric, as.matrix(dataframe) will allow you to avoid transferring the column names. But I still think that if you get a dataframe in Excel, it should and as a data list, and if you want something different, you can do it, but you are responsible in your code. > > 3) While GetArray properly handles Date objects, GetArrayToVBA and > GetRExpressionValueToVBA do not, returning numbers instead of VBA Date > objects. A few changes to RInterfaceSupport.REvalReturn can solve this > issue and make the functions behave similarly. The whole transfer mechanism currently is totally rewritten, this problem will disappear soon. > > 4) A minor bug in GetArray: Excel application calculation state is > stored at the beginning of the procedure in variable oldCalcState. > Nevertheless, this state is not restored at the end of the procedure > as I would expect. Instead, automatic recalculation is forced. > Fixed. Thanks for spotting this. > 5) The line at the end of GetArray that pastes the format > (a.PasteSpecial Paste:=xlPasteFormats) has as side effect unmerging > the cells in the target range, if they are merged. This is the only > issue I have no patch for as I'm not completely sure of all the > implications of this pasting. > I do not check for merged cells. But R does not have a concept of merged cells, therefore the target range in Excel should not have merged cells. I do no explicit chech here because I do not think it is worth the effort. Thanks for the remarks, as you will see in the next release I fixed things where easily possible already. > > Best regards, > > Enrique > > > ---------------------------------------------------------------------- > -- > > _______________________________________________ > 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 > > > ---------------------------------------------------------------------- > -- > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.169 / Virus Database: 270.7.5/1696 - Release Date: > 9/28/2008 1:30 PM > -- 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 _______________________________________________ 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