Creating Vectors
How to create vectors in Julia and R? The following table translates the most common Julia commands into R language.
Julia  R  

Create a row vector  
A = [1 2 3] 
A = c(1,2,3) 

Create a column vector  
A = [1 2 3]' 
A = matrix(c(1,2,3),3,1) 

Create integers from j to n with step size k  
A = j:k:n 
A = seq(j,n,k) 

Create linearly spaced vector of k points  
A = linspace(1, 5, k) 
A = seq(0, 1, length.out = 10) 
Complete JuliaR Cheatsheet
1) Creating Vectors
2) Creating Matrices
3) Creating Random Numbers
4) Manipulating Vectors and Matrices
5) Accessing Vector/Matrix Elements
Advertisements
Pingback: JuliaR Cheatsheet – Creating Matrices  Economic Theory Blog
Pingback: JuliaR Cheatsheet – Creating Random Numbers  Economic Theory Blog
Pingback: JuliaR Cheatsheet – Manipulating Vectors and Matrices  Economic Theory Blog
Pingback: JuliaR Cheatsheet – Accessing Vector/Matrix Elements  Economic Theory Blog
Pingback: JuliaR Cheatsheet – Mathematical Operations  Economic Theory Blog