<?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>Forem: BettyES</title>
    <description>The latest articles on Forem by BettyES (@bettyes).</description>
    <link>https://forem.com/bettyes</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F57728%2F539bac94-0f25-4da6-86f6-b4afaf1d95ae.jpeg</url>
      <title>Forem: BettyES</title>
      <link>https://forem.com/bettyes</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bettyes"/>
    <language>en</language>
    <item>
      <title>At the start of your data science career? Need directions?</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Fri, 12 Jul 2019 21:51:53 +0000</pubDate>
      <link>https://forem.com/bettyes/at-the-start-of-your-data-science-career-need-directions-1hbp</link>
      <guid>https://forem.com/bettyes/at-the-start-of-your-data-science-career-need-directions-1hbp</guid>
      <description>&lt;p&gt;Several people, particularly from academia, have approached me asking how to get started with a career in data science. Obviously there are many online resources on this topic, nevertheless, here is my take on this. Feel free to send feedback if this was helpful or if you have something to add.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To start off, I'd like to explore what makes a good data scientist?&lt;/strong&gt; Of course, there are plenty of blogs on that one [1-3].&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In my opinion, essential skills include:&lt;/strong&gt; good problem solving skills (finding a solution, even if it is not perfect), project management skills (being able to see a project through end to end), excellent communication with business/non-technical people, and being able to work well in a team. The latter might have been acquired during an M.Sc., most certainly during a PhD. However, some people have these skills naturally and might have proven so in other positions than a degree. In case you'd like to work on some of your soft skills have a look at this list of &lt;a href="https://medium.com/@jbyrnephd/the-importance-of-soft-skills-in-data-science-book-recommendations-3cbce1b11c67"&gt;book recommendations&lt;/a&gt; [4]&lt;/p&gt;

&lt;p&gt;Regarding the basic technical skills (again my personal recommendation): a &lt;strong&gt;coding language&lt;/strong&gt; that you are comfortable with (focus on one for the beginning. Most used in the field: Python or R), solid &lt;strong&gt;math or statistical knowledge&lt;/strong&gt;, a general idea about techniques to be applied in &lt;strong&gt;data science&lt;/strong&gt;, and some &lt;em&gt;example projects&lt;/em&gt; to present during an interview (in case you have no real business projects, it can be another data science project with a hypothetical link to a business context). Some great data-sets to work with can be found on Kaggle as a start, or simply use &lt;a href="https://toolbox.google.com/datasetsearch"&gt;google's data-set search&lt;/a&gt;. But there are plenty of other publicly available data-sets, like shown in this &lt;a href="https://www.youtube.com/watch?v=Y3lTVoewMXc"&gt;video&lt;/a&gt; investigating the rise in knife crime in London.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coding knowledge:
&lt;/h2&gt;

&lt;p&gt;I would strongly recommend to practice your coding skills regularly (at least two days per week). Practice by solving short tasks, such as on &lt;a href="http://www.codewars.com"&gt;Codewars&lt;/a&gt;, &lt;a href="https://www.datacamp.com/"&gt;DataCamp&lt;/a&gt;, &lt;a href="https://exercism.io/"&gt;Excercism&lt;/a&gt; etc.&lt;br&gt;
Particularly, interesting about Excercism are their mentored language tracks, where you will get feedback from experienced programmers on your coding solutions.&lt;/p&gt;

&lt;p&gt;There are also plenty of -often free of charge- courses available on &lt;a href="https://eu.udacity.com/"&gt;Udacity&lt;/a&gt; or &lt;a href="https://www.coursera.org/"&gt;Coursera&lt;/a&gt; to help you get started, e.g.:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eu.udacity.com/course/introduction-to-python--ud1110"&gt;Introduction to Python - Starting out in Python 3&lt;/a&gt; (free)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eu.udacity.com/course/data-analysis-with-r--ud651"&gt;Data Analysis with R - by Facebook&lt;/a&gt; (free)&lt;/p&gt;

&lt;p&gt;If you ever get stuck, &lt;a href="https://stackoverflow.com/"&gt;'stackoverflow'&lt;/a&gt; is 'an absolute must' to search for answers, or even better, contribute yourself by posting questions or trying to help answer some. There is a high chance that a coding challenge will be part of your data science job interview. So make sure you are prepared. Have a look at some additional literature that might help [5], or have a look at this &lt;a href="https://towardsdatascience.com/notes-and-technical-questions-from-interviewing-as-a-data-scientist-in-2018-20e7e3ee4ab3"&gt;helpful blog&lt;/a&gt; [6] providing some questions and advice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Statistical knowledge:
&lt;/h2&gt;

&lt;p&gt;Refresh your stats knowledge. A friend of mine recommended the book &lt;a href="https://greenteapress.com/wp/think-stats-2e/"&gt;'Think Stats'&lt;/a&gt; [7] as a good introduction to probability and statistics using python programming. In case R will be your language of choice you could start with &lt;a href="http://www.academia.dk/BiologiskAntropologi/Epidemiologi/PDF/Introductory_Statistics_with_R__2nd_ed.pdf"&gt;'Introductory statistics with R'&lt;/a&gt; [8]. But there are plenty more. Again, you might also find helpful courses on Udacity, Coursera and the like.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Science knowledge:
&lt;/h2&gt;

