I've a DT by name 'f'
id project testyr1 testyr2 age1 status country 1 16S AS 2008 NA 29 done US 2 32S AS 2004 NA 30 done FR 3 37S AS NA 2011 NA NA CA 4 50S AS 2004 NA 23 done US 5 50S AS 1998 NA 16 done US 6 55S AS 2007 NA 28 NA BE
I need, if country is "US" and status is "done" then it should print the corresponding "id" else it should print "check" (it should from a new column at the end of the data table (f)) and continue for all the rows and and once it is done with the country it would check for other country "CA" and do the same thing and come out of the loop once all the rows are done
I'm pretty bad in writing if else statements any idea would help.
`if(f$country =="US",
{
f$g<if(f$status>Status=="done"
print ("f$id")) else
} else
if(f$country =="CA",{
print("f$id")
})else`
Thank you.
Aucun commentaire:
Enregistrer un commentaire