Julia-R Cheatsheet – Accessing Vector/Matrix Elements

Accessing Vector/Matrix Elements

How to access vector and matrix elements in Julia and R? The following table translates the most common Julia commands into R language.

Julia R
Access one element
A[2, 2]
A[2, 2]
Access specific rows
A[1:4, :]
Access specific columns
A[:, 1:4]
Concatenate vertically
A = [[1 2]; [1 2]]
A = rbind(c(1,2),c(1,2))
Remove a row
A[[1, 2, 4], ]
A[-3, ]
Diagonals of matrix
Get dimensions of matrix

Complete Julia-R Cheatsheet
1) Creating Vectors
2) Creating Matrices
3) Creating Random Numbers
4) Manipulating Vectors and Matrices
5) Accessing Vector/Matrix Elements



This entry was posted in Computing and Others, Econometrics, Statistic and tagged , , , , , , , . Bookmark the permalink.

5 Responses to Julia-R Cheatsheet – Accessing Vector/Matrix Elements

  1. Pingback: Julia-R Cheatsheet – Creating Vectors | Economic Theory Blog

  2. Pingback: Julia-R Cheatsheet – Creating Matrices | Economic Theory Blog

  3. Pingback: Julia-R Cheatsheet – Creating Random Numbers | Economic Theory Blog

  4. Pingback: Julia-R Cheatsheet – Manipulating Vectors and Matrices | Economic Theory Blog

  5. Pingback: Julia-R Cheatsheet – Mathematical Operations | Economic Theory Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s