Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: close DB connection in appendix A example
- Loading branch information
Showing
10 changed files
with
873 additions
and
11 deletions.
There are no files selected for viewing
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
CodeExamples/x0A_Working_with_R_and_other_tools/00226_informalexample_A.1_of_section_A.1.5.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# informalexample A.1 of section A.1.5 | ||
# (informalexample A.1 of section A.1.5) : Working with R and other tools : Installing the tools : R resources | ||
|
||
install.packages('ctv') | ||
install.packages('ctv',repos='https://cran.r-project.org') | ||
library('ctv') | ||
install.views('TimeSeries') | ||
# install.views('TimeSeries') # can take a LONG time | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ x <- 2 | |
x < - 3 | ||
## [1] FALSE | ||
print(x) | ||
[1] 2 | ||
## [1] 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
RunExamples/replacements/00233_informalexample_A.4_of_section_A.2.1.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# informalexample A.4 of section A.2.1 | ||
# (informalexample A.4 of section A.2.1) : Working with R and other tools : Starting with R : Primary features of R | ||
|
||
tryCatch(add(1,'fred'), | ||
error=function(x) print(x)) | ||
## Error in a + b : non-numeric argument to binary operator | ||
|
29 changes: 29 additions & 0 deletions
29
RunExamples/replacements/00244_example_A.14_of_section_A.3.4.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# example A.14 of section A.3.4 | ||
# (example A.14 of section A.3.4) : Working with R and other tools : Using databases with R : An example SQL data transformation task | ||
# Title: Assembling many rows using SQL | ||
|
||
options(gsubfn.engine = "R") | ||
library('sqldf') | ||
joined <- sqldf(' | ||
select | ||
bCurrent.date as StayDate, | ||
bCurrent.daysBefore as daysBefore, | ||
bCurrent.nDaysBefore as nDaysBefore, | ||
p.price as price, | ||
bCurrent.bookings as bookingsCurrent, | ||
bPrevious.bookings as bookingsPrevious, | ||
bCurrent.bookings - bPrevious.bookings as pickup | ||
from | ||
bthin bCurrent | ||
join | ||
bthin bPrevious | ||
on | ||
bCurrent.date=bPrevious.date | ||
and bCurrent.nDaysBefore+1=bPrevious.nDaysBefore | ||
join | ||
pthin p | ||
on | ||
bCurrent.date=p.date | ||
and bCurrent.nDaysBefore=p.nDaysBefore | ||
') | ||
print(joined) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters