data types in r
# Short answer:
# In R there are 6 main data types: character, numeric (real or decimal),
# integer, logical, complex, and raw. Use class(object) to determine the
# data type you are working with.
# Example data types:
Data Type Examples
Logical TRUE, FALSE
Numeric 12.3, 5, 999 # In R, "ints" and "floats" are type numeric
Integer 2L, 34L, 0L # Add an L after the number to specify type int
Character 'a', "good", "TRUE", '23.4'
Complex 3 + 2i # This type isn't used much
Raw "Hello" is stored as 48 65 6c 6c 6f # This type isn't used much
3.9
10
# Create a matrix.
M = matrix( c('a','a','b','c','b',1), nrow = 2, ncol = 3, byrow = TRUE)
print(M)
Thank you!
10
0
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line