Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to base R #27

Merged
merged 17 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 0 additions & 126 deletions CODE_OF_CONDUCT.md

This file was deleted.

120 changes: 60 additions & 60 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
Package: bvq
Title: Barcelona Vocabulary Questionnaire Database and Helper Functions
Version: 0.3.2
Authors@R: c(
person(given = "Gonzalo", family = "Garcia-Castro",
email = "[email protected]",
role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-8553-4209")),
person(given = "Daniela S. ", family = "Ávila-Varela",
email = "[email protected]",
role = "aut",
comment = c(ORCID = "0000-0002-3518-8117")),
person(given = "Nuria",
family = "Sebastian-Galles",
email = "[email protected]",
role = "ctb",
comment = c(ORCID = "0000-0001-6938-2498")))
Maintainer: Gonzalo Garcia-Castro <[email protected]>
Description: Download, clean, and process the Barcelona Vocabulary
Questionnaire (BVQ) data. BVQ is a vocabulary inventory developed for
assesing the vocabulary of Catalan-Spanish bilinguals infants from the
Metropolitan Area of Barcelona (Spain). This
package includes functions to download the data from formr servers,
and return the processed data in multiple formats.
License: MIT + file LICENSE
URL: https://gongcastro.github.io/bvq/,
https://github.com/gongcastro/bvq/
BugReports: https://github.com/gongcastro/bvq/issues
Depends:
R (>= 3.5.0),
Imports:
cli (>= 3.6.1),
dplyr (>= 1.1.0),
formr (>= 0.9.1),
googlesheets4 (>= 1.0.0),
janitor (>= 2.2.0),
lifecycle (>= 1.0.3),
lubridate (>= 1.8.0),
magrittr (>= 2.0.3),
rlang (>= 1.1.1),
tibble (>= 3.2.1),
tidyr (>= 1.2.0)
Suggests:
knitr,
readxl,
rmarkdown,
roxygen2,
testthat (>= 3.0.0),
ggplot2 (>= 3.4.2),
withr
VignetteBuilder:
knitr
Remotes:
github::rubenarslan/formr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Package: bvq
Title: Barcelona Vocabulary Questionnaire Database and Helper Functions
Version: 0.3.2
Authors@R: c(
person(given = "Gonzalo", family = "Garcia-Castro",
email = "[email protected]",
role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-8553-4209")),
person(given = "Daniela S. ", family = "Ávila-Varela",
email = "[email protected]",
role = "aut",
comment = c(ORCID = "0000-0002-3518-8117")),
person(given = "Nuria",
family = "Sebastian-Galles",
email = "[email protected]",
role = "ctb",
comment = c(ORCID = "0000-0001-6938-2498")))
Maintainer: Gonzalo Garcia-Castro <[email protected]>
Description: Download, clean, and process the Barcelona Vocabulary
Questionnaire (BVQ) data. BVQ is a vocabulary inventory developed for
assesing the vocabulary of Catalan-Spanish bilinguals infants from the
Metropolitan Area of Barcelona (Spain). This
package includes functions to download the data from formr servers,
and return the processed data in multiple formats.
License: MIT + file LICENSE
URL: https://gongcastro.github.io/bvq/,
https://github.com/gongcastro/bvq/
BugReports: https://github.com/gongcastro/bvq/issues
Depends:
R (>= 3.5.0),
Imports:
cli (>= 3.6.1),
dplyr (>= 1.1.0),
formr (>= 0.9.1),
googlesheets4 (>= 1.0.0),
janitor (>= 2.2.0),
lifecycle (>= 1.0.3),
lubridate (>= 1.8.0),
magrittr (>= 2.0.3),
rlang (>= 1.1.1),
tibble (>= 3.2.1),
tidyr (>= 1.2.0)
Suggests:
knitr,
readxl,
rmarkdown,
roxygen2,
testthat (>= 3.0.0),
ggplot2 (>= 3.4.2),
withr
VignetteBuilder:
knitr
Remotes:
github::rubenarslan/formr
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
4 changes: 0 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ export(bvq_responses)
export(bvq_vocabulary)
export(enquo)
export(enquos)
export(flatten_xsampa)
export(get_doe)
export(get_longitudinal)
export(prop_adj)
export(syllabify_xsampa)
export(syllable_str_xsampa)
import(dplyr)
import(rlang)
importFrom(cli,cli_abort)
Expand Down Expand Up @@ -54,7 +51,6 @@ importFrom(lubridate,today)
importFrom(magrittr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,.env)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,enquo)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# bvq 0.4.0

* Switch most functions to base R. I made this decision in order to learn R base a bit better. Performance differences are negligible, and the user interface remains the same.
* Phonology functions and datasets have been removed, and will be included in a different package.
* `bvq_vocabulary()` now has a better naming system.

# bvq 0.3.2

* Refactor `bvq_vocabulary()` and `bvq_norms()` to use rlang and the dynamic dots (`...`) (#20) operator
Expand Down
102 changes: 52 additions & 50 deletions R/connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,62 @@
#'
bvq_connect <- function(google_email = NULL,
password = NULL) {
formr_email <- "[email protected]"

# ask for email in console is everything is NULL
if (is.null(google_email)) google_email <- formr_email

if (is.null(password)) {
password <- Sys.getenv("FORMR_PWD", unset = NA)
if (is.na(password)) {
cli_abort("Please, provide a password")
formr_email <- "[email protected]"

# ask for email in console is everything is NULL
if (is.null(google_email)) google_email <- formr_email

if (is.null(password)) {
password <- Sys.getenv("FORMR_PWD", unset = NA)
if (is.na(password)) {
cli_abort("Please, provide a password")
}
}
}

# if key exists, use it to log in
tryCatch(
suppressWarnings(
formr_connect(
email = formr_email,
password = password,
host = "https://formr.org/"
)
),
error = function(e) {
cli_abort(
strwrap(
prefix = " ",
initial = "",
"Could not connect to {.url https://formr.org/}. \

# if key exists, use it to log in
tryCatch(
suppressWarnings(
formr::formr_connect(
email = formr_email,
password = password,
host = "https://formr.org/"
)
),
error = function(e) {
cli_abort(
strwrap(
prefix = " ",
initial = "",
"Could not connect to {.url https://formr.org/}. \
Please check your internet connection or \
make sure you have set the right formr password."
)
)
}
)

# check if Google credentials exists, ask for them if not
if (!gs4_has_token()) {
tryCatch(
suppressWarnings(gs4_auth(
email = google_email,
token = Sys.getenv("GOOGLE_TOKEN", unset = NA)
)),
error = function(e) {
cli_abort(
strwrap(
prefix = " ",
initial = "",
"Could not connect to Google.\
)
)
}
)

# check if Google credentials exists, ask for them if not
if (!gs4_has_token()) {
tryCatch(
suppressWarnings({
googlesheets4::gs4_auth(
email = google_email,
token = Sys.getenv("GOOGLE_TOKEN", unset = NA)
)
}),
error = function(e) {
cli_abort(
strwrap(
prefix = " ",
initial = "",
"Could not connect to Google.\
Please check your internet connection or \
grant the necessary permissions."
)
)
)
}
)
}
)
}

invisible(gs4_has_token())
}

invisible(googlesheets4::gs4_has_token())
}
Loading
Loading