Assignment 1

Assignment 1

My first assignment has four parts.

(a)

I have found and watch this interesting videoabout R programming language and interesting facts about it. It contains the basic features and applications of R. It also give information about the jobs that are using R and their average salaries.

(b)

  • The first thing that caught my attention was the difference between th R programming language and the Python programming language is that in R, when you want to acces the elements in a sequence, you need to start counting from one, but for Python, you need to start counting from zero. That is, for R the first element is at position one, but for Python the first element is at position zero.

  • For example Let’s say we have a vector in R and we named it my_vector. What we need to do to select the first element in this vector :

    • indexing in R

      my_vector[1]

  • To select the first element from an existing list in Python, we do this:

    my_list[0]

    1. Programming Style:

      • R is more focused on functional programming, where you use functions extensively for data manipulation.

      • Python supports both functional and object-oriented programming, which means you can use functions and classes.

    Example:

    • In R, you create functions with function(x, y) { ... }.

    • In Python, you define functions with def my_function(x, y): ....

    These differences might affect your choice of language based on your preferences and specific needs. R is great for statistics and data analysis, while Python’s versatility makes it a popular choice for a wide range of programming tasks.

Back to top