mirror of
https://github.com/gladstone-institutes/Bioinformatics-Workshops.git
synced 2025-11-30 09:45:43 -08:00
Add files via upload
This commit is contained in:
parent
f4a77a6943
commit
28c2b03b1d
10 changed files with 43197 additions and 0 deletions
34
intro-r-data-analysis/session1/Basic_script.R
Normal file
34
intro-r-data-analysis/session1/Basic_script.R
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#This script perform some basic calculations in R.
|
||||
#To run this script you may select all and hit the Run button on top right of this pane ...
|
||||
#... or go Cmd+A followed by Cmd+Enter on Mac. If you use Windows, ...
|
||||
#... you can also go Ctrl+A followed by Ctrl+Enter.
|
||||
|
||||
#The following command will add 2 to 3 and store the value in variable named 'a'.
|
||||
a <- sum(2,3)
|
||||
|
||||
#The following command will get the product of 2 and 3 and store it in 'b'.
|
||||
b <- prod(2,3)
|
||||
|
||||
#Next, we check if a and b have equal values.
|
||||
a == b
|
||||
|
||||
#Next, we check if a and b are not equal.
|
||||
a != b
|
||||
#Conclusion: Summing numbers is not the same as multiplying them!
|
||||
#Time to write a paper? I think we can go to Nature or Science with this discovery.
|
||||
|
||||
|
||||
#Check if two conditions are simultaneously true.
|
||||
(a == b) & (sqrt(3) == 5)
|
||||
|
||||
#Check if any one of given two conditions are true.
|
||||
#Vertical line is how we say 'or' in R.
|
||||
(a == b) | (sqrt(3) == 5)
|
||||
|
||||
#Variables can also store characters.
|
||||
name <- "Homo sapiens"
|
||||
|
||||
#Is Homo sapiens equal to human being?
|
||||
name == "Human being"
|
||||
|
||||
#Apparently not?
|
||||
Loading…
Add table
Add a link
Reference in a new issue