<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shailesh chaudhary</title>
    <description>The latest articles on DEV Community by Shailesh chaudhary (@jetsql).</description>
    <link>https://dev.to/jetsql</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F261141%2Fe1cbec17-0965-4109-ab37-0c1607034d03.jpg</url>
      <title>DEV Community: Shailesh chaudhary</title>
      <link>https://dev.to/jetsql</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jetsql"/>
    <language>en</language>
    <item>
      <title>R Programming Quick Tutorial</title>
      <dc:creator>Shailesh chaudhary</dc:creator>
      <pubDate>Wed, 30 Oct 2019 09:22:56 +0000</pubDate>
      <link>https://dev.to/jetsql/r-programming-quick-tutorial-5b7</link>
      <guid>https://dev.to/jetsql/r-programming-quick-tutorial-5b7</guid>
      <description>&lt;p&gt;R is a open source free statistical programming language.R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS.&lt;/p&gt;

&lt;p&gt;Variable in R&lt;br&gt;
There are 3 basic way to declare a variable in R.&lt;/p&gt;

&lt;p&gt;1sy way,  a=24&lt;br&gt;
2nd way,  b &amp;lt;- "Hello"&lt;br&gt;
3rd way,  False -&amp;gt; C&lt;/p&gt;

&lt;p&gt;Others, Exceptional - c =5L, L-integer&lt;/p&gt;

&lt;p&gt;Data Operator in R&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arithmetic: (+, -,*,/,^, %%, %/%) 
2.Assignment: (=,-&amp;gt;&amp;gt;,&amp;lt;&amp;lt;-)
3.Relational (&amp;gt;,&amp;lt;,==,!=)
4.Logical (&amp;amp;(AND), |(OR), !(NOT))
5.Special (:(range), %in%(between))&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Data Type in R&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Vector - sequence of element&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;exp -&lt;br&gt;
Vrt=(1,2,3,4) or vtr &amp;lt;- (1,2,3,4)&lt;br&gt;
Operation - Indexing, replacing and sort&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Lists&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lists are the R object which contain elements of different types. like - number, strings, vectors and another lists.&lt;/p&gt;

&lt;p&gt;Exp-&lt;br&gt;
 n=c(2,3,4)&lt;br&gt;
 s=c("aa","vv")&lt;br&gt;
 x=list(n,s, TRUE)&lt;/p&gt;

&lt;p&gt;Operations - Merging (List1&amp;lt;-(1,2), List2('hi') merged.list &amp;lt;-c(list1,list2)), Slicing, Indexing&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Arrays&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Arrays are the R data object which can store data in more than two dimensions.&lt;/p&gt;

&lt;p&gt;Exp- &lt;/p&gt;

&lt;p&gt;Vector1 &amp;lt;- c(4,6,7)&lt;br&gt;
Vector2 &amp;lt;- c(10,12,13)&lt;br&gt;
result &amp;lt;- array(c(vector1,vector2),dim=c(2,2,1))&lt;/p&gt;

&lt;p&gt;4.Matrices&lt;/p&gt;

&lt;p&gt;Matrices are the R object in which the elements are arranged in a 2-d rectangular layout.&lt;/p&gt;

&lt;p&gt;-A matrix is created using matrix() function.&lt;/p&gt;

&lt;p&gt;matrix(data, nrow, ncol, byrow, dimnames)&lt;br&gt;
data- is the input vector which becomes the data elements of the matrix.&lt;br&gt;
nrow-is the number of the rows to be created.&lt;br&gt;
ncol-is the number of the columns to be created.&lt;br&gt;
byrow- is the logical clue. If TRUE then input vector elements are the arraged by row.&lt;br&gt;
dimname-is the names assigned to rows and columns.&lt;/p&gt;

&lt;p&gt;exp-&lt;br&gt;
vrt1 &amp;lt;- c(2,6,14,18,22)&lt;br&gt;
vrt2 &amp;lt;- c(5,7,9,45,36)&lt;br&gt;
mtr &amp;lt;- matrix(c(vtr1, vtr2), 5,5)&lt;/p&gt;

&lt;p&gt;5.Factors&lt;br&gt;
Factors are the data objects which are used to categorize the data and store it as levels.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They can store both strings and integers.&lt;/li&gt;
&lt;li&gt;They are useful in the data analysis for statistical modeling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;data &amp;lt;- c("East","West","North","North","North","East","West","East")&lt;/p&gt;

