I have two datasets. The first one is called Buildings, the data consists of each Building ID with its respective characteristics.
Building_ID Address Year BCR
1 Machida, TY 1994 80
2 Ueno, TY 1972 50
3 Asakusa, TY 1990 70
4 Machida, TY 1982 60
.
.
.
54634 Chiyoda, TY 2002 70
The second dataset is called Residential ID. It only has one table, consisting of the Building ID (which is the same with the Building ID in 'Buildings' dataset) which have Residential usage.
Building_ID
2
3
14
23
39
44
45
133
393
423
.
.
or something like that. What I want to do is to make a new column in my first dataset with regards to my second dataset. I want to categorize which one is a Residential building and which one is not (basically, I want to select all the Buildings ID mentioned in my second dataset and categorize it into Residential in my first dataset). If it is residential, we can name it 'Residential'and else it is 'NR' so it could look something like this:
Building_ID Address Year BCR Category
1 Machida, TY 1994 80 NR
2 Ueno, TY 1972 50 Residential
3 Asakusa, TY 1990 70 Residential
4 Machida, TY 1982 60 NR
.
.
.
54634 Chiyoda, TY 2002 70 NR
I was thinking it has something to do with ifelse
or grepl
but so far my code doesn't work.