Using R function in Excel
Dear John,
The R Workbench (biocep project) comes with a powerful Spreadsheet view
fully connected to an R session. you can use it to do exactly what you
want and it has much more features :
from within the spreadsheet view you can :
*import any R Data (numeric, integer, character, logical, complex,
factor, matrix, data frame ) via the toolbar button import from R
(R+arrow towards the spreadsheet)
*export selected cells to R and assign the content of the cells to
an R variable via the toolbar button export to R (R+arrow towards
R)
you specify the type of export (numeric, integer, character,
logical, complex, factor, data frame )
for data frame, you should append to the column name the type of
the column between parathesis ("weight(integer)",
"mesure1(numeric)", "state(factor)", ..)
* Evaluate an R expression and use the current selection as
argument (the toolbar button R evaluate (R+ruuning man))
for example you can type "t(%%)" in the R Expression field. This
transposes the selected cells matrix. The result is sent to the
clipboard and you can paste on will
* type in a cell an expression to evaluate and use any R fucntion,
example in A4 type "=mean(A1:A3)" the content of A4 will be
computed using R fucntion mean and the
cell value will be the mean of the vector A1:A3. all the R
functions dealing with numeric vectors or matrixes can be used
* Copy/Paste to and from Excel
* create as many SpreadSheet Views as needed and specify the
suitable dimensions
on windows and Mac OS, you can use this link to install the R Workbench
http://www.ebi.ac.uk/microarray-srv/frontendapp/rworkbench.jnlp
for more information :
http://www.ebi.ac.uk/microarray-srv/frontendapp/BIOCEP_README.txt
Karim
Does anyone know a way that an function written in R can be called within
a cell of an Excel spreadsheet. I would like to use the R function much as
I use the native Excel functions, e.g. instead of using the excel function
sum, =sum(A2,A6), I would like to use the function mysum written in R,
e.g. =mysum(A2,A6).
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.