r-lib / gmailr

Access the Gmail RESTful API from R.
https://gmailr.r-lib.org
Other
229 stars 56 forks source link

gm_html_body $ operator error on character string argument #168

Closed MCOtto closed 1 year ago

MCOtto commented 2 years ago

I get an error using the function help example:

gm_html_body("Test<\b> Message") Error: $ operator is invalid for atomic vectors

I get the same error on the same on a longer string.

R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.4 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_1.0.8 readxl_1.3.1 gmailr_1.0.1

loaded via a namespace (and not attached): [1] tidyselect_1.1.2 xfun_0.29 rematch2_2.1.2 purrr_0.3.4 gargle_1.2.0 vctrs_0.3.8
[7] generics_0.1.2 testthat_3.1.2 htmltools_0.5.2 yaml_2.3.5 base64enc_0.1-3 utf8_1.2.2
[13] rlang_1.0.1 later_1.3.0 pillar_1.7.0 glue_1.6.2 withr_2.4.3 DBI_1.1.2
[19] rappdirs_0.3.3 lifecycle_1.0.1 stringr_1.4.0 cellranger_1.1.0 evaluate_0.15 knitr_1.37
[25] tzdb_0.2.0 fastmap_1.1.0 httpuv_1.6.5 curl_4.3.2 fansi_1.0.2 Rcpp_1.0.8
[31] readr_2.1.2 openssl_1.4.6 promises_1.2.0.1 desc_1.4.0 pkgload_1.2.4 jsonlite_1.8.0
[37] mime_0.12 fs_1.5.2 brio_1.1.3 askpass_1.1 hms_1.1.1 digest_0.6.29
[43] stringi_1.7.6 rprojroot_2.0.2 cli_3.2.0 tools_4.1.2 magrittr_2.0.2 tibble_3.1.6
[49] crayon_1.5.0 pkgconfig_2.0.3 ellipsis_0.3.2 rsconnect_0.8.25 assertthat_0.2.1 rmarkdown_2.11
[55] httr_1.4.2 rstudioapi_0.13 R6_2.5.1 compiler_4.1.2

jennybc commented 1 year ago

I can't reproduce this error, so I think there must have been more to the story. If you're still having trouble, please open a new issue with code that demonstrates the error.

library(gmailr)
#> 
#> Attaching package: 'gmailr'
#> The following object is masked from 'package:utils':
#> 
#>     history
#> The following objects are masked from 'package:base':
#> 
#>     body, date, labels, message

msg <- gm_mime(
  From = "james.f.hester@gmail.com",
  To = "asdf@asdf.com"
) %>%
  gm_html_body("<b>Test<\b> Message")

Created on 2023-05-02 with reprex v2.0.2.9000