Learning and practicing R with swirl
Swirl Package of R is very good to learn R programming and get into practice with R. However I recommend it to those have knowledge of at least One programming language already.
So lets start.
1. Install R
2. Install RStudio
3. Install swirl package
Go to RStudio console and start with:
install.packages("swirl")
> library(swirl) | Hi! Type swirl() when you are ready to begin. > swirl() | Welcome to swirl! Please sign in. If you've been here before, use the same name as you did then. If you are | new, call yourself something unique. What shall I call you? Rajiv | Thanks, Rajiv. Let's cover a couple of quick housekeeping items before we begin our first lesson. First of | all, you should know that when you see '...', that means you should press Enter when you are done reading | and ready to continue. ... <-- That's your cue to press Enter to continue | Also, when you see 'ANSWER:', the R prompt (>), or when you are asked to select from a list, that means | it's your turn to enter a response, then press Enter to continue. Select 1, 2, or 3 and press Enter 1: Continue. 2: Proceed. 3: Let's get going! Selection: 1 | You can exit swirl and return to the R prompt (>) at any time by pressing the Esc key. If you are already | at the prompt, type bye() to exit and save your progress. When you exit properly, you'll see a short | message letting you know you've done so. | When you are at the R prompt (>): | -- Typing skip() allows you to skip the current question. | -- Typing play() lets you experiment with R on your own; swirl will ignore what you do... | -- UNTIL you type nxt() which will regain swirl's attention. | -- Typing bye() causes swirl to exit. Your progress will be saved. | -- Typing main() returns you to swirl's main menu. | -- Typing info() displays these options again. | Let's get started! ... | To begin, you must install a course. I can install a course for you from the internet, or I can send you to | a web page (https://github.com/swirldev/swirl_courses) which will provide course options and directions for | installing courses yourself. (If you are not connected to the internet, type 0 to exit.) 1: R Programming: The basics of programming in R 2: Regression Models: The basics of regression modeling in R 3: Statistical Inference: The basics of statistical inference in R 4: Exploratory Data Analysis: The basics of exploring data in R 5: Don't install anything for me. I'll do it myself. Selection: 1 |====================================================================================================| 100% | Course installed successfully! | Please choose a course, or type 0 to exit swirl. 1: R Programming 2: Take me to the swirl course repository! Selection: 1 | Please choose a lesson, or type 0 to return to course menu. 1: Basic Building Blocks 2: Workspace and Files 3: Sequences of Numbers 4: Vectors 5: Missing Values 6: Subsetting Vectors 7: Matrices and Data Frames 8: Logic 9: Functions 10: lapply and sapply 11: vapply and tapply 12: Looking at Data 13: Simulation 14: Dates and Times 15: Base Graphics Selection: 4 | | 0% | The simplest and most common data structure in R is the vector. ... |=== | 3% | Vectors come in two different flavors: atomic vectors and lists. An atomic vector contains exactly one data | type, whereas a list may contain multiple data types. We'll explore atomic vectors further before we get to | lists. ... |===== | 5% | In previous lessons, we dealt entirely with numeric vectors, which are one type of atomic vector. Other | types of atomic vectors include logical, character, integer, and complex. In this lesson, we'll take a | closer look at logical and character vectors. ... |======== | 8% | Logical vectors can contain the values TRUE, FALSE, and NA (for 'not available'). These values are | generated as the result of logical 'conditions'. Let's experiment with some simple conditions. ... |=========== | 11% | First, create a numeric vector num_vect that contains the values 0.5, 55, -10, and 6. > num_vect <- c(0.5,55,-10,6) | Keep working like that and you'll get there! |============= | 13% | Now, create a variable called tf that gets the result of num_vect < 1, which is read as 'num_vect is less | than 1'. > > tf <- num_vect < 1 | You are amazing! |================ | 16% | What do you think tf will look like? 1: a single logical value 2: a vector of 4 logical values Selection: 2 | That's the answer I was looking for. |================== | 18% | Print the contents of tf now.
So, in this way any one can learn R in interactive way
Comments
Post a Comment