library(learnr) library(readr) knitr::opts_chunk$set(echo = FALSE)
my_data in R, write R code to write the data frame into a .csv file named "my_data_no_name.csv" without column names. my_data in R which contains NA values, write R code to write the data frame into a delimited file called "my_data_na.csv" with # as the delimiter and use 999 as the indicator for missing values. * as the delimiter and the file is located in the current working directory. Write R code to read the file into an object with name my_data.d1 <- read_csv("x,y,z 1,3,5 2,4,6", col_names = FALSE)
Which of the following are the column names of the d1?
X1, X2, and X3x, y, and z
First, run the code below.
read_csv("The first line The second line The third line x,y,z 1,3,5", )
Which of the following are the column names of the d1?
Which of the following is a valid object name in R?
2.True
elseI_am_not_a_valid_nameI_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")
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.