Bonjour,

- Basic arithmetic is the same. 1+1 = 2 | 5*6 = 30 and so on
- Printing a string is just typing in “Hello, World!”.
- T and F are short hand for True and False simultaneously. i.e., T == True and F == False
- To store a value in a variable. You do this : x <- 35
- You can reassign any value to a variable any time. You can assign a string like this: x <- “Hello DataScience! R lang is awesome”
- printing the value of x is simple.. Just type x and hit return! That will do the magic.It should print 35 as we assigned it earlier
- you can assign logical values to the variables too.. Do this: x <- T or x <- True
- You have a sweet function called sum to add up numbers.. like this sum(2,3,4) gives you 9 as output
- To repeat a string or a number you can use “rep” function like this rep(“Bonjour”, times = 3)
- Like everywhere.. there is a function called sqrt to find the square root. sqrt(16) gives 4
- help(functionname) gives you the function’s documentation and syntax. For ex: help(sum) gives all the details of the function
- example(functionname) gives you the usage of the function and what arguments are valid for the function
- One can write the script in a file and can save it with .R extension for later usage and execution
- list.files() gives you the list of files in the current directory
- To run a script. We need to use source function and the argument is the file name. like: source(hello.R)

Hmm. That ends the basics of R Language. You’ve learned how to create and access variables, and how to call functions. You’ve learned how to run pre-made scripts. And you’ve learned how to access R’s help functionality when you need it.

Cheers,

SZ

### Like this:

Like Loading...