Home > Back-end >  Command describe unrecognized even if the package psych is loaded
Command describe unrecognized even if the package psych is loaded

Time:04-14

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 ?

CodePudding user response:

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).

  • Related