OneBite.Dev - Coding blog in a bite size

copy an array in R

Code snippet on how to copy an array in R

  array2 = array1

This code creates two arrays (arrays are collection of elements). The first array is called array1, and it is created using the c() command with the values 10, 20, 30, 40, and 50. The second array is called array2 and it is created by copying array1. This means that array2 will have the same values as array1, 10, 20, 30, 40, and 50.

r