Question

in R language, how would you use mutate() to make a new column in the dataset...

in R language, how would you use mutate() to make a new column in the dataset called moisture100 which contains the moisture score times 100
I wrote
coffee_ratings %>%
mutate(moisture100=moisture*100)
but I get an error?

Homework Answers

Answer #1

Error is recieved because that's not how a mutate function is written in R. To make a new column in the dataset you have to write the correct syntax for mutate function which is:

"Name of Dataset" <- mutate("Name of dataset" , "Define the new column here")

In above syntax, Insert name of your dataset. The function has two arguments: first is the name of dataset we want to modify and second is called a name-pair value in which we define a new column name and assign it's value.In our case, column name is moisture100.

So, the correct way to write your code for mutate function is:

"Your Dataset Name" <- mutate("Your Dataset Name", moisture100 = moisture*100)

Note: Remember that syntax does not contain double quotes (" ") in it. It is for explanation purpose.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Use the built in R dataset called “mtcars.” You can see what variables this dataset contains...
Use the built in R dataset called “mtcars.” You can see what variables this dataset contains by typing help(mtcars). Calculate a scatter plot for the variables: wt and mpg. Also, calculate the correlation coefficient. Calculate a least squares line and plot it in the scatterplot.
Use the programming language R to code the following project.. * Make sure you turn in...
Use the programming language R to code the following project.. * Make sure you turn in your code and answers from each question. (not the raw data). 1. Generate 1000 random samples of size 40 from the normal distribution with mean µ = 3 and standard deviation σ = 2. Compute 95% the confidence interval of 1000 samples and find the rate of confidence interval contains the true mean. What did you learn from this simulation study? 2. For each...
Write a program using K-Means and Expectation Maximization clustering for the given dataset. Use R language...
Write a program using K-Means and Expectation Maximization clustering for the given dataset. Use R language to write the code. Package Name: cluster.datasets install.packages("cluster.datasets") library(cluster.datasets) data(paste your data set name) your dataset name data(mammal.dentition) K-Means Clustering Find optimal number of clusters using Elbow Method and then Apply K-Means clustering. Finally do visualization for K-Means Clustering Expectation Maximization Clustering Q1: Apply Expectation Maximization Q2: Visualization for Expectation Maximization https://www.rdocumentation.org/packages/cluster.datasets/versions/1.0-1/topics/mammal.dentition I have done the K-means part do the second one
Use R to calculate a new variable (called z.days) based on the existing variable "days". This...
Use R to calculate a new variable (called z.days) based on the existing variable "days". This variable should represent the z-scores for each observation of "days". You should therefore have a whole new column in your data set that has 500 different values. When calculating the z-scores in R, be sure to use the z-score formula from Lesson L02, a mean value of 685.25, and a standard deviation of 419.95. Complete the blanks below with the missing syntax you would...
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains...
n this CT assignment, we will use R software to analyze a dataset GoogleAmazonStock.xlsx. It contains daily closing stock prices for Google and Amazon from 8/22/2017 to 8/22/2018. When we examine stock prices (or other financial assets) we often transform them into a (simple) return series. The return series are computed by the formula: (present price/past price) - 1. The dataset contains both stock prices and return series. 1. Using R, construct time series (line) plots for both stock prices...
how to use aov commend in R Studio with only one column of data. the data...
how to use aov commend in R Studio with only one column of data. the data name is temperature for example. I know if there is two column of data i can use like avo(temperature~name, data=temperature), how to do it in one
You have five quantitative variables and two categorical variables in a dataset. You would like to...
You have five quantitative variables and two categorical variables in a dataset. You would like to examine the pairwise relationship between all variables in the dataset. A) What kind of plots or tables are you going to use and why? B) How many unique correlation coefficients r are you expecting to calculate? Show your reasoning/calculations.
You have five quantitative variables and two categorical variables in a dataset. You would like to...
You have five quantitative variables and two categorical variables in a dataset. You would like to examine the pairwise relationship between all variables in the dataset. A) What kind of plots or tables are you going to use and why? B) How many unique correlation coefficients r are you expecting to calculate? Show your reasoning/calculations. (harder question)
How do I upload the Dataset in order for you to answer the following question? Q4c:...
How do I upload the Dataset in order for you to answer the following question? Q4c: If you wanted to make a graphical display of the hrs1 and compuse variables, what would that display be?
You heard someone say that Mercury compounds I used to make vaccine and therefore are harmful...
You heard someone say that Mercury compounds I used to make vaccine and therefore are harmful and no child should get vaccines Given what use you learned about chemical reactions that forms new compounds with new properties would how would you explain the error in their logic
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT