Tag Archives: R

R Language Error: rowMeans(new1) : ‘x’ must be an array of at least two dimensions

Use command:

new1$mean=apply(data.frame(new1),1,mean)
new1$mean=rowMeans(new1)

Generate error: rowmeans (new1): ‘x’ must be an array of at least two dimensions

Change the command to the following:

new1$mean=apply(as.data.frame(new1),1,mean)
new1$mean=rowMeans(new1)

Note that when using rows to calculate the average value, you need to convert “matrix” to “data. Frame”. You can’t directly use the data.Frame() function, but you need to use the as.Data.Frame() function;

Error reporting when installing r reference rjava on MAC

      Recently, I want to learn that R installed an R and rstudio yesterday. After the installation, I wanted to find an exercise to deal with Excel, so I found an xlsx package and reported errors all the time, as shown in the following figure:

     

      After a day of trouble, I still haven’t solved it. Finally, I found a solution online, so I recorded it. I hope it will be useful to other people with the same problem

    Solution: execute the command on the MAC terminal:   sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

Then execute in rstudio     library(“xlsx”)    

      

 

    Referenced address:   https://stackoverflow.com/questions/30738974/rjava-load-error-in-rstudio-r-after-upgrading-to-osx-yosemite

[Solved] R Package Install error:(as ‘lib’ is unspecified)installation of package had non-zero exit status

Help my younger martial sister install an R package called devtools across operating systems

Only windows and OS on crane

The situation is as follows:

You can install (Windows) on this computer

But it can’t be installed on supercomputing platform. The platform system is red hat (based on Linux)

The error given is

Installing package into ‘~:/path/’
(as ‘lib’ is unspecified)

And installation of package had non zero exit status

The solution is as follows:

The following are all implemented in

In the local (own computer installed the package) and the server’s rstudio

Operation

(.libPaths())

find the package according to the path given by local rstudio. Copy the entire folder to the path of Linux platform

refresh rstudio

Implementation

library(devtools)

OK

Feel that this is a universal method, welcome to exchange