Error installing tidyLPA and dplyr packages

Hi All,

I'm trying to install 2 packages - tidyLPA and dplyr. When I install them, I receive the following error messages:

library(tidyLPA)
Error: package or namespace load failed for ‘tidyLPA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘data.table’
In addition: Warning message:
package ‘tidyLPA’ was built under R version 3.6.2

library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

filter, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

Warning message:
package ‘dplyr’ was built under R version 3.6.2

Can anyone help me figure out how to resolve these issues? I tried restarting Rstudio, I checked for updates, and everything is up to date.

System Information:

  • RStudio Edition: Desktop
  • RStudio Version: Version 1.4.1106
  • OS Version: 11.2
  • R Version: 3.6.1

Thanks!
Jenn

This is telling you that you are missing a package dependency, data.table, the solution is to install it:

install.packages("data.table")

This is not showing any error message, can you explain what is your problem with this?

Thank you. I installed the data.table package and attempted to run a basic LPA model using tidyLPA and it still isn't working. I don't understand what the problem is.

Here is my code:

m1 <- msps1 %>%
select (RISK1_PHMS1, RISK1_PHMS4, RISK1_PHMS6, RISK1_PHMS8, RISK1_PHMS18, RISK1_PHMS20,
RISK_PHMS_SEVERITY2, RISK_PHMS_SOCIAL2, RISK_PHMS_PRACTICAL2, BF_KAB_GOODMOM2,
RISK_NOBF_FEAR2, RISK1_FF3, RISK1_FF5, RISK1_FF11, RISK_FF_SEVERITY2) %>%
estimate_profiles(2:5, variances="varying", covariances="varying")

Here is the error that I receive:

Error in estimate_profiles(., 2:5, variances = "varying", covariances = "varying") :
could not find function "estimate_profiles"

This is a different question, we like to keep things tidy around here so please ask it on a new topic providing
a proper REPRoducible EXample (reprex) illustrating your issue.

I'm happy to start a new topic, but I didn't actually think this was a new topic. Since it can't find the function "estimate_profiles" I took that to mean that the tidyLPA package didn't install properly. That is the main function of the tidyLPA package!

Thanks,
Jennifer

If the package hasn't been installed properly you should be getting an error message while installing or loading it, if that is the case then post it here and we can keep troubleshooting.

Ok, so I installed the data.table package as you suggested. The installation went fine - no errors, but when I went to load the data.table package, I get an error message. See below.

Any thoughts?

> library(data.table)
Error in library(data.table) : there is no package called ‘data.table’

If you get that error message then the package hasn't been installed successfully, please post the output you get when you try to install it.

> install.packages("data.table")
Installing package into ‘/Users/jenniferperegoy/Library/R/3.6/library’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
           binary source needs_compilation
data.table 1.13.6 1.14.0              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘data.table’

trying URL 'https://cran.rstudio.com/src/contrib/data.table_1.14.0.tar.gz'
Content type 'application/x-gzip' length 5303849 bytes (5.1 MB)
==================================================
downloaded 5.1 MB

* installing *source* package ‘data.table’ ...
** package ‘data.table’ successfully unpacked and MD5 sums checked
** using staged installation
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
*** pkg-config is not installed.
*** Compilation will now be attempted and if it works you can ignore this message. In
*** particular, this should be the case on Mac where zlib is built in or pkg-config
*** is not installed. However, if compilation fails, try 'locate zlib.h zconf.h' and
*** ensure the zlib development library is installed :
***   deb: zlib1g-dev (Debian, Ubuntu, ...)
***   rpm: zlib-devel (Fedora, EPEL, ...)
***   There is a zlib in brew for OSX but the built in zlib should work.
*** Note that zlib is required to compile R itself so you may find the advice in the R-admin
*** guide helpful regarding zlib. On Debian/Ubuntu, zlib1g-dev is a dependency of r-base as
*** shown by 'apt-cache showsrc r-base | grep ^Build-Depends | grep zlib', and therefore
*** 'sudo apt-get build-dep r-base' should be sufficient too.
*** To silence this message, please ensure that :
***   1) 'pkg-config --exists zlib' succeeds (i.e. $? -eq 0)
***   2) 'pkg-config --libs zlib' contains -lz
*** Compilation will now be attempted ...
./configure: line 91: -fopenmp: command not found
*** OpenMP not supported! data.table uses OpenMP to automatically
***   parallelize operations like sorting, grouping, file reading, etc.
*** For details on how to install the necessary toolchains on your OS see:
***   https://github.com/Rdatatable/data.table/wiki/Installation
*** Continuing installation without OpenMP support...
*** Compilation without compression support in fwrite
** libs
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
ERROR: compilation failed for package ‘data.table’
* removing ‘/Users/jenniferperegoy/Library/R/3.6/library/data.table’
Warning in install.packages :
  installation of package ‘data.table’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/d8/5grflzvj12x281kgy_50tjmr0000gn/T/RtmpjGJSi8/downloaded_packages’

This means that the package hasn't been installed.

The easiest solution would be to answer "no" to this question, you would get a precompiled binary version that is a little older but much easier to install.
If you need to install the latest version from source, then you need to install Xcode in your system (not in R) and the recommended development tools for macOS systems.

This is not a reproducible example because you do not supply msps1. You can use dput(msp1) to do so. You also do not show what libraries you have or have not loaded.

Did you heed the message that is printed when you do library(tidyLPA)?

You can use the function citation('tidyLPA') to create a citation for the use of {tidyLPA}.
Mplus is not installed. Use only package = 'mclust' when calling estimate_profiles().

Thank you very much!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.