Skip to content

Commit 5affe1a

Browse files
committed
styler updates
1 parent 116c592 commit 5affe1a

File tree

7 files changed

+28
-32
lines changed

7 files changed

+28
-32
lines changed

R/connection-pin-write.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,3 @@ write_pin_conn.tbl_conn <- function(x, board, ...) {
5959
)
6060
invisible()
6161
}
62-
63-
64-

R/connection-view.R

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,19 @@ connection_view.DBIConnection <- function(con, connection_code = "", host = "",
4747
name = name,
4848
host = host,
4949
connect_script = connect_code,
50-
disconnect_code = function()
51-
connection_close(con, host = host),
52-
object_list = function(catalog = NULL, schema = NULL, ...)
53-
dbi_list_objects(catalog, schema, sch, name, type, con),
50+
disconnect_code = function() {
51+
connection_close(con, host = host)
52+
},
53+
object_list = function(catalog = NULL, schema = NULL, ...) {
54+
dbi_list_objects(catalog, schema, sch, name, type, con)
55+
},
5456
object_columns = function(catalog = NULL, schema = NULL,
55-
table = NULL, view = NULL, ...)
56-
dbi_list_columns(catalog, schema, table, view, sch, con),
57-
preview_code = function(limit, table, schema, ...)
57+
table = NULL, view = NULL, ...) {
58+
dbi_list_columns(catalog, schema, table, view, sch, con)
59+
},
60+
preview_code = function(limit, table, schema, ...) {
5861
dbi_preview_object(limit, table, schema, sch, con)
62+
}
5963
)
6064
rscontract_open(spec_contract)
6165
}

R/dbi-utils.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ top_rows <- function(limit = 10, table, schema, sch, con) {
104104
item_to_table <- function(item) {
105105
t <- lapply(
106106
item,
107-
function(x) data_frame(
107+
function(x) {
108+
data_frame(
108109
name = x$name,
109110
type = x$type
110111
)
112+
}
111113
)
112114
tbls <- NULL
113115
for (j in seq_along(t)) {

R/dplyr-methods.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ copy_to.connConnection <- function(dest,
1111
df,
1212
name = deparse(substitute(df)),
1313
overwrite = FALSE,
14-
...
15-
) {
14+
...) {
1615
ct <- copy_to(
1716
dest = dest@con,
1817
df = df,

README.Rmd

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ output: github_document
55
<!-- README.md is generated from README.Rmd. Please edit that file -->
66

77
```{r, include = FALSE}
8-
9-
if(dir.exists("~/pins")) unlink("~/pins", recursive = TRUE)
8+
if (dir.exists("~/pins")) unlink("~/pins", recursive = TRUE)
109
1110
knitr::opts_chunk$set(
1211
collapse = TRUE,
@@ -17,7 +16,7 @@ knitr::opts_chunk$set(
1716
)
1817
1918
add_figure <- function(path, width = 400) {
20-
char_html <- paste0("<img src='", path,"' width ='", width,"px'/><br/>")
19+
char_html <- paste0("<img src='", path, "' width ='", width, "px'/><br/>")
2120
htmltools::HTML(char_html)
2221
}
2322
@@ -34,10 +33,10 @@ toc <- function() {
3433
seq_along(titles),
3534
function(x) {
3635
pad <- ifelse(substr(only_titles[x], 1, 3) == "###", " - ", " - ")
37-
paste0(pad, "[", titles[x], "](#",links[x], ")")
36+
paste0(pad, "[", titles[x], "](#", links[x], ")")
3837
}
3938
)
40-
toc_full <- paste(toc_list, collapse = "\n")
39+
toc_full <- paste(toc_list, collapse = "\n")
4140
cat(toc_full)
4241
}
4342
```
@@ -89,7 +88,7 @@ library(RSQLite)
8988
library(dplyr)
9089
library(pins)
9190
92-
if(file.exists("local.sqlite")) unlink("local.sqlite")
91+
if (file.exists("local.sqlite")) unlink("local.sqlite")
9392
```
9493

9594
## Functions
@@ -246,7 +245,7 @@ con <- connection_pin_read(board, "my_conn")
246245
tbl_summary <- con %>%
247246
tbl("mtcars") %>%
248247
group_by(cyl) %>%
249-
summarise(avg_mpg = mean(mpg, na.rm = TRUE))
248+
summarise(avg_mpg = mean(mpg, na.rm = TRUE))
250249
251250
252251
connection_pin_write(board, tbl_summary, name = "cyl_mpg")
@@ -293,14 +292,14 @@ connection_close(con)
293292
library(connections)
294293
library(RPostgres)
295294
con <- connection_open(
296-
Postgres(),
297-
host = "localhost",
295+
Postgres(),
296+
host = "localhost",
298297
dbname = "datawarehouse",
299-
user = "[user id]",
300-
password = "[password]",
298+
user = "[user id]",
299+
password = "[password]",
301300
bigint = "integer",
302301
port = "5432"
303-
)
302+
)
304303
```
305304

306305
`r add_figure("man/figures/postgres-1.png")`

tests/testthat/helper-init.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
test_env <- new.env()
22

33
test_connection <- function() {
4-
if(is.null(test_env$con)) {
4+
if (is.null(test_env$con)) {
55
test_env$con <- connection_open(RSQLite::SQLite(), path = "local.sqlite")
66
}
77
test_env$con
88
}
99

1010
test_board <- function() {
11-
if(is.null(test_env$board)) {
11+
if (is.null(test_env$board)) {
1212
test_env$board <- board_temp()
1313
}
1414
test_env$board
1515
}
16-
17-

tests/testthat/test-dbi.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
test_that("copy_to() works", {
52
con <- test_connection()
63
expect_silent(copy_to(con, mtcars))

0 commit comments

Comments
 (0)