R loops- why necessarily we have to convert any input data in to vector format?

While processing a column or many columns or a list for processing into any loop or apply group of functions, why is it necessary to convert it into vector? what's the rationale behind it.

You wouldn't necessarily. For example; columns typically are naturally vectors for example, and converting them to vector most often will give an identical result; a wasted operation.

(mydf <- data.frame(a=1:5))
identical(as.vector(mydf$a),
          mydf$a)

Based on that its hard to know how to answer you.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.