![]() That way, you will always remember what you originally intended to code for, in case you lose track. Write what the point of each real code line is, what you plan to do. So use comments to keep track of what you do with the code. When you run the script via a console, R simply ignores them. The lines that start with a # are comments. In the R language, functions are verbs in your sentences, the data are their subject.įor example, in the code above, library(tidyverse) commands R to activate the package tidyverse found in the package library. That “something specific” is defined by functions which are followed by parentheses – function(). Right now these lines do not mean much to you, but in fact, each of them commands R to “do something specific” with your data. They are the real code, the commands that manipulate the data. Let’s start with the lines that do not start with a #. In the script above, there are two types of lines: those that start with the symbol #, and those that do not. To create a project, go to the main menu and select File > New Project… as shown in Figure 5.1: ![]() You will also find it easy to share your work with others since everything they need (and nothing less or more) is in a project.įor example, if you plan to work with course assignments in two different subjects in addition to the data analyses for your master’s thesis, we strongly recommend to set up 3 independent projects in RStudio: one for each subject, and a third one for your thesis. ![]() You do not risk to mix up files or variables with relatively similar names when writing your code, especially if you are not so creative when it comes to naming objects. Working with projects is a great way to keep things tidy. RStudio allows you to divide your work into projects which are independent from each other.Ī project has its on working directory in which you can create specific scripts, load data sets, add external files, activate packages, etc.įor each project, you will thus be guaranteed to work in a dedicated workspace. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |