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 theas.Data.Frame()
function;
Similar Posts:
- LinAlgError: Last 2 dimensions of the array must be square
- Keras.utils.to in keras_ Categorical method
- [Solved] Vuex error: Error in callback for watcher “function() {return this._data.$$state}”
- Numpy.linaling.linalgerror: singular matrix solved successfully
- tf.nn.top_k(input, k, name=None) & tf.nn.in_top_k(predictions, targets, k, name=None)
- The difference between Top.location and window.location.href
- Error in SciPy. Misc. Toimage()
- Error reporting on data type and matrix dimension of eigen
- Image data type conversion uint8 and double in MATLAB
- How to Use Array.prototype.slice.call(arguments)