1

I've looked through a bunch of links so far, but so far none of them seems to solve my issue with installing the usethis package or getting my Git tab to work in R. For context, my session_info is below and I have just downloaded R and RStudio (along with restarting my session from scratch):

setting  value
 version  R version 4.3.0 (2023-04-21 ucrt)
 os       Windows 11 x64 (build 22621)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  Chinese (Simplified)_China.utf8
 ctype    Chinese (Simplified)_China.utf8
 tz       Asia/Shanghai
 date     2023-05-23
 rstudio  2023.03.1+446 Cherry Blossom (desktop)
 pandoc   NA

─ Packages ─────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.2.2)
 cli           3.6.0   2023-01-09 [1] CRAN (R 4.2.2)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.2.2)
 devtools    * 2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.31  2022-12-11 [1] CRAN (R 4.2.2)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.2.2)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fs            1.6.1   2023-02-06 [1] CRAN (R 4.2.2)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.2)
 htmltools     0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpuv        1.6.11  2023-05-11 [1] CRAN (R 4.3.0)
 later         1.3.1   2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.2.2)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.2)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.0   2022-11-27 [1] CRAN (R 4.2.2)
 pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.2.2)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.2.2)
 processx      3.8.0   2022-10-26 [1] CRAN (R 4.2.2)
 profvis       0.3.8   2023-05-02 [1] CRAN (R 4.3.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps            1.7.2   2022-10-26 [1] CRAN (R 4.2.2)
 purrr         1.0.1   2023-01-10 [1] CRAN (R 4.3.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.2)
 Rcpp          1.0.10  2023-01-22 [1] CRAN (R 4.2.2)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.3.0)
 rlang         1.0.6   2022-09-24 [1] CRAN (R 4.2.2)
 rstudioapi    0.14    2022-08-22 [1] CRAN (R 4.3.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.7.4   2022-12-15 [1] CRAN (R 4.3.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
 usethis     * 2.1.6   2022-05-25 [1] CRAN (R 4.3.0)
 vctrs         0.5.2   2023-01-23 [1] CRAN (R 4.2.2)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] E:/R-4.3.0/library

When I run library(devtools), I consistently get the following message:

载入需要的程辑包:usethis

Which basically says I still need to install the usethis package. However, I have already installed this package, and it is clearly visible in my packages tab:

enter image description here

I have tried updating both usethis and devtools in that order and vice versa (along with redownloading RTools in case that would be helpful), but nothing seems to get this message to go away. I have no trouble running library(usethis) and running usethis:: plus whatever command in the package. Despite all this, I am unable to find the Git tab in R after using the use_git function as advised on this page. The only thing visible in the upper right pane is this:

enter image description here

What else do I need to do in order to get this tab to work?

Edit

The Tools -> Global Option -> Git/SVN path only shows this in RStudio:

enter image description here

Nor does it have the option for selecting Git here:

enter image description here

Shawn Hemelstrand
  • 2,676
  • 4
  • 17
  • 30
  • I assume that git is installed and set to correct version Tools->Global Option -> Git/SVN? – TarJae May 23 '23 at 08:25
  • I tried installing `git` and it only states that it is not available for R. I also looked through the options on Tools->Global Option -> Git/SVN, but the options mentioned in other links I frequented are not available. See my edit for more details. – Shawn Hemelstrand May 23 '23 at 08:30
  • 1
    You need to have git installed, https://git-scm.com/download/win , not R package named `git` – margusl May 23 '23 at 08:36
  • I just downloaded it but I'm not seeing where this changes things for me. – Shawn Hemelstrand May 23 '23 at 08:46
  • Just checking you closed and restarted R after installation? If you do "which git" in the terminal what do you get? – goblinshark May 23 '23 at 09:04
  • 2
    Ah that was the ticket. I restarted my session with no fix, but closing out and returning fixed the issue. Thanks. – Shawn Hemelstrand May 23 '23 at 09:09
  • You are clearly still confusing RStudio with R. git integration is an RStudio issue. You tried handling it as an R issue. – Roland May 23 '23 at 09:10
  • why the mean tone @Roland? Glad it's sorted now Shawn – goblinshark May 23 '23 at 09:26
  • @goblinshark Why do you perceive my comment as mean? It is factual. If OP understood the difference, they could have solved the issue faster. – Roland May 23 '23 at 10:09
  • This is my first exposure to Git or package creation, so that is where my ignorance lies. I am familiar with what R and RStudio are, though perhaps my understanding is limited to what I have used in the past (and this is perhaps why I sound a bit unintelligent on this front). In any case, no harm in your commentary and I appreciate everyone's input. Thanks again. – Shawn Hemelstrand May 23 '23 at 10:34

1 Answers1

0

I found usethis didn't work well with my setup. What I do to get git working is go to Project > New Project > New Directory > New Project and make sure the "Create a git repository" box is ticked. Then when you open the project the git tab should show up.

goblinshark
  • 133
  • 9