Python for R Users
Daniel Chen
Instructor
numeric
: integers, floating point numberslogical
: TRUE
or FALSE
valuescharacter
: stringsint
: integersfloat
: floating point numbersbool
: True
or False
valuesstr
: stringsx <- 3
y = 0.5
z <- TRUE
x = 3
y = 0.5
z = True
print('R is awesome!')
"R is awesome!"
print('Python too!')
Python too!
x <- 3
class(x)
"numeric"
x = 3
type(x)
int
y = 0.5
type(y)
float
1 + 1
2
'1' + '1'
Error in "1" + "1" : non-numeric argument to binary operator
'1' * 5
Error in "1" * 5 : non-numeric argument to binary operator
'1' '1'
Error: unexpected string constant in "'1' '1'"
1 + 1
2
'1' + '1'
'11'
'1' * 5
'11111'
'1' '1'
'11'
Python for R Users