简体   繁体   中英

Command describe unrecognized even if the package psych is loaded

I'm using Rstudio 2022.22.1 on MacOS Monterey 12.3.1.

I load libraries at the begininning by doing:

knitr::opts_chunk$set(echo = TRUE)
library("tidyverse", "here", "magrittr")
library("pastecs", "psych")
## dlf<-read.delim("data/DownloadFestival(No Outlier).dat", header=TRUE)

dlf<-here::here("data/DownloadFestival(No Outlier).dat") %>% readr::read_delim(col_names = TRUE)

I also check the thick for the library "psych" in the Packages section of RStudio.

The issue is that, from a certain point (after Knitting) I wasn't unable to use the command describe , this is the error:

could not find function "describe"

I could bypass this, by typing each time I use the function:

psych::describe

instead of describe alone

How can I use describe without specifying the psych:: prefix each time?

Your problem is that library("pastecs", "psych") isn't doing what you think. Weirdly enough, there isn't an obvious idiom for "load a bunch of packages at once": I wish there were an easier way to do this, but try

invisible(lapply(c("psych", "pastecs"), library, character.only = TRUE))

The answers to this question provide a bunch of different ways to load many packages at once (the accepted answer is the same as the one given here).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM