by Karl-Kuno Kunze
Become an insideR within five minutes? Here’s how:
First, open the site r-fiddle.org. Delete demo("graphics")
Now your are ready to enter your first commands. On the right of the ‘>’ enter the following and click ‘Run Code’ on the bottom right. The R Fiddle console should now show the same results as below. R Fiddle Output is preceeded by ##
.
1 2 |
2 + 2 |
1 |
## [1] 4 |
1 2 |
cat('Hello World!') |
1 |
## Hello World! |
Define a vector and print it to the screen with:
1 2 3 |
myVector <- c(1,2,3,4,5,6,7,8,9) myVector |
1 |
## [1] 1 2 3 4 5 6 7 8 9 |
Don’t forget to click the button ‘Run Code’ at the bottom right for executing the command.
Now, square the vector with:
1 2 3 |
myVector2 <- myVector^2 myVector2 |
1 |
## [1] 1 4 9 16 25 36 49 64 81 |
And now, let’s go for a plot:
1 2 |
plot(myVector, myVector2) |
The plot should look like the title graphics. The output of R Fiddle should look like the screenshot below. You can see the plot in R Fiddle on the top right.
Now, you are an R Wizard. Have fun!