&lt;p&gt;factor_data &amp;lt;- factor(data)&lt;/p&gt;

&lt;p&gt;exp -&lt;br&gt;
vrt1 &amp;lt;- c(2,6,14,18,22)&lt;br&gt;
factvtr &amp;lt;- factor(vrt1)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Frames
A data frame is a table or a 2-d array-like strucuture in which each column contains values of one variable and each row contains one set of values from each column.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;emp_id=c(1:5),&lt;br&gt;
emp_name=c("Richa", "Antima","Priya"),&lt;br&gt;
salary= c(564.3,321.2,675.1),&lt;br&gt;
emp.data &amp;lt;- data.frame(emp_id, emp_name, salary)&lt;/p&gt;

&lt;p&gt;Flow Control Statements -:&lt;/p&gt;

&lt;p&gt;IF,&lt;br&gt;
x=5&lt;br&gt;
if(x&amp;gt;3){&lt;br&gt;
print("X is greater than 3")&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;IF-ELSE,&lt;br&gt;
x=5&lt;br&gt;
if(x&amp;gt;5){&lt;br&gt;
print("X is greater than 5")&lt;br&gt;
}&lt;br&gt;
else if (x==5){&lt;br&gt;
     print("x equal to 5")&lt;br&gt;
}&lt;br&gt;
else{&lt;br&gt;
     print("x is not greater than 5")&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;Switch Case:&lt;/p&gt;

&lt;p&gt;vtr &amp;lt;- c(150,200,250,300,350,400)&lt;br&gt;
option &amp;lt;- "mean"&lt;br&gt;
switch(option, &lt;br&gt;
"mean"=mean((vtr)),&lt;br&gt;
 "mode"=mode((vtr))),&lt;br&gt;
 "median"=median((vtr)))&lt;br&gt;
print("value invali")&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;Loops:&lt;br&gt;
x=2&lt;br&gt;
repeat{&lt;br&gt;
 x=x^2&lt;br&gt;
print(x)&lt;br&gt;
if(x&amp;gt;100)&lt;br&gt;
break&lt;br&gt;
}&lt;/p&gt;




&lt;p&gt;x=2&lt;br&gt;
while(x&amp;lt;1000){&lt;br&gt;
 x=x^2&lt;br&gt;
print(x)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;vtr &amp;lt;- c(7,19, 25,65,45)&lt;br&gt;
for(i in vtr){&lt;br&gt;
 print(i)&lt;br&gt;
}&lt;br&gt;
print(vtr)&lt;/p&gt;




&lt;p&gt;for(i in 1:15){&lt;br&gt;
 if (i%%2)==0){&lt;br&gt;
  next&lt;br&gt;
}&lt;br&gt;
print(i)&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;Visualization in R:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pie Chart&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;vtr &amp;lt;- c(12,28,11,30,17)&lt;br&gt;
name &amp;lt;- c("R&amp;amp;D","Marketing","Sales","Support")&lt;br&gt;
pie(vtr,name)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Bar Chart:
vtr &amp;lt;- c(12,28,11,30,17)
name &amp;lt;- c("R&amp;amp;D","Marketing","Sales","Support")
barplot(vtr)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;3.Boxplot&lt;br&gt;
boxplot(mpg ~cyl, data= mtcars, xlab = "number of Cylinders", ylab= "Miles per Gallon", main = "Mileage data")&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Histogram&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;vtr =(9,1,3,7,8,4,70)&lt;br&gt;
hist(vtr)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Line Graph:&lt;br&gt;
vtr =(9,1,3,7,8,4,70)&lt;br&gt;
plot(vtr, type = "o")&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scatterplot:&lt;br&gt;
vtr1 =(9,1,3,7,8,4,70)&lt;br&gt;
vtr2 =(6,1,3,3,8,0,70)&lt;br&gt;
plot(vtr1, vtr2)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I’m Shailesh Chaudhary an energetic and innovative Digital marketing specialist with over 3 years of experience. I’m keen self-learner and dedicated online marketing enthusiast. As Digital marketing professional I learn &amp;amp; implement everything who related to marketing, data and strategy.&lt;/p&gt;

&lt;p&gt;Visit my linkedin profile: &lt;a href="https://www.linkedin.com/in/ishailesh/"&gt;https://www.linkedin.com/in/ishailesh/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Visit my blog: &lt;a href="https://ishailesh.org/seo-hindi-tutorial/"&gt;https://ishailesh.org/seo-hindi-tutorial/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>r</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
