Skip to content

Commit 0d8dd82

Browse files
reload
1 parent 5798563 commit 0d8dd82

File tree

11 files changed

+137
-40
lines changed

11 files changed

+137
-40
lines changed

Rtutorial.md

-11
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,7 @@ library(RODBC) channel <- odbcConnectExcel("bdr.xls") ## list the spreadsheets >
9797
TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS 1 C:\\bdr NA Sheet1$ SYSTEM TABLE NA 2 C:\\bdr NA Sheet2$ SYSTEM TABLE NA 3 C:\\bdr NA Sheet3$ SYSTEM TABLE NA 4 C:\\bdr NA Sheet1$Print_Area TABLE NA
9898
sh1 <- sqlFetch(channel, "Sheet1") sh1 <- sqlQuery(channel, "select * from [Sheet1$]")
9999

100-
#### Reading and Writing Data
101100

102-
Connections
103-
Connections provide a flexible way for R to read data from a variety of sources, providing more complete control over the nature of the connection than simply specifying a file name as input to functions like read.table and scan.
104-
file: files on the local file system
105-
pipe: output from a command
106-
textConnection: treats text as a file
107-
gzfile: local gzipped file
108-
unz: local zip archive (with single file; read-only)
109-
bzfile: local bzipped file
110-
url: remote file read via http
111-
socketConnection: socket for client/server programs
112101

113102
##### Examples
114103
Skip last lines of a data file (e.g. last two lines):
File renamed without changes.
File renamed without changes.

Tidyverse/index.Rmd

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "R Workshop"
3+
output:
4+
flexdashboard::flex_dashboard:
5+
theme: united
6+
css: style.css
7+
---
8+
9+
```{r setup, include=FALSE}
10+
knitr::opts_chunk$set(echo = TRUE)
11+
12+
```
13+
14+
Introduction
15+
==================================
16+
Column {.tabset}
17+
--------------------
18+
19+
### Introduction
20+
21+
22+
23+
<div style="margin-left: auto;
24+
margin-right: auto;
25+
width: 80%">
26+
27+
| <b> <strong><u>Contents</u> </strong></b> |
28+
|:------------------|
29+
| |
30+
| * <b> <strong><a href="actuarialexams.html">R for actuarial students</a> - CS1B and CS2B </strong></b>|
31+
| * <b> <strong><a href="distributions.html">Probability Distributions</a> </strong></b>|
32+
| |
33+
</div>
34+
35+
36+
37+
---------------------------------------
38+
39+
40+
```{r child="Segments/intro_dlyr.Rmd"}
41+
```
42+
43+
```{r child = "Segments/importing_data.Rmd"}
44+
```

Tidyverse/readr_R_package.Rmd

+7-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11

2-
%- http://blog.revolutionanalytics.com/2015/04/new-packages-for-reading-data-into-r-fast.html
3-
4-
%==
52

63
{Importing Data}
4+
=======================
75

86

97
New packages for reading data into R — fast
108
Hadley Wickham and the RStudio team have created some new packages for R, which will be very useful for anyone who needs to read data into R (that is, everyone). The readr package provides functions for reading text data into R, and the readxl package provides functions for reading Excel spreadsheet data into R. Both are much faster than the functions you're probably using now.
119

12-
%==
13-
14-
{Importing Data}
1510

1611

1712
The readr package provides several functions for reading tabular text data into R. This is a task normally accomplished with the read.table family of functions in R, and readr provides a number of replacement functions that provide additional functionality and are much faster.
1813

19-
%==
2014

21-
{Importing Data}
15+
%- http://blog.revolutionanalytics.com/2015/04/new-packages-for-reading-data-into-r-fast.html
16+
17+
18+
2219

2320

