Adding columns to a data frame using the mutate function in dplyr

  Рет қаралды 6,157

weecology

weecology

Күн бұрын

Пікірлер: 10
@oscarsibanda9454
@oscarsibanda9454 11 ай бұрын
Thanks, will definitely use this function 🎉
@weecology
@weecology 11 ай бұрын
That's great!
@larissacury7714
@larissacury7714 2 жыл бұрын
thank you!!
@weecology
@weecology 2 жыл бұрын
you're welcome!
@alansantana1838
@alansantana1838 2 жыл бұрын
Is it possible to create a new column by multiplying two columns together? Such as: Mutate(survey, New_column = column_A *column_B)?
@weecology
@weecology 2 жыл бұрын
Yep. That code should work just fine.
@alansantana1838
@alansantana1838 2 жыл бұрын
@@weecology That's great, I am glad that I am getting the hang of this. Unfortunately, the code didn't work. R thinks it's non-numerical. But glad my thought process is in the right place! Thank you!
@weecology
@weecology 2 жыл бұрын
@@alansantana1838 You're welcome! If I had to guess R has stored one of the two columns as something that isn't a number, probably either a string or a factor. You try wrapping that column name in as.numeric, e.g., mutate(survey, New_column = as.numeric(column_A) * column_B). If the column can reasonably be converted to numbers this might fix things for you. The better solution in the long run is to define the type for that column when you import or otherwise create the data.
@aram5704
@aram5704 Жыл бұрын
Can we do that using pipe operator?
@weecology
@weecology Жыл бұрын
Yes, absolutely. Pretty much anything you can do in dplyr can be done using pipes
Sorting data frames using the dplyr arrange function
5:47
Grouping and Summarizing Data Using dplyr
13:54
weecology
Рет қаралды 10 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 196 МЛН
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 46 МЛН
АЗАРТНИК 4 |СЕЗОН 1 Серия
40:47
Inter Production
Рет қаралды 1,4 МЛН
How To... Add a Column to a Dataframe in R #61
6:15
Eugene O'Loughlin
Рет қаралды 10 М.
Combining Data From Two Tables Using Joins In dplyr
8:30
weecology
Рет қаралды 3,8 М.
Lubridate - how to manipulate date and time data in R
18:05
R Programming 101
Рет қаралды 11 М.
Mutate a column in R with the case_when function
5:17
DataAnalyticsWizardry
Рет қаралды 4,7 М.
use ifelse() function in R to create dummy variables and categorical variables
10:19
Stop Using FirstOrDefault in .NET! | Code Cop #021
12:54
Nick Chapsas
Рет қаралды 49 М.
dplyr::mutate() | How to use dplyr mutate function | R Programming
6:44
Dynamic Data Script
Рет қаралды 13 М.
Manipulate your data.   Data wrangling.   R programmning for beginners.
29:59
R Programming 101
Рет қаралды 77 М.
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 196 МЛН