en:learning:schools:s01:worksheets:ba-ws-01-1

This shows you the differences between two versions of the page.

en:learning:schools:s01:worksheets:ba-ws-01-1 [2015/09/22 16:22] |
en:learning:schools:s01:worksheets:ba-ws-01-1 [2015/09/22 16:22] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== W01-1: R studio ====== | ||

+ | For a warm up, this worksheet handles writing and executing R scripts from within R studio. After completing this worksheet you should be able to write simple R scripts in R studio and execute individual lines. | ||

+ | |||

+ | ===== Things you need for this worksheet ===== | ||

+ | * {{section>en:resources:templates:tools#R environment&inline}} | ||

+ | * {{section>en:resources:templates:tools#R studio&inline}} | ||

+ | |||

+ | |||

+ | ===== Learning log assignments ===== | ||

+ | In this first worksheet, we will do some finger exercises in R using the R Studio IDE. | ||

+ | |||

+ | :-\ Please open R Studio, write a code line into a new R script which will print "Hello World" and execute this single line using the <Ctrl>-<Return> keyboard shortcut. | ||

+ | |||

+ | If you have performed this task: Welcome to R! Now you are up to more and we will use R as a pocket calculator. | ||

+ | |||

+ | :-\ Please try to compute the result of at least five mathematical expressions using only the standard arithmetic operators. | ||

+ | |||

+ | As you noticed, R computes the expressions and returns you the result on the console. If you want to store the values you have used as well as the results, you have to use variables. | ||

+ | |||

+ | :-\ Please repeat your calculations but this time store the values and equations in different variables and only print the results on the console after all five computation have been finished. | ||

+ | |||

+ | So far, you have only used individual values within each equation. What happens if you e.g. use vectors with a length larger than one? Let's try it. | ||

+ | |||

+ | :-\ Please create two variables containing vectors, each of length five using the c() function and try to get the sum of each value pairs (i.e. the sum of the first entries in each vector, the sum of the second etc.) as well as the squared sum of them. | ||

+ | |||

+ | Finally, it is time for some more advanced math stuff. | ||

+ | |||

+ | :-\ Please compute the mean of each of your two vectors using built in R functions in at least two different ways. If you can not guess the names of the functions: internet search engines are your friend. | ||

+ | |||

+ | <note tip>For help on a function, remember that you can always type | ||

+ | |||

+ | ''?<function name without brackets>'' | ||

+ | |||

+ | into your R console. If you look for something unspecific, type | ||

+ | |||

+ | ''"??<search key word>"''</note> | ||

+ | |||

en/learning/schools/s01/worksheets/ba-ws-01-1.txt ยท Last modified: 2015/09/22 16:22 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International