The mutate function is not updated
I have one tbl_df
with multiple columns. I am using a simple mutat to update a column, but the column is not updating.
mutate(fltr, cat = "xxxxx")
cat
is a column that is either empty
or NA
. Filter - tbl_df
. What could be causing this? I tried to put the text in the column cat
so that it is not blank or NA in case of a problem. It still didn't work.
source to share
Mutate is to add new columns (which are functions of existing columns) to the existing file frame. Here you want the static column to be added to the dataframe for which I don't feel like you need to mutate. What you can achieve simply like this:
fltr $ cat <- "xxxxx"
But if you want to add a new column based on an existing column, you can do:
fltr <- mutate (fltr, cat = "write the logic for converting column A to column B, for example: Col_A / 100")
Here "cat" will be the name of the column you created.
source to share