- Home
- Interview Questions
- R Programming
31.
Name as many functions as you can think of for formatting numbers.
format, formatC, sprintf, and prettyNum are the main ones.
32.
How might you make your computer beep?
Using alarm, or printing an \a character to the console.
33.
What are the classes of the two types of categorical variable?
factor and ordered
34.
What happens if you add a value to a factor that isn’t one of the levels?
The value is counted as missing (NA).
35.
How do you convert a numeric variable to categorical?
Use cut to bin it.
36.
What happens if you pass NA as a condition to if?
if will throw an error if you pass NA to it.
37.
What happens if you pass NA as a condition to ifelse?
ifelse will return NA values in the corresponding positions where NA is passed to it.
38.
What types of variables can be passed as the first argument to the switch function?
switch will conditionally execute code based upon a character or integer argument.
39.
How do you stop a repeat loop executing?
Insert the keyword break into your loop code.
40.
How do you jump to the next iteration of a loop?
Insert the keyword next into your loop code.