88.0k views
1 vote
Which of the following is true about creating a new variable and adding it to our dataset?

a. R will allow us to create a new variable but it will not allow the new variable to be stored in an existing dataset
b. R will allow us to create a new variable and store it in an existing dataset
c. Once we add a new variable to a dataset in R, it changes our original csv file
d. R will allow us to add new variables but not overwrite variables in our dataset

User Brajesh
by
7.4k points

1 Answer

4 votes

Final answer:

The correct option is b. R allows us to create new variables and store them in an existing dataset. Adding a new variable in R does not change the original CSV file.

Step-by-step explanation:

The correct option is b. R will allow us to create a new variable and store it in an existing dataset. When working with R, we can create new variables and add them to our dataset using the assignment operator (<-).

For example, if we have a dataset called mydata and we want to add a new variable called age to it, we can do so by typing mydata$age <- c(20, 25, 30). This will create a new variable called age and store the values 20, 25, and 30 in it.

It's important to note that adding a new variable to a dataset in R does not change the original CSV file. The changes are only made within the R session, and the original CSV file remains untouched.

User Benjamin Crouzier
by
7.8k points