[R] creating a new variable and merging it on the dataframe
Admire Tarisirayi Chirume
@tch|rume @end|ng |rom gm@||@com
Mon Oct 18 13:26:11 CEST 2021
Good day colleagues. Below is a csv file attached which i am using in my
analysis.
hh.id
hd17.perm
hd17employ
health.exp
total.food.exp
total.nfood.exp
1
2
yes
1654
23654
23655
2
2
yes
2564
265897
65984
3
6
no
2547
123311
52416
4
8
no
5698
13648
12544
5
6
no
1254
36549
12365
6
8
yes
1236
236541
26522
7
8
no
4521
13264
23698
So I created a df using the above csv file as follows
wbpractice <- read.csv("world_practice.csv")
Now, I wanted to create a new variable called gap and scripted and executed
the following command :
wbpractice %>%
mutate(gap = total.food.exp-total.nfood.exp) #gen a variable
By recalling wbpractice, I could not see the new variable created. Running
the command;
names(wbpractice)
shows the old variables only. Any help on how to append the newly created
variable on my data?
Alternative email: addtarris using icloud.com/TChirume using rbz.co.zw
Skype: admirechirume
Call: +263773369884
whatsapp: +818099861504
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list