From 8bd3df35a22cbade28568a580fa05e820ef31489 Mon Sep 17 00:00:00 2001 From: Sudhakar Kumar Date: Tue, 20 Nov 2018 11:29:58 +0530 Subject: [PATCH] Fix spelling and grammar (#34387) --- guide/english/r/functions/index.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/guide/english/r/functions/index.md b/guide/english/r/functions/index.md index aa6d022d5d..726a35bfd7 100644 --- a/guide/english/r/functions/index.md +++ b/guide/english/r/functions/index.md @@ -9,17 +9,17 @@ Functions can be named and called repeatedly or can be run anonymously in place Developing full understanding of R functions requires understanding of environments. Environments are simply a way to manage objects. An example of environments in action is that you can use a redundant variable name within a function, that won't be affected if the larger runtime already has the same variable. Additionally, if a -function calls a variable not defined within the function it will check the higher level environment for that variable. +function calls a variable which is not defined within the function, it will check the higher level environment for that variable. ### Syntax In R, a function definition has the following features: 1. The keyword `function` -2. a function name -3. input parameters (optional) -4. some block of code to execute -5. a return statement (optional) +2. A function name +3. Input parameters (optional) +4. Some block of code to execute +5. A return statement (optional) ```{r} # a function with no parameters or returned values @@ -44,7 +44,7 @@ multiply = function(val1, val2){ multiply(3, 5) # prints 15 to the console ``` -Functions are blocks of code that can be reused simply by calling the function. This enables simple, elegent code reuse without explicitly re-writing sections of code. This makes code both more readable, makes for easier debugging, and limits typing errors. +Functions are blocks of code that can be reused simply by calling the function. This enables simple, elegant code reuse without explicitly re-writing sections of code. This makes code both more readable, makes for easier debugging, and limits typing errors. Functions in R are created using the `function` keyword, along with a function name and function parameters inside parentheses. @@ -155,7 +155,7 @@ its factorial with the `factorial()`. - The data that you pass into the function is called the function’s argument. -- You can simulate a roll of the die with R’s `sample()`function. The `sample()` function takes two arguments:a vector named x and a number named size. For example: +- You can simulate a roll of the die with R’s `sample()`function. The `sample()` function takes two arguments: a vector named `x` and a number named `size`. For example: ```r > sample(x = 1:4, size = 2)