&lt;p&gt;To boost your data science knowledge have a look at &lt;a href="https://www.kaggle.com/"&gt;Kaggle&lt;/a&gt;. Not only have they lots of free data sets to play with and the possibility to enter some data science challenges, but they also have good &lt;a href="https://www.kaggle.com/getting-started/45536"&gt;tutorials for starters&lt;/a&gt;. Another free R-based course &lt;a href="https://lagunita.stanford.edu/courses/HumanitiesSciences/StatLearning/Winter2016/about"&gt;'Statistical Learning'&lt;/a&gt; (main focus regression and classification) [9], that I can highly recommend, accompanies the free book &lt;a href="http://faculty.marshall.usc.edu/gareth-james/ISL/"&gt;'An Introduction to Statistical Learning (Applications with R)'&lt;/a&gt; [10]. Packt publishing offers a good range of data science books focusing on &lt;a href="https://www.packtpub.com/big-data-and-business-intelligence/building-machine-learning-systems-python-third-edition"&gt;Python&lt;/a&gt; [11] and &lt;a href="https://www.packtpub.com/gb/big-data-and-business-intelligence/machine-learning-r-third-edition"&gt;R&lt;/a&gt; &lt;a href="//watch%20out%20for%20cheap/free%20e-books%20that%20they%20sometimes%20have%20on%20offer."&gt;12&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, in case you are searching for some free programming books: &lt;a href="https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#r"&gt;https://github.com/EbookFoundation/free-programming-books/blob/master/free-programming-books.md#r&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Blog: &lt;a href="https://www.cio.com/article/3263790/data-science/the-essential-skills-and-traits-of-an-expert-data-scientist.html"&gt;the-essential-skills-and-traits-of-an-expert-data-scientist&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Blog: &lt;a href="https://www.kdnuggets.com/2017/03/what-makes-great-data-scientist.html"&gt;what-makes-great-data-scientist&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Blog: &lt;a href="https://medium.com/apteo/what-makes-a-good-data-scientist-at-a-small-company-3f445d421dff"&gt;what-makes-a-good-data-scientist-at-a-small-company&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Blog: &lt;a href="https://medium.com/@jbyrnephd/the-importance-of-soft-skills-in-data-science-book-recommendations-3cbce1b11c67"&gt;the-importance-of-soft-skills-in-data-science-book-recommendations&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Book: Cracking the Coding Interview - 6th edition. Gayle Laakmann McDowell (2015). (heavy on algorithms)&lt;/li&gt;
&lt;li&gt;Blog: &lt;a href="https://towardsdatascience.com/notes-and-technical-questions-from-interviewing-as-a-data-scientist-in-2018-20e7e3ee4ab3"&gt;notes-and-technical-questions-from-interviewing-as-a-data-scientist-in-2018&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Book: &lt;a href="https://greenteapress.com/wp/think-stats-2e/"&gt;Think Stats - Probability and Statistics for Programmers&lt;/a&gt;, 2nd edition. (2014) A.B. Downey. O'Reilly&lt;/li&gt;
&lt;li&gt;Book: &lt;a href="http://www.academia.dk/BiologiskAntropologi/Epidemiologi/PDF/Introductory_Statistics_with_R__2nd_ed.pdf"&gt;Introductory Statistics with R&lt;/a&gt;, 2nd edition. (2008) P. Dalgaard. Springer&lt;/li&gt;
&lt;li&gt;Course: &lt;a href="https://lagunita.stanford.edu/courses/HumanitiesSciences/StatLearning/Winter2016/about"&gt;Statistical Learning&lt;/a&gt;. (2016) T. Hastie &amp;amp; R. Tibshirani. Stanford University&lt;/li&gt;
&lt;li&gt;Book: &lt;a href="http://faculty.marshall.usc.edu/gareth-james/ISL/"&gt;An Introduction to Statistical Learning&lt;/a&gt;. (2017) G. James, D. Witten, T. Hastie &amp;amp; R. Tibshirani. Springer&lt;/li&gt;
&lt;li&gt;Book: &lt;a href="https://www.packtpub.com/big-data-and-business-intelligence/building-machine-learning-systems-python-third-edition"&gt;Building machine learning systems with python&lt;/a&gt;, 3rd edition  (2018) W. Richard et al.. Packt&lt;/li&gt;
&lt;li&gt;Book: &lt;a href="https://www.packtpub.com/gb/big-data-and-business-intelligence/machine-learning-r-third-edition"&gt;Machine Learning with R&lt;/a&gt;, 3rd edition. (2019) B.Lantz. Packt&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>career</category>
      <category>hiring</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Scala - pattern matching (exploring different solutions)</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Sun, 11 Nov 2018 10:54:49 +0000</pubDate>
      <link>https://forem.com/bettyes/scala---pattern-matching-exploring-different-solutions-4j48</link>
      <guid>https://forem.com/bettyes/scala---pattern-matching-exploring-different-solutions-4j48</guid>
      <description>&lt;p&gt;This is a very short comment about Scala pattern matching.&lt;/p&gt;

&lt;p&gt;I recently had to deal with some pattern matching action in Scala. Have you ever been confused by all the &lt;code&gt;match{ case x+&amp;gt; y}&lt;/code&gt; ? To fully understand the match-case expressions in scala I tried too use different approaches to solve a simple pattern matching task. Please find the complete code including test suite on &lt;a href="https://github.com/BettyES/HenryWives" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The task: &lt;strong&gt;Which of Henry's wifes survived?&lt;/strong&gt; Given a first name and years of marriage (rounded down), one can identify whether Henry's wife died or survived his marriage.&lt;/p&gt;

&lt;p&gt;As a reminder: &lt;br&gt;
&lt;strong&gt;(1) Catherine of Aragon, 24 years, survived&lt;/strong&gt; (11 June 1509 – 23 May 1533 ; marriage annulled) ; &lt;br&gt;
&lt;strong&gt;(2) Anne Boleyn, 2 years, died&lt;/strong&gt; (28 May 1533 – 17 May 1536 ; Beheaded 19 May 1536 at the Tower of London. Mother of Elizabeth I); &lt;br&gt;
&lt;strong&gt;(3) Jane Seymour,1 year, died&lt;/strong&gt; (30 May 1536 – 24 October 1537 ; Died 24 October 1537, twelve days after giving birth due to complications. Mother of Edward VI); &lt;strong&gt;(4) Anne of Cleves, 0 years, survived&lt;/strong&gt; (6 January 1540 – 9 July 1540 ; Annulled); &lt;br&gt;
&lt;strong&gt;(5) Catherine Howard, 1 year, died&lt;/strong&gt; (28 July 1540 – 23 November 1541 ; Beheaded 13 February 1542 at the Tower of London), &lt;br&gt;
&lt;strong&gt;(6) Catherine Parr, 2 years, survived&lt;/strong&gt; ( 12 July 1543 – 28 January 1547 ; Widowed ; Survived Henry VIII)&lt;/p&gt;

&lt;p&gt;Of course the simplest solution is the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(name == "Catherine" &amp;amp;&amp;amp; marriage &amp;gt;=2) || (name == "Anne" &amp;amp;&amp;amp; marriage &amp;lt;1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Implementing the match case expression, the following would work as well:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name match {
     case "Catherine" =&amp;gt; marriage match {
         case 1 =&amp;gt; false
         case _ =&amp;gt; true
     }
     case "Anne" =&amp;gt; marriage match {
         case 0 =&amp;gt; true
         case _ =&amp;gt; false
     }
     case _ =&amp;gt; false
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;However case also works with an if statement&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name match{
     case "Catherine" if marriage &amp;gt;= 2  =&amp;gt; true
     case "Anne" if marriage &amp;lt; 1 =&amp;gt; true
     case _ =&amp;gt; false
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;and finally it is possible to use a boolean&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(name == "Catherine" , name =="Anne" , marriage &amp;lt; 1, marriage &amp;gt;=2) match{
  case (true, false, false, true) =&amp;gt; true
  case(false, true, true, false) =&amp;gt; true
  case(false, false, true, false) =&amp;gt; false
  case(true,false,true, false) =&amp;gt; false
  case(false,true, false, true)=&amp;gt; false
  case _ =&amp;gt; false
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If anyone can think of any other solutions, I would be keen to see them in the comments section. I am eager to improve my scala coding. =)&lt;/p&gt;

</description>
      <category>scala</category>
      <category>beginners</category>
    </item>
    <item>
      <title>First steps in scala - part 2: objects</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Thu, 08 Nov 2018 11:35:58 +0000</pubDate>
      <link>https://forem.com/bettyes/first-steps-in-scala---part-2-2llh</link>
      <guid>https://forem.com/bettyes/first-steps-in-scala---part-2-2llh</guid>
      <description>&lt;p&gt;This is a very basic attempt of mine to help fellow scala starters kick off their first projects including objects. This has also been published on my &lt;a href="https://schirrmeister.wordpress.com/2018/11/08/first-steps-in-scala-part-2/" rel="noopener noreferrer"&gt;personal webpage&lt;/a&gt;. In my previous &lt;a href="https://dev.to/bettyes/first-steps-in-scala---part-i-43j1"&gt;blog&lt;/a&gt; I aimed to get everyone started using different approaches to "hello world" in an IntelliJ IDE. This included, simple print statements, functions and variables. In the following post it is all about:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Introducing objects&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There are many blogs about &lt;a href="https://medium.com/learn-how-to-program/chapter-3-what-is-object-oriented-programming-d0a6ec0a7615" rel="noopener noreferrer"&gt;object oriented programming&lt;/a&gt; and potential &lt;a href="https://greengarageblog.org/6-pros-and-cons-of-object-oriented-programming" rel="noopener noreferrer"&gt;advantages or disadvantages&lt;/a&gt;. Let me try to summarise in short my take aways from some of these. Contrary to &lt;a href="https://en.wikipedia.org/wiki/Procedural_programming" rel="noopener noreferrer"&gt;procedural programming&lt;/a&gt; (from 1960s: Fortran, C, Pascal) where the focus is set around &lt;strong&gt;actions&lt;/strong&gt; (functions), object oriented programming (from 1995: Java) is all about data stored within &lt;strong&gt;objects&lt;/strong&gt;. The reusability of these objects is what makes object oriented programming (OOP) a great approach for large projects. Personally, I love the clear structure of OOP projects, but please feel free to agree or disagree in the comments section ;-) . Each object is build using a &lt;strong&gt;class&lt;/strong&gt; (a template for objects), and comes with its own variables (data storage), called &lt;strong&gt;'fields'&lt;/strong&gt; and its very own functions, called &lt;strong&gt;'methods'&lt;/strong&gt; (the object's behaviour). This terminology makes it also quite easy to distinguish between (i) object linked variables (fields) and functions (methods) and (ii) independent variables and functions.&lt;/p&gt;

&lt;p&gt;To put it simply: objects encapsulate data and define functions that can be applied to these data. This is fantastic, cause you will not have to worry about where to apply a function, as they are clearly associated with a specific object/data. Lets look at a very simple example:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;My first object: a car&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;My car object will have the fields: &lt;strong&gt;color, make and position&lt;/strong&gt; and the method: &lt;strong&gt;move()&lt;/strong&gt;&lt;br&gt;
Looking at some simple code to build your first car object below. I named the project "carPark". It contains a main method, the entry point to our program which always starts with &lt;code&gt;main(args:Array[String])&lt;/code&gt;. Generally, a standalone application cannot run without a main-method, any logic will start from here. In the main method we will create a car object (based on the template defined in the Car class), named "fiat" and check its fields, color, make and position in a print statement (The print statement has a variable reference embedded (&lt;code&gt;s"$variable"&lt;/code&gt;). I mentioned &lt;a href="https://docs.scala-lang.org/overviews/core/string-interpolation.html" rel="noopener noreferrer"&gt;string interpolation&lt;/a&gt; already in my &lt;a href="https://dev.to/bettyes/first-steps-in-scala---part-i-43j1"&gt;last post&lt;/a&gt;.). The Car-class defines the features for our car object and enables us to build as many cars as we like, which will all share the fields, &lt;strong&gt;color&lt;/strong&gt; (user defined, immutable), &lt;strong&gt;make&lt;/strong&gt; (user defined, immutable) and &lt;strong&gt;position&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;object carPark {
  def main(args: Array[String]) {
    val fiat = new Car("red","Fiat");
    println(s"a ${fiat.color} car of make ${fiat.make} 
is now standing at position ${fiat.position.mkString(",")}.")
  }
}

class Car(col: String, mk: String) {
    val color: String = col
    val make: String = mk
    var position = new Array[Int](2);
    position(0) = 0
    position(1) = 0
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Adding a function &lt;strong&gt;move()&lt;/strong&gt; will actually enable us to access the mutable data stored in car.position within the car class and transform these. If you imagined a grid(x,y) we could now move our object car within that grid starting from position(0,0) to position(2,2).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;object carPark {
  def main(args: Array[String]) {
    val fiat = new car("red","Fiat")

    // Move to a new location
    fiat.move(2, 2)
    println(s"a ${fiat.color} car of make ${fiat.make} 
is now standing at position ${fiat.position.mkString(",")}.")
  }
}

  class Car(col: String, mk: String) {
    val color: String = col
    val make: String = mk
    val position = new Array[Int](2)
    position(0) = 0
    position(1) = 1

    def move(dx: Int, dy: Int) {
      position(0) = position(0) + dx
      position(1) = position(0) + dy
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;***&lt;strong&gt;&lt;em&gt;Optional exercise&lt;/em&gt;&lt;/strong&gt;***&lt;/p&gt;

&lt;p&gt;In case you would like to experiment building your own objects. You could try to add a second car, stepwise adding complexity:&lt;br&gt;
&lt;em&gt;(1) The car object has the same variables and methods as the first&lt;br&gt;
(2) The cars should not be able to move to the same position&lt;br&gt;
If this happens shift the car one on the y position next to the previous car and send a message that the chosen spot was taken and it has been parked to the right&lt;br&gt;
(3) Imagine you only had 5*5 positions available could use the following positions x in (0,4) and y in (0,4). Make sure the second car does not fall out of the grid.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Of course this is only a suggestion on how to get started. There are numerous ways to add more complexity to this example.&lt;br&gt;
Add visual output&lt;/p&gt;




&lt;p&gt;For simple visual solution on the position of your car, you could add a Grid class to display its position (I marked the position of the car with "X"):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// main class with instructions what to do:
// instantiate car, names fiat and move it one position 
// towards x and y
// create a grid and display

object carPark {
  def main(args: Array[String]) {
    val fiat = new Car("red","Fiat")

    // Move to a new location
    fiat.move(2, 2);
// at the moment show method works best for to 5*5
    val streetMap = new Grid(5,5) 
    streetMap.updatePosition(fiat.position(0),fiat.position(1))

    streetMap.show()
  }
}

// build a grid class to visually display position of the car
// field of this class: row, col, streetMap
// methods: updatePosition, show

import Array._
class Grid(r:Int, c: Int) {
  val row: Int = r
  val col: Int = c
  var streetMap = ofDim[String](row, col)
  for (i &amp;lt;- 0 to row-1) {
    for (j &amp;lt;- 0 to col-1) {
      streetMap(i)(j) = " "
    }
  }

  def updatePosition(posX: Int, posY: Int): Unit = {
    streetMap(posX)(posY) = "X"
  }

  def show(): Unit = {
    println("=========================")
    for (i &amp;lt;- 0 to row-1) {
      print("|")
      for (j &amp;lt;- 0 to col-1) {
        print(" " + streetMap(i)(j)+" | ")
      }
      println()
      println("=========================")
    }
  }
}

// car class as shown earlier 
class Car(col: String, mk: String) {      
    val color: String = col     
    val make: String = mk         
    val position = new Array[Int](2);  
    position(0) = 0
    position(1) = 0   

    def move(dx: Int, dy: Int) {       
    position(0) = position(0) + dx
    position(1) = position(1) + dy 
    }   
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In the Grid class I used a &lt;a href="https://alvinalexander.com/scala/how-to-create-multidimensional-arrays-in-scala-cookbook" rel="noopener noreferrer"&gt;multidimensional Array&lt;/a&gt;. A multidimensional &lt;a href="https://docs.scala-lang.org/overviews/collections/arrays.html" rel="noopener noreferrer"&gt;array&lt;/a&gt; stores data in a matrix. It might be worth having a look at arrays first. In the above example car.position is an array. Arrays in scala are a collection of data, just like arrays in java. Examples of different arrays: (I) &lt;code&gt;var numbers: Array[Int] = Array(1,2,3,4)&lt;/code&gt; (II) &lt;code&gt;var strings: Array[String] = Array("hello","goodbye", "servus")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Running the whole program you should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3k50csprv4m6jk5x8cv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn3k50csprv4m6jk5x8cv.png" alt="output1" width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Make it user friendly - add Standard input from commandline&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Finally, if you would like to make this a bit more interactive, we can let the user input his favoured coordinates, by adding a method to the car class that allows a user input. Instead of &lt;code&gt;fiat.move(1, 1)&lt;/code&gt; in the main methods call &lt;code&gt;fiat.readCoordinates(); fiat.move(fiat.position(0),fiat.position(1))&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def readCoordinates(carName: String){
  println(s"where do you want to move your $carName?\n Please enter X     position:")
  val dx  = scala.io.StdIn.readInt()
  println("Please enter Y position")
  val dy = scala.io.StdIn.readInt()
  coord = Array(dx,dy)
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;scala.io.readInt()&lt;/code&gt; &lt;a href=""&gt;Standard Input&lt;/a&gt;&lt;a href="https://www.scala-lang.org/api/2.12.2/scala/io/StdIn$.html" rel="noopener noreferrer"&gt;https://www.scala-lang.org/api/2.12.2/scala/io/StdIn$.html&lt;/a&gt; command enables user input of integers. To read in a String use &lt;code&gt;scala.io.readLine()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now if you'd like to run your program from commandline, just go to &lt;code&gt;yourProject/target/scala*/classes/&lt;/code&gt; and type &lt;code&gt;scala yourProject&lt;/code&gt; and you should be asked to enter x and y coordinates. Please remember that currently the Grid is set to 5*5 fields, so your coordinates should be between [0,4] .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea4cn0hony7jov630l1m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fea4cn0hony7jov630l1m.png" alt="commandline" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can get access to the full project, including a solution for a second car on &lt;a href="https://github.com/BettyES/carPark" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Summary on object oriented programming&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now that we have seen how data and associated methods can be stored in objects , the concept of encapsulation shoud be clearer. Generally, object opriented programming follows &lt;a href="https://medium.freecodecamp.org/object-oriented-programming-concepts-21bb035f7260" rel="noopener noreferrer"&gt;four major principles&lt;/a&gt; including &lt;strong&gt;encapsulation&lt;/strong&gt;, &lt;strong&gt;abstraction&lt;/strong&gt;, &lt;strong&gt;inheritence&lt;/strong&gt; and &lt;strong&gt;polymorphism&lt;/strong&gt;. I will keep a description of these concepts short. Looking at the above example: (i) we have &lt;strong&gt;encapsulated&lt;/strong&gt; data and methods associated with the class car, such as color, make, position and move. (ii) &lt;strong&gt;Abstraction&lt;/strong&gt; means that implementation details are hidden. The method move, for example, takes two numbers and returns a position. We do not see how the actual action (although very simple in this case) takes place. (iii) we have not used the concepts of &lt;strong&gt;inheritance&lt;/strong&gt; and &lt;strong&gt;polymorphism&lt;/strong&gt; in the carPark project. Inheritance in short, if we had a class Vehicles with fields such as color, wheels and method move, we might subset it into classes Cars, Bicycles, and Tricycle. Cars, for example, would inherit the fields color, wheels and move, but might add fields like fuel, motor and methods, like getFuel. If you are keen to know more about these concepts, have a look at this nice &lt;a href="https://medium.freecodecamp.org/object-oriented-programming-concepts-21bb035f7260" rel="noopener noreferrer"&gt;blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;A final remark: Even though I have set focus of this blog on objects, scala is also &lt;strong&gt;functional&lt;/strong&gt;! ...But this will be topic of another blog.&lt;/p&gt;

&lt;p&gt;Stay tuned for more scala starter blogs, covering testing, data structures etc.&lt;/p&gt;

</description>
      <category>scala</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>First steps in scala - part I: hello world</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Sat, 27 Oct 2018 12:04:49 +0000</pubDate>
      <link>https://forem.com/bettyes/first-steps-in-scala---part-i-43j1</link>
      <guid>https://forem.com/bettyes/first-steps-in-scala---part-i-43j1</guid>
      <description>&lt;h1&gt;
  
  
  From the start
&lt;/h1&gt;

&lt;p&gt;This part is for 'bloody' beginners that are eager to do their very first steps in Scala, but are not quite certain how to start. I will start with some simple "hello world" examples to introduce variables and methods. In the next part I will explore objects a bit more. I have been using IntelliJ IDE and am working on a Unix based system.&lt;/p&gt;

&lt;p&gt;To set up IntelliJ for Scala, have a look &lt;a href="https://docs.scala-lang.org/getting-started-intellij-track/getting-started-with-scala-in-intellij.html"&gt;here&lt;/a&gt;.  Many of the concepts covered here can be found at &lt;a href="https://www.tutorialspoint.com/scala/index.htm"&gt;tutorial point&lt;/a&gt;. Originally this how-to-article has been published on my &lt;a href="https://schirrmeister.wordpress.com/2018/10/27/first-steps-in-scala-part-i/"&gt;private website&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Basics&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Scala is object oriented and functional&lt;/li&gt;
&lt;li&gt;Every value is an object&lt;/li&gt;
&lt;li&gt;Every function is a value&lt;/li&gt;
&lt;li&gt;Every function is an object (confused? Functions are created with "val", methods are created with "def" and are part of a class/object. Don't worry too much about it for the moment. In case you do, have a read &lt;a href="https://alvinalexander.com/scala/fp-book-diffs-val-def-scala-functions"&gt;here&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;No redundant type information required&lt;/li&gt;
&lt;li&gt;The biggest difference between Java and Scala is that the “;” line end is optional&lt;/li&gt;
&lt;li&gt;CamelCase naming convention (each new word starts in capital letters)
    function names start lower case: getValue
    Class names start with Capital letters: ValueClass&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Some understanding of Java is definitely helpful to get started with Scala.  Scala components used here in short&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Objects&lt;/strong&gt; - have states and behaviours, e.g. a car may have states: color, make, and behaviour: move&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Classes&lt;/strong&gt; - templates for creating objects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Methods&lt;/strong&gt; -  are basically behaviours. They can occur object independent as functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fields&lt;/strong&gt; - instance variables of an object&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run scala one can choose between interactive mode (in the terminal) vs. script mode (in your IDE).&lt;/p&gt;

&lt;p&gt;To run interactive mode: (1) open your terminal, (2) install scala: &lt;code&gt;brew install scala&lt;/code&gt; (If you need to install brew click &lt;a href="https://brew.sh/"&gt;here&lt;/a&gt;), (3) run scala: &lt;code&gt;scala&lt;/code&gt;, (4) stop scala with ctrl+c&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;A classic: "Hello, world!"&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Lets have a look at our first hello world example. Every application needs an entry point, the main method. In scala, if you create this method manually it will be within an object (For alternative ways to launch you project have a look &lt;a href="https://alvinalexander.com/scala/how-to-launch-scala-application-with-object-main-method-trait"&gt;here&lt;/a&gt;). In script-mode create a new file helloworld.scala which should contain an object with the main method. In there you place your print arguement. (use &lt;code&gt;println()&lt;/code&gt; for ending in a new line, else &lt;code&gt;print()&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Contents of helloworld.scala&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;object HelloWorld { 
def main(args: Array[String]) {
println("Hello, world!") }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You can run this file directly in IntellyJ's console, or in the terminal by &lt;code&gt;cd ~/path/FolderContainingTheFile/&lt;/code&gt; and typing &lt;code&gt;scala helloworld.scala&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Contrary to Java you can drop the ';' at the end of a line. However, you can keep it as a line break in between statements. Assigning strings to variables, also does not nescessarily require a declaration of the data type. Variables themselves can be &lt;strong&gt;mutable&lt;/strong&gt; (var) and &lt;strong&gt;immutable&lt;/strong&gt; (val).&lt;/p&gt;

&lt;p&gt;Lets run the "hello world" again, but this time including concepts mentioned above:&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;object HelloWorld {
def main(args: Array[String]) {
val s: String = ”Hello, world!"; println(s)
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and, finally, we can also move the print-statement into a function, that we call afterwards in our main method.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;object HelloWorld {
  def main(args: Array[String]) {
    val name: String = "Joe"
    hello(name)
  }

  def hello(s: String ): Unit ={
    println(s"Hello, $s!")
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Please note that in above's print-statement, by adding 's' infront of " , we enable calling a variable (${variablereference}) within a String, called &lt;a href="https://docs.scala-lang.org/overviews/core/string-interpolation.html"&gt;String interpolation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In IntelliJ IDE it should look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aKfZvYL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wyzf2tm8g9mw316j1kzi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aKfZvYL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wyzf2tm8g9mw316j1kzi.png" alt="hello world in IntelliJ"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of typing scala helloWorld.scala in the terminal you can just run your helloWorld within IntelliJ by pressing the green 'play' butten next to your main method.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Data types&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Finally, below some data types used in scala. Regarding numbers you will most of the time be dealing with int (whole numbers) and double (fractions):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Byte:&lt;/strong&gt; 8 bit signed value from -128 to +127&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Short:&lt;/strong&gt; 16 bit signed value. Range -32768 to +32767&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Int:&lt;/strong&gt; 32 bit signed value. Range -2147483648 to +2147483647&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long:&lt;/strong&gt; 64 bit signed value. -9 223 372 036 854 775 808 to +9 223 372 036 854 775 807&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Float:&lt;/strong&gt; 32 bit IEEE 754 single-precision float&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Double:&lt;/strong&gt; 64 bit IEEE 754 double-precision float&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Char:&lt;/strong&gt; 16 bit unsigned Unicode character. Range from U+0000 to U+FFFF&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;String:&lt;/strong&gt; A sequence of Chars&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boolean:&lt;/strong&gt; Either the literal true or the literal false&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Next part:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In the next blog part some more object oriented programming (including pros and cons), creating a car class, grid class for simple visual output and exploring some standard input.&lt;/p&gt;

</description>
      <category>scala</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>My first, shiny Docke"R" image</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Fri, 10 Aug 2018 16:17:28 +0000</pubDate>
      <link>https://forem.com/bettyes/my-first-shiny-docker-image-1jp7</link>
      <guid>https://forem.com/bettyes/my-first-shiny-docker-image-1jp7</guid>
      <description>&lt;p&gt;Far from being a Docker expert, I nevertheless tried recently to build my own Docker containers, as it makes it so much easier to transfer apps between operating systems (os). However, every start is challenging and hence, I felt a documentation of my first steps might come in handy for people eager to containerize away. I am working with a mac os and have build a container for a R-shiny app. This has been originally been published on &lt;a href="https://schirrmeister.wordpress.com/2018/08/10/my-first-shiny-docker-image/" rel="noopener noreferrer"&gt;my website&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Docker
&lt;/h2&gt;

&lt;p&gt;Docker was introduced to the public in 2013 at PyCon in Santa Clara (I recommend you watch the 5 min. talk &lt;a href="https://www.youtube.com/watch?v=wW9CAH9nSLs" rel="noopener noreferrer"&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Docker software is aiming to facilitate project implementation, putting your applications into Linux-containers (containerization), which will include all the libraries that your app requires. It is similar to a virtual machine, however, has the advantage of not simulating a whole computer operating system, but only the necessary bits. Hence, docker containers outperform VMs.&lt;/p&gt;

&lt;p&gt;Some phrase explanations: A container is an isolated software environment which runs the application. It holds a static docker-image, which contains everything that your app needs, e.g code, libraries and configuration files. The source code for your images is stored in Dockerfiles. Assuming everybody likes to bake: The image is the recipe, the container is the cake.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker vs. virtual machines
&lt;/h2&gt;

&lt;p&gt;Each virtual machine holds a copy of a full operating system that its applications are using. Therefore, VMs will take up a lot of space and memory, consequently, being computationally expensive and slow. Docker, on the other hand is build upon the host OS, hence does not need an additional OS and can excel in performance and storage requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ft5k021w9fk316mtd7s38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Ft5k021w9fk316mtd7s38.png" alt="image"&gt;&lt;/a&gt;&lt;br&gt;
    Fig. 1: On the left applications (A-C) deployed using Virtual Machines. On the right applications deployed with docker containers. Docker uses the host OS and makes the additional Guest OS obsolete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why use Docker
&lt;/h2&gt;

&lt;p&gt;One of the biggest advantages for me as an R-user is the stability and reusability of R-versions and corresponding packages. Whereas you often run into issues with libraries no longer supported by your current R version, docker stores the required R environment and the used libraries.&lt;/p&gt;

&lt;p&gt;Additionally, Docker is easy to deploy and saves you the hustle of installation and setting up your webapps on different machines.&lt;/p&gt;

&lt;h2&gt;
  
  
  How-to-guide for your first Docker Image
&lt;/h2&gt;

&lt;p&gt;(this guide focuses on mac os)&lt;br&gt;
-&lt;a href="https://store.docker.com/editions/community/docker-ce-desktop-mac" rel="noopener noreferrer"&gt;Install docker&lt;/a&gt;&lt;br&gt;
-Open docker (click on icon)&lt;br&gt;
-Open terminal and check:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker info #basic system information  (how many containers, images, running etc.)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
  
  
  Before you build your own container with an app, have a look at the container provided by docker
&lt;/h4&gt;

&lt;p&gt;-Log into your Docker account and run the hello-world container&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run hello-world #runs hello-world container example from docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3dy9o9z897dp6o1mpws9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3dy9o9z897dp6o1mpws9.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;because the hello-world image above is not found locally, it will be pulled from the Docker Hub. If you see the text above it worked.&lt;/p&gt;

&lt;p&gt;-To view your docker images:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker images #displays the images on your machine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmylaexxpry3cizij98si.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fmylaexxpry3cizij98si.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Create a local docker container for your app
&lt;/h4&gt;

&lt;p&gt;-Create a directory and go there:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir DockerRep # created new directory
cd DockerRep # change directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;-Create your app and a run file:&lt;/p&gt;

&lt;p&gt;app.R (I have created that app in another &lt;a href="https://dev.to/bettyes/make-your-code-shiny--598d"&gt;blog&lt;/a&gt;)&lt;br&gt;
app_run.R (see content below):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require(shiny) #loads shiny package
shiny::runApp("app.R", launch.browser = FALSE, port = 8080, host = "0.0.0.0") #runs shiny app in port 8080 localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;-Create a Dockerfile (I am using vi commandline-editor. Feel free to use anything you like)&lt;/p&gt;

&lt;p&gt;Dockerfile (below):&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#build an image on top of the base image for r version 3.5.1 from [rocker] (https://hub.docker.com/r/rocker/r-ver/~/dockerfile/)
FROM rocker/r-ver:3.5.1 
#install necessary libraries
RUN R -e "install.packages(c('ggplot2','shiny'))"

#copy the current folder into the path of the app
COPY . /usr/local/src/app
#set working directory to the app
WORKDIR /usr/local/src/app

#set the unix commands to run the app
CMD ["Rscript","app_run.R"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;So in my ~/path/DockerRep/ I have three files: 1) app.R; 2) app_run.R; 3) Dockerfile.&lt;/p&gt;

&lt;p&gt;Finally, read the recipe and bake the cake, or just build the image and run the container:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#build an image named "mydockerapp"(needs to be lower case)
docker build -t mydockerapp .

#run the image "mydockerapp" in the container "DOCKERapp" in port 8080 
docker run --name DOCKERapp -p 8080:8080 mydockerapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhvusprqf4xy5rtzdgrkt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fhvusprqf4xy5rtzdgrkt.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Calling https:/localhost:8080 in your webbrowser you can now use your containerized shiny app. Additionally you'll be able to ship your container to a server, another mashine etc. The R enivironment in your container will remain the same and your app will be running smoothely, even if you happen to update your R version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcnd1dk37dd3wbjfa94eb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fcnd1dk37dd3wbjfa94eb.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Few further notes:
&lt;/h3&gt;

&lt;p&gt;If you want to view which containers are running and have run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker ps #running
docker ps -a #have run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Be aware that everytime you use docker run image-name you are creating a new container. Instead you could run docker run -rm image-name, which will ensure the container is removed afterwards.&lt;/p&gt;

&lt;p&gt;If you would like to delete containers:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker rm -f containerName #remove a container&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  TOP 5 Docker commands&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;Below is a list of docker commands I found usefull. Vote for your favorite command in the comments section.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1- docker run -t -i ubuntu /bin/bash #running an ubuntu machine

&lt;p&gt;2- docker ps #are there still container running&lt;/p&gt;

&lt;p&gt;3- docker images #display docker images&lt;/p&gt;

&lt;p&gt;4- docker build #builds docker images&lt;/p&gt;

&lt;p&gt;5- docker rm -f containerName #delete containers you no longer need&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h4&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Helpful links&lt;br&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://www.docker.com/" rel="noopener noreferrer"&gt;https://www.docker.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/get-started/#docker-concepts" rel="noopener noreferrer"&gt;https://docs.docker.com/get-started/#docker-concepts&lt;/a&gt; (detailed instructions on where to start)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.docker.com/docker-for-mac/" rel="noopener noreferrer"&gt;https://docs.docker.com/docker-for-mac/&lt;/a&gt; (docker for mac - get started)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ropenscilabs.github.io/r-docker-tutorial/" rel="noopener noreferrer"&gt;https://ropenscilabs.github.io/r-docker-tutorial/&lt;/a&gt; (some instructions on how to run Rstudio in a container and generally on R and docker)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://journal.r-project.org/archive/2017/RJ-2017-065/RJ-2017-065.pdf" rel="noopener noreferrer"&gt;An Introduction to Rocker: Docker Containers for R&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;More on &lt;a href="https://ropenscilabs.github.io/r-docker-tutorial/05-dockerfiles.html" rel="noopener noreferrer"&gt;Dockerfiles&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@hudsonmendes/docker-have-a-ubuntu-development-machine-within-seconds-from-windows-or-mac-fd2f30a338e4" rel="noopener noreferrer"&gt;Docker: have a Ubuntu development machine within seconds, from Windows or Mac&lt;/a&gt;&lt;br&gt;
(some instructons on how to building and using a containerised a unix-machine)&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>docker</category>
    </item>
    <item>
      <title>Make your code shiny</title>
      <dc:creator>BettyES</dc:creator>
      <pubDate>Wed, 14 Feb 2018 15:12:58 +0000</pubDate>
      <link>https://forem.com/bettyes/make-your-code-shiny--598d</link>
      <guid>https://forem.com/bettyes/make-your-code-shiny--598d</guid>
      <description>&lt;p&gt;I have recently written a very basic beginner's guide to a simple shiny app. To be found &lt;a href="https://schirrmeister.wordpress.com/2018/02/13/let-your-code-be-shiny/"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The intention was that I had a set of results (differing by the value of one input variable) that I wanted to compare. After some tiresome rerunning the model and plotting results for comparisons I decided to make the whole process a bit quicker.&lt;/p&gt;

&lt;p&gt;Thanks to shiny adjustment of the input values created results at an instant, made the whole interactive and more fun to present.&lt;/p&gt;

&lt;p&gt;Sounds good? Ok, lets do it:&lt;/p&gt;

&lt;p&gt;Some very basic introduction to build your shiny app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get started...
&lt;/h2&gt;

&lt;p&gt;To start off install.packages("shiny").  The two main components of your first shiny app are the ui (user interface) and server (holds the server-side logic - the server function). Basically you take care of all your designs in the ui and add all your functionality in the server (user input ==&amp;gt; outputs). Now two options are available:&lt;br&gt;
1-store files separately in one folder  as ui.R and server.R&lt;br&gt;
2-store them in one file (in this case make sure to add shinyApp(ui = ui, &lt;br&gt;
 server = server) in the end).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
ui &amp;lt;- fluidPage()
server &amp;lt;- function(input, output) {}
shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;I think shiny appears to be incredibly easy in creating webapps with lots of functionality and great looks, from what I have seen so far elsewhere (python, java). Though I have not tried out a lot in these languages and am far from confident in building python or java webapps.&lt;/p&gt;

&lt;p&gt;To create a nice user interface shiny offers some easy to use (HTML derived) commands:&lt;br&gt;
h1() add a first header - use h2, h3, h4, h5, h6 to add more headers,&lt;br&gt;
strong() for bold text,&lt;br&gt;
em() for italicized text,&lt;br&gt;
br() to add a line break,&lt;br&gt;
a() to add a hyperlink,&lt;br&gt;
img() to add an image,&lt;br&gt;
code() to display,&lt;br&gt;
hr() for a horizontal rule.&lt;/p&gt;

&lt;p&gt;Have a look &lt;a href="https://shiny.rstudio.com/articles/tag-glossary.html"&gt;here&lt;/a&gt; for more options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout
&lt;/h2&gt;

&lt;p&gt;There are several layout options:&lt;/p&gt;

&lt;h3&gt;
  
  
  1- Default layout...
&lt;/h3&gt;

&lt;p&gt;...is to have a sidebar for inputs and a major panel for outputs (sidebarpanel(input), mainbarpanel(output) within the ui)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
library(ggplot2)
ui &amp;lt;- fluidPage(
h1("Some iris data visualised"),br(),

  sidebarLayout(position="left",

     sidebarPanel(
        sliderInput("bin", "Binwidth:",min = 0.1, max = 1, value = 1)
      ),

     mainPanel(plotOutput("IrisPlot"))
  )
)

server &amp;lt;- function(input, output) {
  output$IrisPlot &amp;lt;- renderPlot({
     ggplot(iris)+geom_histogram(aes(Sepal.Length, fill=Species),
          binwidth=input$bin, colour="white")+facet_wrap(~Species)
  })
}

shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  2-  Grid layout...
&lt;/h3&gt;

&lt;p&gt;...uses fluidrow(), columns() and wellpanel().  The page is separated into 12 columns, so make sure to add up to these. The wellpanel() creates a panel with grey background. To create the same image as above use:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
library(ggplot2)
ui &amp;lt;- fluidPage(
h1("Some iris data visualised"),br(),

  fluidRow(
     column(4,
       wellPanel(
         sliderInput("bin", "Binwidth:",min = 0.1, max = 1, value = 1)
       )
     ),

     column(8,
       plotOutput("IrisPlot")
      )
  )
)

server &amp;lt;- function(input, output) {
 output$IrisPlot &amp;lt;- renderPlot({
   ggplot(iris)+geom_histogram(aes(Sepal.Length, fill=Species),
      binwidth=input$bin, colour="white")+facet_wrap(~Species)
 })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Please have a look at this &lt;a href="https://shiny.rstudio.com/articles/layout-guide.html#grid-layouts-in-depth"&gt;page&lt;/a&gt; to get more information on the Grid layout.&lt;/p&gt;

&lt;h3&gt;
  
  
  3- Layered layout...
&lt;/h3&gt;

&lt;p&gt;...with tabsetPanel() and navlistPanel()&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
library(ggplot2)
ui &amp;lt;- fluidPage(
  h1("Some iris data visualised"),br(),
  fluidRow(
   column(4,
      wellPanel(
        sliderInput("bin", "Binwidth:",
          min = 0.1, max = 1, value = 1)
    )),

   column(8,
     tabsetPanel(
       tabPanel("Plot",plotOutput("IrisPlot")),
       tabPanel("Summary",verbatimTextOutput("IrisSummary")),
       tabPanel("Table",tableOutput("IrisTable"))
    ))
 )
)
server &amp;lt;- function(input, output) {
 output$IrisPlot &amp;lt;- renderPlot({
     ggplot(iris)+geom_histogram(aes(Sepal.Length,         fill=Species),binwidth=input$bin, colour="white")+facet_wrap(~Species)
  })
 output$IrisSummary &amp;lt;- renderPrint({summary(iris)})
 output$IrisTable &amp;lt;-renderTable(iris)
}
shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If you have more than a few tabs the navlistPanel may come in handy, adding sidebars instead of tabs to your shiny app. the code is the same as above, just replace tabsetPanel with navlistPanel.&lt;/p&gt;

&lt;h3&gt;
  
  
  4- Layout with several pages...
&lt;/h3&gt;

&lt;p&gt;...navbarPage() will do the trick.  "Just" replace your fluidPage() with navbarPage(), well..., I admit that is not all. You will have to restructure a bit, as shown below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
library(ggplot2)
ui &amp;lt;-navbarPage("Iris data: ",
 tabPanel("Plot",
    sidebarLayout(position="left",
      sidebarPanel(
        sliderInput("bin", "Binwidth:",min = 0.1, max = 1, value = 1)
      ),
      mainPanel(
         plotOutput("IrisPlot")
      ))
 ),
 tabPanel("Summary",
    verbatimTextOutput("IrisSummary")),
 tabPanel("Table",
    tableOutput("IrisTable"))
 )

server &amp;lt;- function(input, output) {
     output$IrisPlot &amp;lt;- renderPlot({
        ggplot(iris)+geom_histogram(aes(Sepal.Length, fill=Species),
            binwidth=input$bin, colour="white")+facet_wrap(~Species)
     })
 output$IrisSummary &amp;lt;- renderPrint({summary(iris)})
 output$IrisTable &amp;lt;-renderTable(iris)
}

shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Shiny done
&lt;/h3&gt;

&lt;p&gt;Feel free to add more widgets (please have a look &lt;a href="https://shiny.rstudio.com/gallery/widget-gallery.html"&gt;here&lt;/a&gt; for the vast amount of choices) and off you go with your first basic  &lt;strong&gt;&lt;em&gt;shiny App&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qga6Rs_n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0kjv1xovo602nu1onx35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qga6Rs_n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0kjv1xovo602nu1onx35.png" alt="Alt final shiny app"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;code below...&lt;/p&gt;

&lt;p&gt;For more information have a look at this really nice &lt;a href="https://deanattali.com/blog/building-shiny-apps-tutorial/"&gt;tutorial&lt;/a&gt; (very helpful).&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;library(shiny)
library(ggplot2)
ui &amp;lt;- fluidPage(
 h1("Some iris data visualised"),br(),
  fluidRow(
    column(4,
        wellPanel(
          sliderInput("bin", "Binwidth:",
            min = 0.1, max = 1, value = 1)
    )),
    column(8,
      tabsetPanel(
        tabPanel("Plot",plotOutput("IrisPlot")),
        tabPanel("Summary",verbatimTextOutput("IrisSummary")),
        tabPanel("Table",tableOutput("IrisTable"))
    ))
 ),
 fluidRow(
    column(4,
      checkboxGroupInput("Species", label = "Select Species",
        choices = list("Iris setosa" = "setosa", 
          "iris versicolor" = "versicolor",
          "iris verginica" = "virginica"),
          selected = 1)),
    column(8,plotOutput("IrisPlot2"))
 )
)

   server &amp;lt;- function(input, output) {
     output$IrisPlot &amp;lt;- renderPlot({
        ggplot(iris)+geom_histogram(aes(Sepal.Length,     fill=Species),binwidth=input$bin, colour="white")+facet_wrap(~Species)
     })
 output$IrisSummary &amp;lt;- renderPrint({summary(iris)})
 output$IrisTable &amp;lt;-renderTable(iris)

output$IrisPlot2 &amp;lt;- renderPlot({
   ggplot(iris[iris$Species==input$Species,])+geom_point(aes(Sepal.Length,     Sepal.Width,color=Species))
 })
}

shinyApp(ui = ui, server = server)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>beginners</category>
    </item>
  </channel>
</rss>
