在 R 中安装 DAAG 库

在 R 中安装 DAAG 库

我有 Linux Mint。请问R语言安装DAAG包有什么问题吗?

> install.packages("DAAG")

It gives an error:

Installing package into ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘jpeg’, ‘latticeExtra’

trying URL 'https://cloud.r-project.org/src/contrib/jpeg_0.1-9.tar.gz'
Content type 'application/x-gzip' length 18596 bytes (18 KB)
==================================================
downloaded 18 KB

trying URL 'https://cloud.r-project.org/src/contrib/latticeExtra_0.6-29.tar.gz'
Content type 'application/x-gzip' length 1292315 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://cloud.r-project.org/src/contrib/DAAG_1.24.tar.gz'
Content type 'application/x-gzip' length 1431281 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘jpeg’ ...
** package ‘jpeg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c read.c -o read.o
In file included from read.c:1:0:
rjcommon.h:11:10: fatal error: jpeglib.h: Adresář nebo soubor neexistuje
 #include <jpeglib.h>
          ^~~~~~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'read.o' failed
make: *** [read.o] Error 1
ERROR: compilation failed for package ‘jpeg’
* removing ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1/jpeg’
Warning in install.packages :
  installation of package ‘jpeg’ had non-zero exit status
ERROR: dependency ‘jpeg’ is not available for package ‘latticeExtra’
* removing ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1/latticeExtra’
Warning in install.packages :
  installation of package ‘latticeExtra’ had non-zero exit status
ERROR: dependency ‘latticeExtra’ is not available for package ‘DAAG’
* removing ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1/DAAG’
Warning in install.packages :
  installation of package ‘DAAG’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmphv8qDd/downloaded_packages’

在此输入图像描述

请问,为什么“jpeg”包的编译失败?如何纠正这个问题?非常感谢

建议后:

我已经安装了 libjpeg-turbo8-dev 并再次尝试安装。我获得了:

install.packages("DAAG")
Installing package into ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
also installing the dependencies ‘jpeg’, ‘latticeExtra’

trying URL 'https://cloud.r-project.org/src/contrib/jpeg_0.1-9.tar.gz'
Content type 'application/x-gzip' length 18596 bytes (18 KB)
==================================================
downloaded 18 KB

trying URL 'https://cloud.r-project.org/src/contrib/latticeExtra_0.6-29.tar.gz'
Content type 'application/x-gzip' length 1292315 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'https://cloud.r-project.org/src/contrib/DAAG_1.24.tar.gz'
Content type 'application/x-gzip' length 1431281 bytes (1.4 MB)
==================================================
downloaded 1.4 MB

* installing *source* package ‘jpeg’ ...
** package ‘jpeg’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c read.c -o read.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c reg.c -o reg.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c write.c -o write.o
gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o jpeg.so read.o reg.o write.o -ljpeg -L/usr/lib/R/lib -lR
installing to /home/linux/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-jpeg/00new/jpeg/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (jpeg)
* installing *source* package ‘latticeExtra’ ...
** package ‘latticeExtra’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (latticeExtra)
* installing *source* package ‘DAAG’ ...
** package ‘DAAG’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (DAAG)

The downloaded source packages are in
    ‘/tmp/RtmpMMMVbl/downloaded_packages’
> library(DAAG)
Loading required package: lattice
> install.packages("lattice")
Error in install.packages : Updating loaded packages

Restarting R session...

> install.packages("lattice")
Installing package into ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/lattice_0.20-45.tar.gz'
Content type 'application/x-gzip' length 399470 bytes (390 KB)
==================================================
downloaded 390 KB

* installing *source* package ‘lattice’ ...
** package ‘lattice’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c threeDplot.c -o threeDplot.o
gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o lattice.so init.o threeDplot.o -L/usr/lib/R/lib -lR
installing to /home/linux/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-lattice/00new/lattice/libs
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (lattice)

The downloaded source packages are in
    ‘/tmp/RtmpU70gsO/downloaded_packages’
> library(DAAG)
Loading required package: lattice
> install.packages("lattice")
Error in install.packages : Updating loaded packages

Restarting R session...

> install.packages("lattice")
Installing package into ‘/home/linux/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/lattice_0.20-45.tar.gz'
Content type 'application/x-gzip' length 399470 bytes (390 KB)
==================================================
downloaded 390 KB

* installing *source* package ‘lattice’ ...
** package ‘lattice’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -std=gnu11 -I"/usr/share/R/include" -DNDEBUG      -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c threeDplot.c -o threeDplot.o
gcc -std=gnu99 -std=gnu11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o lattice.so init.o threeDplot.o -L/usr/lib/R/lib -lR
installing to /home/linux/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-lattice/00new/lattice/libs
** R
** data
*** moving datasets to lazyload DB
** demo
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (lattice)

The downloaded source packages are in
    ‘/tmp/RtmpBsoBJd/downloaded_packages’

答案1

确保您已libjpeg-turbo8-dev安装。安装它:

sudo apt install libjpeg-turbo8-dev

相关内容