We will pre-install in the code windows all the packages we expect you to use, so you don’t need to install them. They thought about different functions that would be helpful to students and put them all together into a package.įor this course, you really don’t need to worry about all this. Mosaic is an example of a package written by educators. We use several R packages in this course, some of them have been written specifically to help students learn and use R more easily. R packages-thousands of them-are available in an online repository called CRAN. People share functions and example data sets with each other by releasing R packages which can be downloaded and installed, much like you install apps on your computer or phone. You might be wondering, “Where do all these functions come from?” Many R functions are written by people in the R community-in other words, other people who use R. Not only will you find some new functions, but you’ll also find endless discussions about which ones are better than others. What we do-and you can do it too-is just search on the internet for functions we can’t remember. Even advanced users of R can’t remember it all. And, there are often many functions that do similar things. (You can link to it here, and you can also see it in Resources section of the course.) You Can’t Possibly Memorize All of R’s FunctionsĮven though you will learn a lot, there are literally thousands of functions in R, more than anyone could remember. We’ve also provided an R cheat sheet that you can mark up as you go through the course. It may be helpful to keep track of them in a notebook. You’ll learn a lot of functions as you progress through this course. Sometimes R will drive you crazy, sending you off looking for tiny little mistakes that are holding it up.
If you forget a parenthesis, R will give you an error. To take another example: in the print() function, if we left off the quotation marks, typing print(hello) instead of print("hello"), R would return an error message. But if you type Sum(1,100), capitalizing the “s,” it will act like it has no idea what you are talking about! For example, if you type sum(1,100) it will tell you the answer, 101. One thing to be aware of is that R is very, very picky. Sometimes just waiting a few minutes will solve the problem. If it seems really broken, you can try reloading your browser page. One thing that may be helpful is to click in the script window before you click Run, and then watch for it to say “Workspace Ready” next to the Submit button before you click Run. It’s a web application, and so it relies on a server in the background to get everything up and ready to run.
Quirks in DataCamp (Some Patience Required)ĭataCamp can be a little quirky. The output or result of the code (e.g., 30) appears in the R Console.
Notice that the actual R code are the lines you wrote in the script.R window, such as sum(5,10,15) or print("hello").