Data Science Training in Mumbai :- Execute R program using Visual Studio.

To create and run our R program in Visual Studio we must first install some tools.

Now open Visual Studio on your pc and then click on Get Tools and features… inside Tools.

1

Now in the feature installation window check and install the following features

For Visual Studio 2017

Contains Tools for Data Science

2

After this please install R tools from the following link if the above package is not installed properly from the following link.

But it is not necessary

https://docs.microsoft.com/en-us/visualstudio/rtvs/installing-r-tools-for-visual-studio

You can also install R programming tool go to the following link for better support and download the software and install it.

For Windows Users:

https://ftp.iitm.ac.in/cran/

3

For Linux Users:

If you are on Linux platform then you can use this fast and easy command used in Linux which can be used to install R. The yum command is used for installing like this:

$ yum install R

For Ubuntu Linux or other Debian-related OSs, a more direct method is:

$ apt-get install r-base

Now let us start creating our R application in visual studio
Go to Files ->Project and add a new R project

4

This is our project structure:

5

Now on the top left side is a new R file (script.R) where we can edit source code with all of Visual Studio Ide editing features.
Also on the bottom left of Visual Studio is where you can find an R Interactive window in which you can interactively develop and test code.

We can directly use R Interactive without the need of opening any new project.

6

We can even plot graph using certain command such as
plot(1:100)

7

As you can see the Visual studio generated a graph in a different windows

Let’s write the following code inside our Script.R window which is the main page to write our code

# Inserting series into Data Frame

df <- data.frame(
  group = c(“Male”, “Female”, “Child”),

  value = c(25, 25, 50)

  )
head(df)

library(ggplot2)

# Plotting our Barplot Graph

bp <- ggplot(df, aes(x = "", y = value, fill = group)) +
   geom_bar(width = 1, stat = “identity”)

bp

pie <- bp + coord_polar("y", start = 0)
pie

ggplot(PlantGrowth, aes(x = factor(1), fill = group)) +

   geom_bar(width = 1) +

   coord_polar(“y”)

The Generated output for the above Code is as follows:

8














Syllabus of Data Science training in Mumbai

Comments

comments

This entry was posted in Class Room Training and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.