gpt4 book ai didi

r - 如何使用 R 4.1 中的 Octave?

转载 作者:行者123 更新时间:2023-12-05 04:43:44 25 4
gpt4 key购买 nike

我已经使用以下代码在 Linux 机器 (Ubuntu 20.04) 中安装了 Octave:

sudo apt-add-repository -y ppa:octave/stable; 
sudo apt install -y software-properties-common;
sudo apt-get update;
sudo apt-get install -y octave liboctave-dev

该程序使用他的界面完美运行。

我现在想通过库 RcppOctave 通过 R 使用它,但我什至无法安装它。

由于 R 版本,使用默认安装不起作用:

> install.packages('RcppOctave')
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘RcppOctave’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
> install.packages("RcppOctave", repos="http://R-Forge.R-project.org")
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘RcppOctave’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

然后我尝试从 github (install_github('https://github.com/renozao/RcppOctave')) 或直接从 tar.gz 最新版本安装它,但这是我得到的错误:

> file <- '../../05_Software/R/RcppOctave_0.8.5.tar.gz'
> install.packages(pkgs=file, type="source", repos=NULL)
Installing package into ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
* installing *source* package ‘RcppOctave’ ...
** package ‘RcppOctave’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether R is a shared library... yes
Using R LDFLAGS: -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
Using R CPPFLAGS: -I/usr/share/R/include
checking for octave-config... /usr/bin/octave-config
checking for mkoctfile... /usr/bin/mkoctfile
checking Octave include directory... /usr/include/octave-5.2.0/octave
checking Octave library directory... /usr/lib/x86_64-linux-gnu/octave/5.2.0
checking Octave version... 5.2.0
checking whether to infer output names for Octave function (>= 3.4.3)... yes
configure: creating ./config.status
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/modules/Makefile
** libs
cd modules;\
make; \
mkdir -p "/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules"; \
echo "Moving Octave modules to '"/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules"'"; \
cp -f PKG_ADD *.oct "/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules";
make[1]: se entra en el directorio '/tmp/RtmpJjatgt/R.INSTALL144cc3d8bf8b1/RcppOctave/src/modules'
/usr/bin/mkoctfile -v -c -I/usr/share/R/include Rrng.cc
g++ -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/share/R/include Rrng.cc -o Rrng.o
Rrng.cc:32:10: fatal error: octave/config.h: No existe el archivo o el directorio
32 | #include <octave/config.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:25: Rrng.oct] Error 1
make[1]: se sale del directorio '/tmp/RtmpJjatgt/R.INSTALL144cc3d8bf8b1/RcppOctave/src/modules'
Moving Octave modules to '/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/00LOCK-RcppOctave/00new/RcppOctave/modules'
cp: no se puede efectuar `stat' sobre '*.oct': No existe el archivo o el directorio
make: *** [Makevars:18: OctaveModule] Error 1
ERROR: compilation failed for package ‘RcppOctave’
* removing ‘/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/RcppOctave’
Warning in install.packages :
installation of package ‘../../05_Software/R/RcppOctave_0.8.5.tar.gz’ had non-zero exit status

目标很明确:如何在 R 4.1(Ubuntu 机器 20.04)中安装这个库?


更新(20/10/21)

我使用这个命令作为@Gorka sujested:

sudo ln -s /usr/include/octave-5.2.0/octave/octave-config.h /usr/include/octave-5.2.0/octave/config.h

...但这是新的错误:

> install_github('https://github.com/renozao/RcppOctave')
Downloading GitHub repo renozao/RcppOctave@HEAD
✓ checking for file ‘/tmp/Rtmp2OpHDN/remotes23297a629ef/renozao-RcppOctave-fcf4d02/DESCRIPTION’ ...
─ preparing ‘RcppOctave’:
✓ checking DESCRIPTION meta-information ...
─ cleaning src
─ running ‘cleanup’
─ installing the package to process help pages
-----------------------------------
─ installing *source* package ‘RcppOctave’ ...
** using staged installation
checking R architecture... none
checking for R... /usr/lib/R/bin/R
checking for Rscript... /usr/lib/R/bin/Rscript
checking whether loading Rprofile writes to stdout... no
checking R version... R version 4.1.1 (2021-08-10)
checking R platform... x86_64-pc-linux-gnu
checking R CC... gcc -std=gnu99
checking R CFLAGS... -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always
checking R CPPFLAGS...
checking R CXXFLAGS... -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always
checking for gcc... /usr/bin/gcc
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for g++... /usr/bin/g++
configure: Original R_LDFLAGS: -Wl,--export-dynamic -fopenmp -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
configure: Original R_CPPFLAGS: -I/usr/share/R/include
checking whether R is a shared library... yes
checking type of Operating System... Linux
checking whether OS is Mac OS (Darwin)... no
configure: Using mkoctfile with R_LDFLAGS: -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n
configure: Using mkoctfile with R_CPPFLAGS: -I/usr/share/R/include
checking Octave custom binary path specification... none
configure: using Octave binary path from $PATH
checking for octave-config... /usr/bin/octave-config
checking for mkoctfile... /usr/bin/mkoctfile
checking Octave Octave bin directory... /usr/bin
checking Octave Octave libraries directory... /usr/lib/x86_64-linux-gnu/octave/5.2.0
checking for octave... /usr/bin/octave
checking PATH changes... none
checking Octave module make target... all
checking mkoctfile command... /usr/bin/mkoctfile
checking Octave cpp flags... -Wdate-time -D_FORTIFY_SOURCE=2
checking Octave include flags... -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave
checking Octave -L flags... warning: LFLAGS is deprecated and will be removed in a future version of Octave, use LDFLAGS instead
-L/usr/lib/x86_64-linux-gnu
checking Octave libraries... -loctinterp -loctave
checking Octave C compiler... gcc
checking Octave Fortran compiler... gfortran
checking Octave platform... x86_64-pc-linux-gnu
checking Octave API version... api-v53
checking Octave version... 5.2.0
checking whether to infer output names for Octave function (>= 3.4.3)... yes
configure: Using Octave LDFLAGS: -L/usr/lib/x86_64-linux-gnu -loctinterp -loctave
configure: Using Octave CPPFLAGS: -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -DOCT_POST_3_4_0=1
checking RcppOctave Octave module directory... /tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/00LOCK-RcppOctave/00new/RcppOctave/modules
configure: creating ./config.status
config.status: creating R/config-vars.R
configure: creating ./config.status
config.status: creating R/config-vars.R
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating R/config-vars.R
config.status: creating src/Makevars
config.status: creating src/modules/Makefile
** libs
# Making Octave module [r_arch: all]
make[1]: se entra en el directorio '/tmp/Rtmprp7Rn4/Rbuild241a5f538b08/RcppOctave/src/modules'
*** Building octave module: utils.oct
/usr/bin/mkoctfile -v utils.cc
g++ -std=gnu++11 -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security utils.cc -o /tmp/oct-XxPJKC.o
g++ -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,relro -o utils.oct /tmp/oct-XxPJKC.o -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro
*** Building octave module: Rrng.oct
/usr/bin/mkoctfile -v -I/usr/share/R/include -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n Rrng.cc
g++ -std=gnu++11 -c -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -I/usr/share/R/include Rrng.cc -o /tmp/oct-zr4Boo.o
Rrng.cc: In function ‘octave_value_list Frand(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:196:3: note: in expansion of macro ‘RAND_FUNCTION’
196 | RAND_FUNCTION(unif_rand, "rand")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandn(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:207:2: note: in expansion of macro ‘RAND_FUNCTION’
207 | RAND_FUNCTION(norm_rand, "randn")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frande(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:181:1: note: in expansion of macro ‘RAND_ARGS’
181 | RAND_ARGS(octave_fun, 0, 2, 0, 1) \
| ^~~~~~~~~
Rrng.cc:218:2: note: in expansion of macro ‘RAND_FUNCTION’
218 | RAND_FUNCTION(exp_rand, "rande")
| ^~~~~~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandg(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:232:3: note: in expansion of macro ‘RAND_ARGS’
232 | RAND_ARGS("randg", 1, 4, 1, 2)
| ^~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc:238:48: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
238 | double scale(nArgs >= 4 && !args(3).is_empty() ? args(3).double_value() : 1);
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
Rrng.cc: In function ‘octave_value_list Frandp(const octave_value_list&, int)’:
Rrng.cc:163:54: warning: ‘bool octave_value::is_empty() const’ is deprecated: [4.4]: use 'isempty' instead [-Wdeprecated-declarations]
163 | k = ( nargs > iarg_col && !args(iarg_col).is_empty() ? long(args(iarg_col).double_value()) : n);\
| ^
Rrng.cc:256:3: note: in expansion of macro ‘RAND_ARGS’
256 | RAND_ARGS("randp", 2, 3, 1, 2)
| ^~~~~~~~~
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36,
from /usr/include/octave-5.2.0/octave/../octave/ov-fcn.h:33,
from /usr/include/octave-5.2.0/octave/../octave/ov-builtin.h:32,
from /usr/include/octave-5.2.0/octave/../octave/defun-int.h:30,
from /usr/include/octave-5.2.0/octave/../octave/defun-dld.h:32,
from /usr/include/octave-5.2.0/octave/../octave/oct.h:32,
from Rrng.cc:33:
/usr/include/octave-5.2.0/octave/../octave/ov.h:534:8: note: declared here
534 | bool is_empty (void) const
| ^~~~~~~~
g++ -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -pthread -fopenmp -g -O2 -fdebug-prefix-map=/build/octave-rvRilm/octave-5.2.0=. -fstack-protector-strong -Wformat -Werror=format-security -shared -Wl,-Bsymbolic -Wl,-Bsymbolic-functions -Wl,-z,relro -o Rrng.oct /tmp/oct-zr4Boo.o -Wl,--export-dynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -L/usr/lib/R/lib -lR -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n -L/usr/lib/x86_64-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro
make[1]: se sale del directorio '/tmp/Rtmprp7Rn4/Rbuild241a5f538b08/RcppOctave/src/modules'
# Copying Octave modules to directory '/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/00LOCK-RcppOctave/00new/RcppOctave/modules'
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG `"/usr/lib/R/bin/Rscript" -e "Rcpp:::CxxFlags()"` -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include/octave-5.2.0/octave/.. -I/usr/include/octave-5.2.0/octave -DOCT_POST_3_4_0=1 -I'/home/cesarkero/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-QwogzP/r-base-4.1.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall -pedantic -fdiagnostics-color=always -c conversion.cpp -o conversion.o
In file included from /usr/include/octave-5.2.0/octave/../octave/lo-utils.h:35
from /usr/include/octave-5.2.0/octave/../octave/Array.h:41
from /usr/include/octave-5.2.0/octave/../octave/str-vec.h:32
from /usr/include/octave-5.2.0/octave/../octave/ovl.h:33
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/quit.h:178:2:warning: tra ‘;-Wpedantic
178 | };
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/boolMatrix.h:30
from /usr/include/octave-5.2.0/octave/../octave/mx-base.h:34
from /usr/include/octave-5.2.0/octave/../octave/ov.h:40
from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/boolNDArray.h:121:46:warning: tra ‘;-Wpedantic
121 | BSXFUN_OP_DECL (and, boolNDArray, OCTAVE_API);
| ^
/usr/include/octave-5.2.0/octave/../octave/boolNDArray.h:122:45:warning: tra ‘;-Wpedantic
122 | BSXFUN_OP_DECL (or, boolNDArray, OCTAVE_API);
| ^
conversion.cpp:n function ‘SEXPREC* wrap(const Cell&, bool)
conversion.cpp:134:9:error: const class Cellhas no member named ‘is_cellstr did you mean ‘iscellstr
134 | if( x.is_cellstr
| ^~~~~~~~~~
| iscellstr
conversion.cpp:n function ‘SEXPREC* Rcpp::wrap(const T&) [with T = octave_value; SEXP = SEXPREC*]
conversion.cpp:180:24:warning: bool octave_value::is_null_value() constdeprecated: [4.4]: use 'isnull' instead [-Wdeprecated-declarations
180 | if( val.is_null_value()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:633:8:note: red here
633 | bool is_null_valued) const
| ^~~~~~~~~~~~~
conversion.cpp:214:30:warning: bool octave_value::is_bool_type() constdeprecated: [4.4]: use 'islogical' instead [-Wdeprecated-declarations
214 | else if ( val.is_bool_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:701:8:note: red here
701 | bool is_bool_typed) const
| ^~~~~~~~~~~~
conversion.cpp:219:102:warning: bool octave_value::is_integer_type() constdeprecated: [4.4]: use 'isinteger' instead [-Wdeprecated-declarations
219 | }else if( val.is_int32_type() || val.is_int64_type() || val.is_int16_type() || val.is_integer_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:692:8:note: red here
692 | bool is_integer_typed) const
| ^~~~~~~~~~~~~~~
conversion.cpp:223:30:warning: bool octave_value::is_real_type() constdeprecated: [4.4]: use 'isreal' instead [-Wdeprecated-declarations
223 | }else if( val.is_real_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:708:8:note: red here
708 | bool is_real_typed) const
| ^~~~~~~~~~~~
conversion.cpp:250:33:warning: bool octave_value::is_integer_type() constdeprecated: [4.4]: use 'isinteger' instead [-Wdeprecated-declarations
250 | else if ( val.is_integer_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:692:8:note: red here
692 | bool is_integer_typed) const
| ^~~~~~~~~~~~~~~
conversion.cpp:255:30:warning: bool octave_value::is_real_type() constdeprecated: [4.4]: use 'isreal' instead [-Wdeprecated-declarations
255 | }else if( val.is_real_type()
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:708:8:note: red here
708 | bool is_real_typed) const
| ^~~~~~~~~~~~
conversion.cpp:270:24:warning: bool octave_value::is_map() constdeprecated: [4.4]: use 'isstruct' instead [-Wdeprecated-declarations
270 | } else if( val.is_map()/ Maps are converted into lists
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:594:8:note: red here
594 | bool is_mapd) const
| ^~~~~~
conversion.cpp:307:25:warning: bool octave_value::is_cell() constdeprecated: [4.4]: use 'iscell' instead [-Wdeprecated-declarations
307 | } else if( val.is_cell() Cell objects are used for character vectors
| ^
In file included from /usr/include/octave-5.2.0/octave/../octave/ovl.h:36
from rcpp_octave.h:32
from conversion.cpp:5
/usr/include/octave-5.2.0/octave/../octave/ov.h:541:8:note: red here
541 | bool is_celld) const
| ^~~~~~~
conversion.cpp:n function ‘T Rcpp::as(SEXP) [with T = octave_value; SEXP = SEXPREC*]
conversion.cpp:471:50:error: valid initialization of reference of type ‘const octave_value&from expression of type ‘octave_value_list
471 | const octave_value& ol = as<octave_value_list>(x)
| ~~~~~~~~~~~~~~~~~~~~~^~~
make: *** [/usr/lib/R/etc/Makeconf:177: conversion.o] Error 1
ERROR: compilation failed for package ‘RcppOctave’
─ removing ‘/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/RcppOctave’
-----------------------------------
ERROR: package installation failed
Error: Failed to install 'RcppOctave' from GitHub:
System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> | ^~~~~~~
E> conversion.cpp:n function ‘T Rcpp::as(SEXP) [with T = octave_value; SEXP = SEXPREC*]
E> conversion.cpp:471:50:error: valid initialization of reference of type ‘const octave_value&from expression of type ‘octave_value_list
E> 471 | const octave_value& ol = as<octave_value_list>(x)
E> | ~~~~~~~~~~~~~~~~~~~~~^~~
E> make: *** [/usr/lib/R/etc/Makeconf:177: conversion.o] Error 1
E> ERROR: compilation failed for package ‘RcppOctave’
E> * removing ‘/tmp/Rtmprp7Rn4/Rinst241a34c4f6ea/RcppOctave’
E> -----------------------------------
E> ERROR: package installation failed

最佳答案

有时,当 package ... is not available for this version of R 错误消息出现时,仅自行下载和安装/构建包就足够了。

在这种情况下显然不是……Gorka 可能是对的,他说它可能是 Octave 版本。

一般来说,我宁愿尝试获取最新的 CRAN 版本 RcppOctave_0.18.1运行而不是 GitHub 版本(其最新更新也是几年前的)。

由于该软件包似乎是临时停止或永久停止的,您永远不知道他们是否在进行了一些 Unresolved 更改时停止了他们的 Github 版本。

而对于最新的 CRAN 版本,它更有可能是一个主要版本,在上传时有效(2015-10-06)。

因此,如果您复制这次的环境(R 版本、包依赖项版本、Ubuntu 版本、Octave 版本),您很有可能会运行此包。

但在 RcppOctave_0.18.1 发布时将 Octave 版本升级到当前版本也可能已经完成了这项工作。看着https://wiki.octave.org/Release_History表示版本 4.0.03.8.2 可能比较合适。

我不是真正的 linux/ubuntu 用户,但我猜只是

apt-get install octave=4.0.0

不会执行安装包的工作,因为包必须存在于存储库/包管理器中。可能你必须从某个地方获取旧的包版本/添加一个包含包版本的存储库(你也在你的代码中使用 apt-add-repository -y ppa ...)。

对于 Ubuntu,您可以在 launchpad 找到旧包 https://launchpad.net/ubuntu/trusty/+source/octave https://launchpad.net/ubuntu/+source/octave/3.8.2-4.1

对于 Debian,您可以在以下位置找到旧软件包 https://snapshot.debian.org/

看看构建包是否适用于 Octave 4.0.03.8.2(以及是否可以安装它们)会很有趣。

如果您以这种方式运行它,并且无论如何您都不需要较新 Octave 版本的功能 - 完美。

如果不是...我不知道任何其他 R - Octave 接口(interface)包,这可能会排除仅使用另一个 R 包的解决方案。

一个解决方案(取决于您的计划)可以使用 system()/system2() 来调用系统命令。

system invokes the OS command specified by command.

因为(据我所知)您还可以从 shell 运行 Octave 脚本,这可能是一个可行的解决方法。

关于r - 如何使用 R 4.1 中的 Octave?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69537309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com