Classes in R from a python background

Viewed 6761

I am a python programmer, and this is my first day working with R.

I am trying to write a class with a constructor and three methods, and I am struggling.

In python, it's easy:

 class MyClass:
      def __init__(self):
           self.variableA = 1
           self.variableB = 2

      def hello(self):
           return "Hello"

      def goodbye(self):
           return "Goodbye"

      def ohDear(self):
           return "Have no clue"

I can't find anything that shows me how to do something as simple as this in R. I would appreciate it if someone could show me one way to do this ?

Many thanks

3 Answers
Related