Skip to content

Commit

Permalink
Pass . arguments by name.
Browse files Browse the repository at this point in the history
Add parameter names to 4 function calls in chapter data IO.
  • Loading branch information
aphalo committed Oct 19, 2019
1 parent c244067 commit aee3384
Show file tree
Hide file tree
Showing 9 changed files with 5,735 additions and 5,729 deletions.
20 changes: 10 additions & 10 deletions R.data.io.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ The functions defined in this package can be used to ``harvest'' data from web p

\section{GPX files}
\index{importing data!GPX files|(}
GPX (GPS Exchange Format) files use a XML scheme designed for saving and exchanging data from geographic positioning systems (GPS). There is some variation on the variables saved depending on the settings of the GPS receiver. The example data used here is from a Transmeta BT747 GPS logger. The example below reads the data into a \code{tibble} as character strings. For plotting, the character values representing numbers and dates would need to be converted to numeric and datetime (\code{POSIXct}) values, respectively. In the case of plotting tracks on a map, it is preferable to use package \pkgname{sf} to import the tracks directly from the \code{.gpx} file into a layer.
GPX (GPS Exchange Format) files use a XML scheme designed for saving and exchanging data from geographic positioning systems (GPS). There is some variation on the variables saved depending on the settings of the GPS receiver. The example data used here is from a Transmeta BT747 GPS logger. The example below reads the data into a \code{tibble} as character strings. For plotting, the character values representing numbers and dates would need to be converted to numeric and datetime (\code{POSIXct}) values, respectively. In the case of plotting tracks on a map, it is preferable to use package \pkgname{sf} to import the tracks directly from the \code{.gpx} file into a layer (use of the dot pipe operator is described in section \ref{sec:data:pipes} on page \pageref{sec:data:pipes}).

<<gps-01>>=
xmlTreeParse(file = "extdata/GPSDATA.gpx", useInternalNodes = TRUE) %.>%
Expand Down Expand Up @@ -800,17 +800,17 @@ the months using a pipe operator from \pkgname{wrapr} and methods from \pkgname{
hyper_tibble(meteo_data.tnc,
lon = signif(lon, 1) == 9,
lat = signif(lat, 2) == 87) %.>%
mutate(., month = month(ymd("1800-01-01") + days(time))) %.>%
select(., -time)
mutate(.data = ., month = month(ymd("1800-01-01") + days(time))) %.>%
select(.data = ., -time)
@

In this second example, we extract data for all grid points along latitudes. To achieve this we need only to omit the test for \code{lat} from the chuck above. The tibble is assembled automatically and columns for the active dimensions added. The decoding of the months remains unchanged.

<<tidync-03>>=
hyper_tibble(meteo_data.tnc,
lon = signif(lon, 1) == 9) %.>%
mutate(., month = month(ymd("1800-01-01") + days(time))) %.>%
select(., -time)
mutate(.data = ., month = month(ymd("1800-01-01") + days(time))) %.>%
select(.data = ., -time)
@

\begin{playground}
Expand Down Expand Up @@ -914,20 +914,20 @@ Meteo01.df <-
str(Meteo01.df, max.level = 2)
@

The minimum, mean and maximum values for each logging interval, need to be split from a single vector. We do this by indexing with a logical vector (recycled). The data returned is in long form, with quantity names and units also returned by the module, as well as the time (use of the dot pipe operator is described in section \ref{sec:data:pipes} on page \pageref{sec:data:pipes}).
The minimum, mean and maximum values for each logging interval, need to be split from a single vector. We do this by indexing with a logical vector (recycled). The data returned is in long form, with quantity names and units also returned by the module, as well as the time.

<<iot-02, eval=eval_yoctopuce>>=
Meteo01.df[["streams"]][[which(Meteo01.df$id == "temperature")]] %.>%
as_tibble(.) %.>%
dplyr::transmute(.,
as_tibble(x = .) %.>%
dplyr::transmute(.data = .,
utc.time = as.POSIXct(utc, origin = "1970-01-01", tz = "UTC"),
t_min = unlist(val)[c(TRUE, FALSE, FALSE)],
t_mean = unlist(val)[c(FALSE, TRUE, FALSE)],
t_max = unlist(val)[c(FALSE, FALSE, TRUE)]) -> temperature.df
Meteo01.df[["streams"]][[which(Meteo01.df$id == "humidity")]] %.>%
as_tibble(.) %.>%
dplyr::transmute(.,
as_tibble(x = .) %.>%
dplyr::transmute(.data = .,
utc.time = as.POSIXct(utc, origin = "1970-01-01", tz = "UTC"),
hr_min = unlist(val)[c(TRUE, FALSE, FALSE)],
hr_mean = unlist(val)[c(FALSE, TRUE, FALSE)],
Expand Down
30 changes: 15 additions & 15 deletions appendixes.prj
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,61 @@ using-r-main-crc.tex

using-r-main-crc.Rnw
TeX:RNW:UTF-8
17838075 0 -1 5958 -1 5423 208 208 1244 731 1 1 689 119 -1 -1 0 0 44 -1 -1 44 2 0 5423 -1 1 6866 -1 0 -1 0
17838075 0 -1 5958 -1 5423 208 208 1244 731 1 1 689 -1241 -1 -1 0 0 44 -1 -1 44 2 0 5423 -1 1 6866 -1 0 -1 0
using-r-main-crc.tex
TeX
403714043 1 -1 443026 -1 443046 0 0 977 411 1 1 601 306 -1 -1 0 0 62 -1 -1 62 1 0 443046 -1 0 -1 0
403714043 0 -1 443026 -1 442553 0 0 977 411 1 1 201 175933 -1 -1 0 0 62 -1 -1 62 1 0 442553 -1 0 -1 0
references.bib
BibTeX
1049586 0 115 3 115 12 0 0 820 242 0 1 129 595 -1 -1 0 0 23 0 0 23 1 0 12 115 0 -1 0
1049586 0 115 3 115 12 0 0 820 242 0 1 129 408 -1 -1 0 0 23 0 0 23 1 0 12 115 0 -1 0
C:\Program Files\MiKTeX 2.9\tex\latex\polyglossia\gloss-english.ldf
TeX:STY:UNIX
1159154 6 6 1 5 1 0 0 1065 329 0 0 25 68 -1 -1 0 0 66 0 0 66 1 0 1 5 0 0 0
1159154 6 6 1 5 1 0 0 1065 329 0 0 25 51 -1 -1 0 0 66 0 0 66 1 0 1 5 0 0 0
using-r-main-crc.aux
TeX:AUX:UNIX
1159154 7 13 1 12 1 256 256 2196 867 1 0 73 204 -1 -1 0 0 7 0 0 7 1 0 1 12 0 0 0
1159154 7 13 1 12 1 256 256 2196 867 1 0 73 187 -1 -1 0 0 7 0 0 7 1 0 1 12 0 0 0
using-r-main-crc.toc
TeX:AUX:UNIX
1159154 7 3 1 2 1 288 288 2228 899 1 0 73 34 -1 -1 0 0 103 0 0 103 1 0 1 2 0 0 0
1159154 7 3 1 2 1 288 288 2228 899 1 0 73 17 -1 -1 0 0 103 0 0 103 1 0 1 2 0 0 0
using-r-main-crc.lof
TeX:AUX:UNIX
1159154 7 3 1 2 1 0 0 1940 611 1 0 73 34 -1 -1 0 0 103 0 0 103 1 0 1 2 0 0 0
frontmatter\preface.tex
TeX
1060859 0 -1 10014 -1 8841 130 130 1573 499 0 1 369 119 -1 -1 0 0 18 -1 -1 18 1 0 8841 -1 0 -1 0
1060859 0 -1 10014 -1 8841 130 130 1573 499 0 1 369 102 -1 -1 0 0 18 -1 -1 18 1 0 8841 -1 0 -1 0
R.intro.Rnw
TeX:RNW
17838075 0 -1 38405 -1 32 182 182 1218 705 1 1 89 -7707 -1 -1 0 0 261 -1 -1 261 1 0 32 -1 0 -1 0
17838075 0 -1 38405 -1 32 182 182 1218 705 1 1 89 17 -1 -1 0 0 261 -1 -1 261 1 0 32 -1 0 -1 0
R.as.calculator.Rnw
TeX:RNW
17838075 0 -1 78776 -1 78827 26 26 1062 549 1 1 497 357 -1 -1 0 0 31 -1 -1 31 3 0 78827 -1 1 18261 -1 2 29910 -1 0 -1 0
R.scripts.Rnw
TeX:RNW
17838075 0 -1 27358 -1 27363 78 78 1114 601 1 1 265 323 -1 -1 0 0 31 -1 -1 31 2 0 27363 -1 1 59275 -1 0 -1 0
17838075 0 -1 27358 -1 27363 78 78 1114 601 1 1 265 306 -1 -1 0 0 31 -1 -1 31 2 0 27363 -1 1 59275 -1 0 -1 0
R.stats.rnw
TeX:RNW
17838075 0 -1 48508 -1 48537 26 26 931 556 1 1 321 221 -1 -1 0 0 31 -1 -1 31 3 0 48537 -1 1 59456 -1 2 63140 -1 0 -1 0
17838075 0 -1 48508 -1 48537 26 26 931 556 1 1 321 204 -1 -1 0 0 31 -1 -1 31 3 0 48537 -1 1 59456 -1 2 63140 -1 0 -1 0
R.functions.Rnw
TeX:RNW
17838075 0 -1 30645 -1 30474 130 130 1166 653 1 1 289 357 -1 -1 0 0 264 -1 -1 264 1 0 30474 -1 0 -1 0
R.data.Rnw
TeX:RNW
17838075 0 -1 858 -1 858 26 26 977 443 1 1 89 -2652 -1 -1 0 0 31 -1 -1 31 2 0 858 -1 1 41467 -1 0 -1 0
17838075 0 -1 858 -1 858 26 26 977 443 1 1 89 306 -1 -1 0 0 31 -1 -1 31 2 0 858 -1 1 41467 -1 0 -1 0
R.plotting.Rnw
TeX:RNW
17838075 0 -1 3351 -1 178856 130 130 1166 559 1 1 97 102 -1 -1 0 0 31 -1 -1 31 3 0 178856 -1 1 143992 -1 2 110771 -1 0 -1 0
17838075 0 -1 3351 -1 178856 130 130 1166 559 1 1 97 68 -1 -1 0 0 31 -1 -1 31 3 0 178856 -1 1 143992 -1 2 110771 -1 0 -1 0
C:\Program Files\MiKTeX 2.9\tex\latex\biblatex\biblatex.sty
TeX:STY:UNIX
1159154 0 0 1 0 1 64 64 977 575 0 0 25 0 -1 -1 0 0 42 0 0 42 1 0 1 0 0 0 0
R.data.io.Rnw
TeX:RNW
17838075 0 -1 61181 -1 61250 0 0 1498 379 1 1 241 323 -1 -1 0 0 31 -1 -1 31 1 0 61250 -1 0 -1 0
17838075 2 -1 60830 -1 60833 0 0 1498 379 1 1 265 306 -1 -1 0 0 31 -1 -1 31 1 0 60833 -1 0 -1 0
usingr.sty
TeX:STY
1060850 1 52 13 52 22 234 234 1270 724 0 0 193 374 -1 -1 0 0 25 0 0 25 1 0 22 52 0 0 0
1060850 1 52 13 52 22 234 234 1270 724 0 0 193 357 -1 -1 0 0 25 0 0 25 1 0 22 52 0 0 0
rbooks.bib
BibTeX:UNIX
1147890 0 331 38 328 36 52 52 872 313 1 1 369 595 -1 -1 0 0 21 0 0 21 1 0 36 328 0 -1 0
1147890 0 331 38 328 36 52 52 872 313 1 1 369 408 -1 -1 0 0 21 0 0 21 1 0 36 328 0 -1 0
C:\ProgramData\MiKTeX\2.9\miktex\log\miktex-fc-cache_admin.log
DATA
273678578 0 0 1 0 1 32 32 2042 643 1 0 87 0 -1 -1 0 0 -1 -1 -1 -1 1 0 1 0 0 0 0
Expand Down
10 changes: 5 additions & 5 deletions using-r-main-crc.idx
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@
\indexentry{reticulate@\textsf {`reticulate'}}{318}
\indexentry{packages!reticulate@\textsf {`reticulate'}}{318}
\indexentry{importing data!physical devices|)}{318}
\indexentry{importing data!databases|(}{319}
\indexentry{importing data!databases|(}{318}
\indexentry{dbplyr@\textsf {`dbplyr'}}{319}
\indexentry{packages!dbplyr@\textsf {`dbplyr'}}{319}
\indexentry{dplyr@\textsf {`dplyr'}}{319}
Expand All @@ -1386,10 +1386,10 @@
\indexentry{packages!dbplyr@\textsf {`dbplyr'}}{319}
\indexentry{learnrbook@\textsf {`learnrbook'}}{319}
\indexentry{packages!learnrbook@\textsf {`learnrbook'}}{319}
\indexentry{dbplyr@\textsf {`dbplyr'}}{320}
\indexentry{packages!dbplyr@\textsf {`dbplyr'}}{320}
\indexentry{dplyr@\textsf {`dplyr'}}{320}
\indexentry{packages!dplyr@\textsf {`dplyr'}}{320}
\indexentry{dbplyr@\textsf {`dbplyr'}}{319}
\indexentry{packages!dbplyr@\textsf {`dbplyr'}}{319}
\indexentry{dplyr@\textsf {`dplyr'}}{319}
\indexentry{packages!dplyr@\textsf {`dplyr'}}{319}
\indexentry{importing data!databases|)}{320}
\indexentry{further reading!elegant R code}{320}
\indexentry{further reading!idiosyncracies or R}{320}
2 changes: 1 addition & 1 deletion using-r-main-crc.ilg
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Scanning input file using-r-main-crc.idx....
!! Input index error (file = using-r-main-crc.idx, line = 999):
-- Extra `!' at position 18 of first argument.
.done (1385 entries accepted, 10 rejected).
Sorting entries..............done (16357 comparisons).
Sorting entries..............done (16353 comparisons).
Generating output file using-r-main-crc.ind....
## Warning (input = using-r-main-crc.idx, line = 477; output = using-r-main-crc.ind, line = 6):
-- Conflicting entries: multiple encaps for the same page under same key.
Expand Down
10 changes: 5 additions & 5 deletions using-r-main-crc.ind
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
\subitem subsetting, 70
\item data manipulation in the tidyverse, 190--198
\item \textsf {`data.table'}, 165, 178--180
\item \textsf {`dbplyr'}, 190, 319, 320
\item \textsf {`dbplyr'}, 190, 319
\item deleting objects, \see {removing objects}{24}
\item density plots, 241
\item devices
Expand All @@ -99,7 +99,7 @@
\subitem quantiles from probabilities, 120
\item dot-pipe operator, 186
\item \textsf {`dplyr'}, 178, 179, 186, 189, 190, 192, 194, 195, 197,
314, 319, 320
314, 319
\item \textsf {`dtplyr'}, 190

\indexspace
Expand Down Expand Up @@ -237,7 +237,7 @@
\item importing data
\subitem .ods files, 308--309
\subitem .xlsx files, 306--308
\subitem databases, 319--320
\subitem databases, 318--320
\subitem GPX files, 305
\subitem jsonlite, 317
\subitem NeCDF files, 311--315
Expand Down Expand Up @@ -406,10 +406,10 @@
\subitem \textsf {`blogdown'}, 91
\subitem \textsf {`bookdown'}, 91
\subitem \textsf {`data.table'}, 165, 178--180
\subitem \textsf {`dbplyr'}, 190, 319, 320
\subitem \textsf {`dbplyr'}, 190, 319
\subitem \textsf {`devtools'}, 162
\subitem \textsf {`dplyr'}, 178, 179, 186, 189, 190, 192, 194, 195,
197, 314, 319, 320
197, 314, 319
\subitem \textsf {`dtplyr'}, 190
\subitem \textsf {`extrafont'}, 225
\subitem \textsf {`foreign'}, 77, 309, 310, 316
Expand Down
2 changes: 1 addition & 1 deletion using-r-main-crc.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
>
]>
<requests version="1.0">
<internal package="biblatex" priority="9" active="1">
<internal package="biblatex" priority="9" active="0">
<generic>latex</generic>
<provides type="dynamic">
<file>using-r-main-crc.bcf</file>
Expand Down
Loading

0 comments on commit aee3384

Please sign in to comment.