R语言library(psych)什么意思?

Python09

R语言library(psych)什么意思?,第1张

导入函数包psych

library()这个函数是把括号内包含的函数包导入,然后才可以运用psych中的一些现成的函数or模型。

psych函数包好像是一个和心理学等有关的函数包,Rstudio里给的psych函数包的定义如下:

A general purpose toolbox for personality, psychometric theory and experimental psychology. Functions are primarily for multivariate analysis and scale construction using factor analysis, principal component analysis, cluster analysis and reliability analysis, although others provide basic descriptive statistics. Item Response Theory is done using factor analysis of tetrachoric and polychoric correlations. Functions for analyzing data at multiple levels include within and between group statistics, including correlations and factor analysis. Functions for simulating and testing particular item and test structures are included. Several functions serve as a useful front end for structural equation modeling. Graphical displays of path diagrams, factor analysis and structural equation models are created using basic graphics. Some of the functions are written to support a book on psychometric theory as well as publications in personality research. For more information, see the <https://personality-project.org/r>web page.

上述英文来自:网页链接

一、执行方式不同

1、library:在一个函数中,如果一个包不存在,执行到library将会停止执行。

2、require:在一个函数中,如果一个包不存在,执行到require将会继续执行。

二、返回机制不同

1、library:library并不会返回包存在与否的消息。

2、require:require将会根据包的存在与否返回true或者false。

三、语法不同

1、library:library(cluster)。

2、require:调用包方法if(!require("cluster")) install.packages("cluster")

参考资料来源:百度百科-R语言编程

参考资料来源:百度百科-R语言