package installation-problem quanteda

Hello

I need to use the quanteda package to analyse text for my studies. I am quite new to R studio and would appreciate your help.

I am trying to install the package with:

install.packages("quanteda")

The answer code I get is the following:
Warning in install.packages :
  dependency 'statnet.common' is not available
also installing the dependencies 'sna', 'proxyC'

  There are binary versions available but the source versions are
  later:
           binary source needs_compilation
sna           2.4    2.5              TRUE
quanteda 0.9.9-65  1.5.2              TRUE

Do you want to install from sources the packages which need compilation?
y/n: y
Package which is only available in source form, and may need
  compilation of C/C++/Fortran: 'proxyC'
Do you want to attempt to install these from sources?
y/n: y
installing the source packages 'sna', 'proxyC', 'quanteda'


During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
ERROR: dependency 'statnet.common' is not available for package 'sna'

removing '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/sna'
Warning in install.packages :
  installation of package 'sna' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 

installing *source* package 'proxyC' ...
** package 'proxyC' successfully unpacked and MD5 sums checked
** libs
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -DARMA_DONT_PRINT_OPENMP_WARNING  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppParallel/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppArmadillo/include"  -DARMA_64BIT_WORD=1 -fPIC  -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -DARMA_DONT_PRINT_OPENMP_WARNING  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppParallel/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppArmadillo/include"  -DARMA_64BIT_WORD=1 -fPIC  -Wall -mtune=core2 -g -O2 -c linear.cpp -o linear.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -DARMA_DONT_PRINT_OPENMP_WARNING  -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppParallel/include" -I"/Library/Frameworks/R.framework/Versions/3.3/Resources/library/RcppArmadillo/include"  -DARMA_64BIT_WORD=1 -fPIC  -Wall -mtune=core2 -g -O2 -c pair.cpp -o pair.o
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
clang++ -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o proxyC.so RcppExports.o linear.o pair.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [proxyC.so] Error 1
ERROR: compilation failed for package 'proxyC'

removing '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/proxyC'
Warning in install.packages :
  installation of package 'proxyC' had non-zero exit status
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_TIME failed, using "C" 
3: Setting LC_MESSAGES failed, using "C" 
4: Setting LC_MONETARY failed, using "C" 
ERROR: dependencies 'sna', 'proxyC' are not available for package 'quanteda'

removing '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/quanteda'
Warning in install.packages :
  installation of package 'quanteda' had non-zero exit status

The downloaded source packages are in
	'/private/var/folders/gb/rzcfyszs7p714pqfg24xhqzr0000gn/T/Rtmp6PyYof/downloaded_packages'

Thank you for any advise.
Nora

You have two problems here, the first one is that you are missing a package dependency, statnet.common, but this packages requires R >= 3.5 and it seems like you are using R 3.3.x so you have to update R first. And the second one is that you are missing a system dependency, lgfortran, it is possible that by updating R you would get access to a binary version of proxyC package avoiding the need for the compiler but if the issue persists, you could try installing the development tools for macOS

https://cran.r-project.org/bin/macosx/tools/

Thank you very much for your answer. I updated my R and I can install quanteda now. I do have problems with the function nchar now though, which I didn't before.

I get the the following:
spam.raw$TextLength <- nchar(spam.raw$Text)
Error in nchar(spam.raw$Text) : invalid multibyte string, element 6

I am trying to figure out that error now. If you see the problem I would be very thankful for support.

This is a very different question, we like to keep things tidy around here, so please ask this on a new topic and don't forget to provide a REPRoducible EXample (reprex) for your new question.

Okay thank you for your time.

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