Julia-R Cheatsheet – Manipulating Vectors and Matrices

Manipulating Vectors and Matrices

How to manipulate vectors and matrices in Julia and R? The following table translates the most common Julia commands into R language.

Julia R
Complex conjugate transpose
A '
Concatenate horizontally
A = [[1 2] [1 2]]
A = c(c(1,2),c(1,2))
Concatenate vertically
A = [[1 2]; [1 2]]
A = rbind(c(1,2),c(1,2))
Reshape (to 5 rows, 2 columns)
A = reshape(1:10, 5, 2)
A = matrix(1:10,5,2)
Convert matrix to vector
Repeat matrix (3 times in the row dimension, 4 times in the column dimension)
Flip Matrix form left to right
flipdim(A, 2)
Flip Matrix up/down
flipdim(A, 2)

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



5 thoughts on “Julia-R Cheatsheet – Manipulating Vectors and Matrices”

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.