• No products in the cart.

103.1.7 R Functions

Different Functions in R.

In previous section, we studied about R Lists, now we will be studying about R Functions.

We have already started using R functions. It is just like using any function in any other language. We can call the function and give the particular parameters. We have started using concatenate c() function already and we are using is.vector() or str() function.

The numeric functions include abs(x), sqrt(x), ceiling(x), floor(x), trunc(x), round(x, digits=n) ,signif(x, digits=n), cos(x), sin(x), tan(x) ,log(x), log10(x), exp(x).

And the string functions includes substr(x, start=n1, stop=n2), toupper(x), grep(pattern, x , ignore.case=FALSE, fixed=FALSE)

Here are some examples.

“y= abs(-20)”

abs is a function which will find the absolute value and store it in y.

We are trying string functions cust_id = “Cust123456”. We can create a substring of cust_id from 5:10. [id<-substr(cust_id,5,10)]. Here,

"a<-toupper(id)"

will convert everything to upper case and

grep(4, cust_id)

is a function which will search a particular value in the variable.

So this was a short note on the R Functions.

Next post is about R History and Scripts.

In next section, we will be studying about R History and Scripts.

DV Analytics

DV Data & Analytics is a leading data science,  Cyber Security training and consulting firm, led by industry experts. We are aiming to train and prepare resources to acquire the most in-demand data science job opportunities in India and abroad.

Bangalore Center

DV Data & Analytics Bangalore Private Limited
#52, 2nd Floor:
Malleshpalya Maruthinagar Bengaluru.
Bangalore 560075
India
(+91) 9019 030 033 (+91) 8095 881 188
Email: info@dvanalyticsmds.com

Bhubneshwar Center

DV Data & Analytics Private Limited Bhubaneswar
Plot No A/7 :
Adjacent to Maharaja Cine Complex, Bhoinagar, Acharya Vihar
Bhubaneswar 751022
(+91) 8095 881 188 (+91) 8249 430 414
Email: info@dvanalyticsmds.com

top
© 2020. All Rights Reserved.