library(learnr) knitr::opts_chunk$set(echo = FALSE)
num_1
.Which of the following is a valid object name in R?
2.True
else
I_am_not_a_valid_name
I_am_a_Pretty#_name
Write R code to get the list of all objects in the environment.
vec_1
with values (7, 24, 8, 26), get its length, and find out its type. char_1
with values ("I", "am", "learning", "R!"), get its length, find out its type, and concatenate the vector into a single string with space as the separator.char_1
defined in Q2, find the number of characters in each string, and convert each string to upper case. vec_1
and char_1
are of character type. Let class1 <- c(7, TRUE)
. Which of the following is the class of class1
?
numeric
character
Let class2 <- c(7, TRUE, "char")
. Which of the following is the class of class2
?
numeric
rep()
function to create the stringc("sheep","pig", "cat","sheep","pig", "cat","sheep","pig", "cat")
rep()
function to create the stringc("sheep","sheep","pig","pig","pig","pig","cat","cat","cat")
Suppose x <- rep(1:3, 1:3)
.
x
in descending order. x
. When elements are ties, use the minimum rank. x
. When sorting characters, which of the following is true?
digits < letters < symbols
Suppose x <- c(5, 2, 4, 1, 2, 1)
summary(x)
x
.x
.x
.Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.