2421
First, there's read_table which provides a near-replacement for read.table. Here's a comparison of using both functions on a file with 4 million rows of data (which I created by stacking copies of this file):
@@ -51,19 +48,15 @@ dat2 <- read.fwf("biggerfile.txt", c(3,15,16,12),
5148
\end{verbatim}
5249
\end{framed}
5350

54-
%==
55-
56-
{Importing Data}
51+
----------------------------
5752

5853

5954
While readr's read_fwf again accomplished the task in about a second, the standard read.fwf took over 3 minutes — almost 200 times as long.
6055

6156
Other functions in the package include read_csv (and a European-friendly variant read_csv2) for comma-separated data, read_tsv for tab-separated data, and read_lines for line-by-line file extraction (great for complicated post-processing). The package also makes it much easier to read columns of dates in various formats, and sensibly always handles text data as strings (no more strings.as.factors=FALSE).
6257

6358

64-
%==
65-
66-
{Importing Data}
59+
----------------------------
6760

6861

6962
For data in Excel format, there's also the new readxl package. This package provides function to read Excel worksheets in both .xls and .xlsx formats. I haven't benchmarked the read_excel function myself, but like the readr functions it's based on a C++ library so should be quite snappy. And best of all, it has no external dependencies, so you can use it to read Excel data on just about any platform — there's no requirement that Excel itself be installed.

Tidyverse/style.css

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* Whole document: */
2+
body{
3+
font-family: Helvetica;
4+
font-size: 16pt;
5+
}
6+
/* Headers */
7+
h1,h2,h3{
8+
font-size: 24pt;
9+
}
10+
h4,h5,h6{
11+
font-size: 20pt;
12+
font-weight: bold;
13+
}
14+
15+
pre {
16+
background: #ADD8E6;
17+
max-width: 100%;
18+
overflow-x: scroll;
19+
}
20+
21+
a {
22+
color: #000082;
23+
}
24+
25+
.container {
26+
display: flex;
27+
flex-direction: row;
28+
justify-content: left;
29+
align-items: stretch;
30+
31+
width: 50%;
32+
height: 50%;
33+
34+
border-radius: 0px;
35+
background-color: hsl(0, 0%, 96%);
36+
}
37+
38+
.box {
39+
border-radius: 4px;
40+
display: flex;
41+
}
42+
43+
.box img {
44+
width: 60%;
45+
object-fit: contain;
46+
border-radius: 4px;
47+
}
48+

Working_With_Dashboards/Creating_Dashboards.txt

-12
This file was deleted.

Working_With_Dashboards/index.Rmd

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ Rsconnect
3636
Shiny App
3737
Deployment
3838

39+
Deployment strategies
40+
Dashboards
41+
Flexdashboard
42+
shiny.
43+
44+
Deployment on Rsconnect
45+
46+
47+
### Flex Dashboards
48+
49+
Simple in Construction
50+
Uses RMD files to build a HTML page
51+
3952
--------------------------------
4053

4154
### Deplying Your Shiny App

Working_With_Images/magick.Rmd

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
magicK Rpackage
1+
### magicK Rpackage
22

3-
The magick package: Advanced Image-Processing in R • magick (ropensci.org)
4-
Colour palettes
3+
The magick package: Advanced Image-Processing in R magick (ropensci.org)
4+
5+
6+
7+
The magick package provide a modern and simple toolkit for image processing in R. It wraps the ***ImageMagick STL*** which is the most comprehensive open-source image processing library available today.
8+
9+
The ImageMagick library has an overwhelming amount of functionality. Magick exposes a decent subset of it, but it is impossible to document everything in detail. This article introduces some basic concepts and examples to get started.
10+
11+
12+
### colours
13+
14+
Colour palettes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#### Reading and Writing Data
2+
3+
Connections
4+
Connections provide a flexible way for R to read data from a variety of sources, providing more complete control over the nature of the connection than simply specifying a file name as input to functions like read.table and scan.
5+
file: files on the local file system
6+
pipe: output from a command
7+
textConnection: treats text as a file
8+
gzfile: local gzipped file
9+
unz: local zip archive (with single file; read-only)
10+
bzfile: local bzipped file
11+
url: remote file read via http
12+
socketConnection: socket for client/server programs

0 commit comments

Comments
 (0)