this is how my data frame looks
and this is what I am doing:
enter code here
nw_dat$cost_of_2_AUD<-if ( nw_dat$Country=="India") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/56.7
} else if (nw_dat$Country=="Phillipines") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/36.97
} else if ( nw_dat$Country=="Brazil") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/4.08
}else if ( nw_dat$Country=="Canada") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/0.94
}else if ( nw_dat$Country=="Indonesia") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/11066.12
}else if ( nw_dat$Country=="New Zealand") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/1.08
}else if ( nw_dat$Country=="Singapore") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/1.03
}else if ( nw_dat$Country=="South Africa") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/10.92
}else if ( nw_dat$Country=="Sri Lanka") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/152.35
}else if ( nw_dat$Country=="Turkey") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/6.57
}else if ( nw_dat$Country=="UAE") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/2.84
}else if ( nw_dat$Country=="United Kingdom") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/0.55
}else if ( nw_dat$Country=="United States") {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two/0.77
}else {
nw_dat$cost_of_2_AUD <- nw_dat$Average.Cost.for.two
}
but the problem is it's not converting it to the correct value, only the Philippines values that I converted are correct but the rest of the country's values are wrong.
Thank you in advance for the help.