Hi, I am new to R and trying to learn with a project:
#My dataset repex(cityincdiff):
zip total_a Difference City
000650 15 2 Philly
990112 16 17777 Newyork
I want to write a function that returns the city with respect to the Difference column:
I tried using a for loop but I am stuck:
#Input:
for (i in cityincdiff){
print City if Difference == 17777)
}
#Desired Output:
"Newyork"
Is there a better way to do it rather than a for loop?if not how do I correct my for loop?