If you're using a for loop in R to modify the elements of a vector, it's often more efficient to first create a copy of the vector using the ______ function.

  • copy()
  • duplicate()
  • clone()
  • rep()
If you're using a for loop in R to modify the elements of a vector, it's often more efficient to first create a copy of the vector using the duplicate() function. This way, you avoid modifying the original vector during the loop, which can be costly for larger vectors.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *