Skip to content

Commit

Permalink
Starter for 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Jan 29, 2021
1 parent 24dacca commit bafb1a2
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^.*\.Rproj$
^\.Rproj\.user$
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Rproj.user
.Rhistory
*.Rds
16 changes: 16 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Package: carmatch
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person(given = "First",
family = "Last",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: `use_mit_license()`, `use_gpl3_license()` or friends to
pick a license
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by roxygen2: do not edit by hand

24 changes: 24 additions & 0 deletions R/carmatch.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# single place for functions (for now)
cm_get = function(u = "https://www.eea.europa.eu/data-and-maps/data/co2-cars-emission-18/co2-emissions-cars-2017-provisional/co2_passengers_cars_v15_csv/at_download/file", dir = tempdir()) {
f = file.path(dir, "co2.zip")
dd = file.path(dir, "co2")
if(!file.exists(f)) {
download.file(u, f)
dir.create(dd)
unzip(f, exdir = dd)
}
f = list.files(dd, full.names = TRUE)
print(f)
# every single car type

read.csv(
f, fileEncoding = "UTF-16", sep = "\t", header = FALSE
)
# fails:
# readr::read_tsv(f, locale = readr::locale(encoding="UTF-16"))


}
d_raw = cm_get()
system.time(saveRDS(d_raw, "d_raw_euco2.Rds"))
# 35s on fast computer! 40 MB
22 changes: 22 additions & 0 deletions carmatch.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace

0 comments on commit bafb1a2

Please sign in to comment.