# # R Programming Language

## A language for statistical analysis

We all know how crazy data science is nowadays. We hear a lot about data science projects and more job openings in that field. Data Science is considered the most significant part of a company as it can give future insights based on the data provided.

The R programming language plays a crucial role in processing a large amount of data and performing statistical analysis. There are many tools in data science which we will look at later in other blogs.

### So ... What is R?

R is both an environment and a language. It's an environment in the sense that it's an integrated suite of software packages and data that basically enable the R language. The R language in turn allows you to perform statistical analysis and data mining techniques such as the use of probability distributions, hypothesis testing, creating linear models, aggression, logistic regression, non-linear models and so on.

R is very versatile and it covers a whole range of statistical techniques and algorithms when it comes to data mining as well as analysis. Also, R allows you to create complex graphs, so you can generate simple one-dimensional graphs or create more sophisticated graphs like two-dimensional or multi-dimensional graphs.

### Data types:

R has 6 basic data types.

• character

• numeric

• integer

• logical

• complex

Character Datatype:

The char type in R consists of alphabets and special characters. It stores the character value or strings. The best way to declare a char value is to wrap the value inside a single or double inverted comma.

``````
char = "Quasar Community"

print(class(char))

//OUTPUT :-

"character"
``````

Numeric Datatype:

The numeric data type is decimal values. The default data type for numbers in R is a numeric data type. If we assign a decimal value to a variable x, then it will be of numeric type.

``````
x= 10

print(class(x))

//OUTPUT :-

"numeric"
``````

Integer Datatype:

The integer data type consists of all integers. One can create as well as convert a value into an integer using the as.integer() function.

``````
X= as.integer(10)

print(class(x))

//OUTPUT :-

"integer"
``````

Logical Datatype:

The logical datatype takes the value true or false. This type of variable is created as a result of comparing two other variables.

``````
x=4

y=4

z=x>y

print(z)

print(class(z))

//OUTPUT :-

TRUE

"logical"
``````

Complex Datatype:

Complex data types are a set of all complex numbers. The complex data type is used to store numbers with an imaginary component.

``````
x= 4+3i

print(class(x))

//OUTPUT :-

"complex"
``````

### How to find the data type of an object:

In order to find the data type of an object, one has to use the class() function. The syntax for doing so is mentioned below.

syntax:

class(object)

``````
# to find the data type of an object

# Logical

print(class(TRUE))

# Integer

print(class(3L))

# Numeric

print(class(10.5))

# Complex

print(class(1+2i))

# Character

print(class("12-04-2020"))

//OUTPUT :-

"logical"

"integer"

"numeric"

"complex"

"character"
``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.80937356,"math_prob":0.9482409,"size":2963,"snap":"2023-40-2023-50","text_gpt3_token_len":658,"char_repetition_ratio":0.1351808,"word_repetition_ratio":0.018828452,"special_character_ratio":0.22814715,"punctuation_ratio":0.09803922,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.994816,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,null,null,null,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-28T12:07:52Z\",\"WARC-Record-ID\":\"<urn:uuid:b92f0867-eaa1-4716-9d20-8d3920ac8898>\",\"Content-Length\":\"118191\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c25f3c8f-8bce-487f-8b9e-b8430615a4e7>\",\"WARC-Concurrent-To\":\"<urn:uuid:080ea3f4-9a29-43d7-abda-b37193c8707e>\",\"WARC-IP-Address\":\"76.76.21.21\",\"WARC-Target-URI\":\"https://blog.quasarcommunity.org/r-programming-language\",\"WARC-Payload-Digest\":\"sha1:63ZEVKRD3PAPVRNSZ4LD7CXU2J2KEE6A\",\"WARC-Block-Digest\":\"sha1:4HT42NZVZVBUEBSGI7J44HQVSX752ZTZ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510387.77_warc_CC-MAIN-20230928095004-20230928125004-00090.warc.gz\"}"}