matlab expression Equivalent in R

PeCaDe

Which expression would be the most similar to the following one:

BDe(i,:) = [];

I use this to delete the row i of BDe (matrix n*m dimension) in a for loop.

A reproducible example:

data = [ 1 1 1 ; 2 2 2; 3 3 3]
data =
 1     1     1
 2     2     2
 3     3     3
data(1,:)=[]
data =
 2     2     2
 3     3     3

Target

Drop observations by iterating their matrix number row

CCurtis

Pretty sure you are looking for for

Example Data

data=read.table(text=" 1     1     1
 2     2     2
                3     3     3")

Code

 data[-1,]

  V1 V2 V3
2  2  2  2
3  3  3  3

Note please be aware of the following behavior in a loop.

x<-1:10
for(i in c(2,3,7)){x<-x[-i]}
x
[1]  1  3  5  6  7  8 10

It can be better to just do

x<-1:10
x[-c(2,3,7)]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Equivalent R function for Matlab

From Dev

R equivalent of Matlab trisurf()

From Dev

Equivalent R function for Matlab

From Dev

Port R expression to MATLAB

From Dev

R equivalent of a matlab "cell matrix"

From Dev

Matlab bsxfun(@times,...,...) equivalent in R

From Dev

R equivalent of the Matlab spy function

From Dev

Mod() function in R equivalent for MatLab?

From Dev

Is there an equivalent to R's negative indexing in Matlab?

From Dev

R equivalent to MATLAB's 'tokens' option in regexp

From Dev

Matlab - equivalent of R's rep() with times argument

From Dev

Fastest R equivalent to MATLAB's reshape() method?

From Dev

In R what is the equivalent of "mod" function handle in Matlab?

From Dev

What is the R equivalent of matlab's csaps()

From Dev

Matlab - equivalent of R's rep() with times argument

From Dev

Matlab: equivalent of R's matrix multiplication (A %*% B)?

From Dev

Equivalent of R language function 'is.na' in MATLAB

From Dev

Matlab using r divide twice in one expression

From Dev

Equivalent R code for Matlab: How to calculate residual values for the linear model?

From Dev

Equivalent of Matlab's 'fit' for Gaussian mixture models in R?

From Dev

Translation of python/numpy "A.argmin(axis=-1)" into an equivalent matlab-expression

From Dev

Is there an equivalent of this JS expression in Go?

From Dev

Expression Language equivalent of getComponent()

From Dev

Equivalent expression in Python

From Dev

OpenCV equivalent for thresholding in MATLAB

From Dev

MATLAB ksdensity equivalent in Python

From Dev

equivalent of "apply" in Octave / Matlab?

From Dev

numpy equivalent of matlab dummyvar

From Dev

Matlab equivalent of Python enumerate

Related Related

HotTag

Archive