-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxls.Rmd
More file actions
38 lines (25 loc) · 1.05 KB
/
xls.Rmd
File metadata and controls
38 lines (25 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Title
========================================================
This is an R Markdown document. Markdown is a simple formatting syntax for authoring web pages (click the **MD** toolbar button for help on Markdown).
When you click the **Knit HTML** button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}
require(RODBC)
conn = odbcConnectExcel2007("Mr. Nazeer Ahmed Gopang.xlsx") # open a connection to the Excel file
sqlTables(conn)$TABLE_NAME # show all sheets
df = sqlFetch(conn, "Sheet1") # read a sheet
df = sqlQuery(conn, "select * from [Sheet1 $]") # read a sheet (alternative SQL sintax)
close(conn) # close the connection to the file
```
```{r}
library(gdata)
df <- read.xls('FacultySurvey.xlsx', sheet=1, header=T)
```
```{r}
require(XLConnect)
wb = loadWorkbook("myfile.xlsx")
df = readWorksheet(wb, sheet = "Sheet1", header = TRUE)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```