zoukankan      html  css  js  c++  java
  • Data Science With R In Visual Studio

    R Projects

    Similar to Python, when we installed the data science tools we get an “R” section in our templates. If you go there you’ll see something like this:

    R tools visual studio

    Only one template to choose from, but that’s ok! That is all we need.

    R Interactive

    Just like there’s a Python Interactive, there’s also an R Interactive window. It acts very similar to the Python Interactive, as well. Just highlight or put your cursor on the line in a script you want to send to the interactive and hit Ctrl+Enter. Of course, you can just type directly into the interactive to get some quick result or feedback on a piece of code. Oh, and there is syntax highlighting and intellisense right in the interactive!

    R Interactive

    Running R Code

    Like all applications in Visual Studio, just hitting the green “Run” button will execute your code. And, just like with Python, you can set a breakpoint in your R code and debug through it.

    R Debug

    Visualizations

    Having R support in Visual Studio wouldn’t be useful if it didn’t support visualizations. Similar to RStudio, Visual Studio has a tab that’s used to display plots.

    Luckily, R comes provided with quite a few sample data sets. To list them all just type in data(). Let’s look at a dataset called JohnsonJohnson, which is quarterly earning of Johnson & Johnson from around 1960 to 1980. Let’s use a scatterplot that also adds a curve.

    scatter.smooth(JohnsonJohnson)

    R Plot

    Pretty nice for just a small line of code! You can imagine how much more complicated the visualizations can get just by adding a bit more code.

    R Markdown

    R has a really nice feature to help distribution code, text, and visualizations with R Markdown. Pretty similar to Python’s Jupyter Notebooks, it also features a way to output to different formats, such as PDF and HTML. Visual Studio also has support for this, though it takes a little bit to set up. Microsoft has a nice documentation page that details all that you need to do. Now you can create R Markdown files in Visual Studio!

    R Markdown

    While you can output your R Markdown document in HTML, PDF, and Word, RStudio has a few more ways you can. It allows you to also output as an actual web site or a scientific article. Hopefully, Visual Studio can provide most of the other output types fairly soon.

    Shiny Apps

    One of the things I have a hard time trying to find are ways to deploy your models. Sure you can have everything local, but what’s good about that if no one else can see or use it? Well, the same team who brought us RStudio also has a very compelling feature for R to share your findings – Shiny. This framework allows you to create web applications to share your findings and, even better, to share your models for anyone to interact with. They also supply hosting for your web applications, so they have all that you need to get your findings and models out to the world.

    Unfortunately, Visual Studio doesn’t support Shiny. Although, I really hope they will integrate better support for Azure in order to deploy web services that will call into our models and host web applications that use those web services.

  • 相关阅读:
    Java实现直接插入查找
    CSS hack常用方案(摘选)
    输入一个字符串,去掉重复的字符,并按ASCII值排序-华为机试
    git操作github
    简单记录下idea上配置spring
    mysql国内镜像下载网址
    tomcat启动不成功(点击startup.bat闪退)的解决办法
    Encode and Decode TinyURL
    leetcode 4Sum II
    leetcode two sum
  • 原文地址:https://www.cnblogs.com/Javi/p/7047444.html
Copyright © 2011-2022 走看看