7  Functions and variable names

7.1 Quiz: Variable names I

Can we create a variable named 1_r in R?

✗Yes

✓No

We cannot create variables with a name that starts with a number.

7.2 Quiz - Variable names II

When we execute the code:

a <- 10  
A <- 20  
a == A  

the result will be:

✗TRUE

✓FALSE

In R variable names are case sensitive.

Variable/object names are case sensitive, and therefore we are comparing two different objects.

7.3 Quiz - Functions I

Do all R functions accept/require parameters to be executed?

✓No

✗Yes

There are functions that do not take or require parameters. For instance ls()

7.4 Quiz - Functions II

To compute the number of characters of the following string

"Lorem ipsum dolor"

you should use the base R function:

✗char("Lorem ipsum dolor")

✓nchar("Lorem ipsum dolor")

✗length("Lorem ipsum dolor")

✗size("Lorem ipsum dolor")

You are asked to select a function that counts the number of characters in the string and not the size of a vector.

nchar() counts the number of characters of a string.