xuqh
xuqh

Reputation: 23

First class objects in R

As far as I am concerned, first class usually means that:

  1. Can be stored in a variable
  2. Can be passed to or returned from a function
  3. Can form complex data structure like list

So, as for Python where everything is an object, everything is first class citizen. Am I right? Even functions are first class citizens.

# functions
# can be treated as objects
def toUpper(text):
    return text.upper()
print toUpper('abc')
Upperize = toUpper
print Upperize('abc')

What about R? Is everything in R is first class object? Or is there any exception?

Any thoughts would be helpful.

Upvotes: 1

Views: 469

Answers (0)

Related Questions