1 00:00:07,569 --> 00:00:13,599 One of the main strengths of R is not very nice looking syntax of course, it’s the 2 00:00:13,599 --> 00:00:15,349 abundance of packages. 3 00:00:15,349 --> 00:00:22,620 So if you go to cran.r-project.org, this is The Comprehensive R Archive Network. 4 00:00:22,620 --> 00:00:27,880 You have a link here for packages and you see here table of available packages. 5 00:00:27,880 --> 00:00:34,580 You can also sort by date or name, so you get around 15,349 packages. 6 00:00:34,580 --> 00:00:40,540 And that’s a lot so I’m audio guy. 7 00:00:40,540 --> 00:00:43,800 So lets have a look over here for audio. 8 00:00:43,800 --> 00:00:45,920 So there’s and audio package. 9 00:00:45,920 --> 00:00:49,770 If you want to install such a package in R, its pretty straightforward. 10 00:00:49,770 --> 00:00:57,879 What you need to do is you say, ‘install.packages’ and then you say the name of the package, 11 00:00:57,879 --> 00:01:02,010 ‘audio’ and then you just execute. 12 00:01:02,010 --> 00:01:06,470 It asks me whether I want to compile it from source, this is fine. 13 00:01:06,470 --> 00:01:15,240 So a lot of the R packages are written C or C++ so you need to have a C compiler installed, 14 00:01:15,240 --> 00:01:19,670 and then the package is compiled on your machine for you. 15 00:01:19,670 --> 00:01:26,940 So this is done, in order to use the package you need to load it. 16 00:01:26,940 --> 00:01:34,140 Say library or you can also say require, it doesn’t matter and then you say audio. 17 00:01:34,140 --> 00:01:40,119 So now the package is loaded and you see that also here, that the audio package is now loaded. 18 00:01:40,119 --> 00:01:41,470 And now you can use it. 19 00:01:41,470 --> 00:01:47,860 So, if you want to have a look at the source code or some examples, you can just drill 20 00:01:47,860 --> 00:01:50,490 down from the R archive. 21 00:01:50,490 --> 00:01:59,680 So I’m going here to this URL, and you see here it’s a little example. 22 00:01:59,680 --> 00:02:06,520 So this should play a sine wave, lets actually have a look whether I can connect to my microphone 23 00:02:06,520 --> 00:02:09,070 with my speaker. 24 00:02:09,070 --> 00:02:14,830 If that works, ok can you hear that? 25 00:02:14,830 --> 00:02:24,170 Ok so that is an example how easy it is to install and use packages in R. And the problem 26 00:02:24,170 --> 00:02:29,440 is not that you wont find a package for a specific task, the problem is more that you 27 00:02:29,440 --> 00:02:33,770 have five or ten different packages for a specific task. 28 00:02:33,770 --> 00:02:39,690 And you need to read a lot and decide which one you are using. 29 00:02:39,690 --> 00:02:44,519 So in the next video I will, how to plot in R studio usning ggplot.