Can an array in R contain elements of different data types?

  • No, all elements of an array in R must be of the same data type
  • Yes, an array in R can contain elements of different data types
  • It depends on the version of R being used
  • None of the above
No, all elements of an array in R must be of the same data type. Arrays are homogeneous structures, meaning they can only contain elements of a single data type, such as numeric, character, or logical. If elements of different data types are passed, R will coerce them to a common type, resulting in an array of that type.
Add your answer
Loading...

Leave a comment

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