Vector Operations in R

Instruction: Write a function in R that takes two vectors as input and returns a vector containing the products of corresponding elements. Demonstrate your function with an example using the vectors (1, 2, 3) and (4, 5, 6).

Context: This question assesses the candidate's understanding of basic vector operations in R, including element-wise operations. It tests the candidate’s ability to write functions for simple tasks, which is a fundamental skill in data manipulation in R.

Upgrade to view answer

Related Questions