From f0d771ddea5537e98ef47462c5c8c41b0314f856 Mon Sep 17 00:00:00 2001 From: i Date: Fri, 9 Aug 2013 18:13:08 -0400 Subject: =?UTF-8?q?Bender=20Bending=20Rodr=C3=ADguez?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let's make the function example do something a little more interesting. --- r.html.markdown | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'r.html.markdown') diff --git a/r.html.markdown b/r.html.markdown index dd94072b..e7921299 100644 --- a/r.html.markdown +++ b/r.html.markdown @@ -2,6 +2,7 @@ language: R contributors: - ["e99n09", "http://github.com/e99n09"] + - ["isomorphismes", "http://twitter.com/isomorphisms"] filename: learnr.r --- @@ -296,14 +297,13 @@ if (4 > 3) { # FUNCTIONS # Defined like so: -myFunc <- function(x) { - x <- x * 4 - x <- x - 1 +jiggle <- function(x) { + x+ rnorm(x, sd=.1) #add in a bit of (controlled) noise return(x) } # 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 -- cgit v1.2.3