Use R Through Excel
If R Through Excel has been installed on your Windows partition, you should be able to start it up by double clicking on an icon on the desktop that says R Excel2007 with R Commander. You'll probably need to wait a couple minutes. Eventually there will be a bunch of windows showing up. One of them is an R Console window. Whenever you click into that window all the non-R windows seem to disappear. Ditto for when you have a graphics window up (which you won't initially). I rearranged them to like like the picture below.
The R commander menus can now be found under the Ad-ins ribbon on the Excel Spreadsheet. They are no longer in the R Commander window.
This paper is very helpful:
To get data from R into a spreadsheet, try this.
- In the R script window put in an expression like this:
- x <- 1:10
- y <- rnorm(10,x)
- Then evaluate them with "Submit".
- In the Excel window, right click on a cell. That should bring up a menu from which you can select, get R value. Then type x or y (or the name of some other R variable that has a value). The variable's value will be put into the spreadsheet there. If it was a vector of length 10, it will fill 10 cells of a column.
To get data from the spreadsheet into R, try this.
- Highlight a section of the spreadsheet that you want to turn into a dataframe.
- Make sure you highlight the row of labels above the columns. It's best if they are not blank.
- Right click in the highlighted region.
- Select Put R Dataframe.
- A pop-up dialog box will ask you what you want to name the dataframe. Give it a name.
- Click OK.