mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-07-31 20:10:49 +02:00
Merge pull request #183 from isomorphisms/patch-4
Bender Bending Rodríguez
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
language: R
|
language: R
|
||||||
contributors:
|
contributors:
|
||||||
- ["e99n09", "http://github.com/e99n09"]
|
- ["e99n09", "http://github.com/e99n09"]
|
||||||
|
- ["isomorphismes", "http://twitter.com/isomorphisms"]
|
||||||
filename: learnr.r
|
filename: learnr.r
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -296,14 +297,13 @@ if (4 > 3) {
|
|||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
|
|
||||||
# Defined like so:
|
# Defined like so:
|
||||||
myFunc <- function(x) {
|
jiggle <- function(x) {
|
||||||
x <- x * 4
|
x+ rnorm(x, sd=.1) #add in a bit of (controlled) noise
|
||||||
x <- x - 1
|
|
||||||
return(x)
|
return(x)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Called like any other R function:
|
# Called like any other R function:
|
||||||
myFunc(5) # 19
|
jiggle(5) # 5±ε. After set.seed(2716057), jiggle(5)==5.005043
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Fun with data: vectors, matrices, data frames, and arrays
|
# Fun with data: vectors, matrices, data frames, and arrays
|
||||||
|
Reference in New Issue
Block a user