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