Code Studio: One of Each Data Type
This is Practice: Data Types, checked by tests.
Create five variables, one of each basic data type, and print the class of each with class(), in this order:
my_character: some text in quotesmy_numeric: a number with a decimal pointmy_integer: a whole number written with anLsuffix, like7Lmy_logical:TRUEorFALSEmy_complex: a complex number, like2+3i
Your output should be:
[1] "character" [1] "numeric" [1] "integer" [1] "logical" [1] "complex"
Why does 7 on its own give "numeric", not "integer"? Try it and see.
This is Practice: Data Types, checked by tests.
Create five variables, one of each basic data type, and print the class of each with class(), in this order:
my_character: some text in quotesmy_numeric: a number with a decimal pointmy_integer: a whole number written with anLsuffix, like7Lmy_logical:TRUEorFALSEmy_complex: a complex number, like2+3i
Your output should be:
[1] "character" [1] "numeric" [1] "integer" [1] "logical" [1] "complex"
Why does 7 on its own give "numeric", not "integer"? Try it and see.