What Will I Learn?
<ul>
<li>Simple Main Concepts
<li>Data Types (Generally)
<h4>Requirements
<ul>
<li>RStudio
<h4>Difficulty
<ul>
<li>Basic
<h4>Tutorial Contents
<p dir="auto">R is a free and open source software which is programming language developed as a statistical computing and graphical environment. RStudio is a powerful and open source integrated development environment for R. In this tutorial, I will explain the R programming Language in a simple way. It will be a long series of tutorials and I will mention all the details you need in R Programming Language.
<p dir="auto">
<hr />
<p dir="auto">
<h2>Simple Main Concepts
<p dir="auto">
<p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517707028/gugmzreqo70zflb1ovfj.png" alt="1.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517707028/gugmzreqo70zflb1ovfj.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517707028/gugmzreqo70zflb1ovfj.png 2x" />
<pre><code>
print("Hello World")
[1] "Hello World"
# mathematical operations
1 + 2
[1] 3
3 * 3
[1] 9
10 / 5
[1] 2
(3 + 5) ^ 2
[1] 64
3 ^ 4
[1] 81
4 - 1
[1] 3
print(15.7 + 4.3)
[1] 20
coinbaba <- "I Love utopian.io <3"
print(coinbaba)
[1] "I Love utopian.io <3"
# or
coinbaba
[1] "I Love utopian.io <3"
<p dir="auto">
<p dir="auto">Here I wrote simple text and mathematical operations. "<-" can be used instead of "=". I will use "<-" throughout the entire tutorial. I created a new value and applied the printing process that I determined with the "print" function. The print ( <strong>print() ) function can print any value.
<p dir="auto">
<h2>Data Types (Generally)
<p dir="auto">
I'll briefly explain the six data types. In my next tutorial, I will explain the data types in detail. There 6 types of data: Factors, Lists, Data Frames, Arrays, Vectors, and Matrices.
<p dir="auto">
<div class="table-responsive"><table>
<thead>
<tr><th>Data Type<th>Example
<tbody>
<tr><td>Numeric<td>25, 7, 29, 28.7
<tr><td>Logical<td>FALSE, TRUE
<tr><td>Integer<td>2L, 0L
<tr><td>Character<td>"coin", "baba", "coinbaba", "2018"
<tr><td>Complex<td>1+1i
<tr><td>Raw<td>"coinbaba" is stored as 63 6f 69 6e 62 61 62 61
<p dir="auto">
<p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517929650/p9hbgaugvqxq6rwji3yz.png" alt="2.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517929650/p9hbgaugvqxq6rwji3yz.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517929650/p9hbgaugvqxq6rwji3yz.png 2x" />
<p dir="auto">
<p dir="auto">With the <strong>print (class (x)) function, we can learn the data type of any value.
<pre><code>
numaricexample <- 25
print(class(numaricexample))
[1] "numeric"
logicalExample <- FALSE
print(class(logicalExample))
[1] "logical"
integerExample <- 2L
print(class(integerExample))
[1] "integer"
characterExample <- "coinbaba"
print(class(characterExample))
[1] "character"
complexExample <- 1+1i
print(class(complexExample))
[1] "complex"
rawExample <- charToRaw("coinbaba")
print(class(rawExample))
[1] "raw"
rawExample
[1] 63 6f 69 6e 62 61 62 61
<p dir="auto">
Note: Data types are not limited to the six examples shown above. More data types are available. As an example, I showed six.
<p dir="auto">
<h4>Factors
<p dir="auto">
<p dir="auto">Factors are r objects created using a vector. Factors are constructed using the <strong>factor () function, and the <strong>Nlevels functions give the number of levels.
<p dir="auto">
<pre><code>#factors
factorExample <- factor(steemit)
factorExample
[1] steem sbd sp
Levels: sbd sp steem
print(nlevels(factorExample))
[1] 3
<p dir="auto">
<h4>Lists
<p dir="auto">
A list is an R object that can contain many different types of elements, such as function, vectors and even other lists.
<p dir="auto">
<pre><code>#Lists
listExample <- list(c(1,7,5),10)
listExample
[[1]]
[1] 1 7 5
[[2]]
[1] 10
<p dir="auto">
<h4>Data Frames
<p dir="auto">
<p dir="auto">Data frames are data objects. Unlike a matrix in the data frame, each column can contain different data modes. Data Frames are created using the <strong>data.frame () function.
<p dir="auto">
<pre><code>#dataframe
dataframeExample <- data.frame(
+ gender = c("Male", "Female","Female"),
+ height = c(180, 155.5, 173),
+ weight = c(90,55, 75),
+ Age = c(32,18,23)
+ )
dataframeExample
gender height weight Age
1 Male 180.0 90 32
2 Female 155.5 55 18
3 Female 173.0 75 23
<h4>Arrays
<p dir="auto">
<p dir="auto">Matrices may be limited to two dimensions, and arrays may be of any dimensions. The <strong>array function receives a dim attribute that creates the required number of dimensions.
<p dir="auto">
<pre><code>#arrayExample
arrayExample <- array(c('coin','baba'),dim = c(3,2,2))
arrayExample
, , 1
[,1] [,2]
[1,] "coin" "baba"
[2,] "baba" "coin"
[3,] "coin" "baba"
, , 2
[,1] [,2]
[1,] "coin" "baba"
[2,] "baba" "coin"
[3,] "coin" "baba"
<p dir="auto">
<h4>Vectors
<p dir="auto">
<p dir="auto">If you want to create a vector with more than one item, you must use the <strong>c() function to combine elements into one value.
<p dir="auto">
<pre><code>#Vectors
steemit <- c("steem","sbd","sp")
steemit
[1] "steem" "sbd" "sp"
<p dir="auto">
<h4>Matrices
<p dir="auto">
<p dir="auto">A matrix is a two-dimensional rectangular data set. The <strong>matrix function can be created using a vector entry.
<p dir="auto">
<pre><code>#matrix
matrixExample = matrix( c('1','1','2','3','4','1'), nrow = 2, ncol = 3, byrow = TRUE)
matrixExample
[,1] [,2] [,3]
[1,] "1" "1" "2"
[2,] "3" "4" "1"
<p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933342/ewnma0emo6xzhld4bmrv.png" alt="3.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933342/ewnma0emo6xzhld4bmrv.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933342/ewnma0emo6xzhld4bmrv.png 2x" />
<hr />
<p dir="auto"><img src="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933366/cnvdy9ickcjtehf9nkov.png" alt="4.png" srcset="https://images.hive.blog/768x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933366/cnvdy9ickcjtehf9nkov.png 1x, https://images.hive.blog/1536x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1517933366/cnvdy9ickcjtehf9nkov.png 2x" />
<p dir="auto"><br /><hr /><em>Posted on <a href="https://utopian.io/utopian-io/@coinbaba/r-programming-language-or-tutorial-1" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Utopian.io - Rewarding Open Source Contributors<hr /><p>
Your contribution cannot be approved because it does not follow the Utopian Rules.
Hi, there are a few problems with your tutorial
For future tutorials I recommend you find an open-source project and make that the subject of your tutorials (for example here).
You can contact us on Discord.
[utopian-moderator]
Thank you for your feedback. I wanted to add simple information because it would be from the beginning, but it was not appropriate for the rules.