I have a data frame for an airbnb and i want from this data frame to create a new data frame for two neighbourhood
enter code here airbnb$neighbourood_grooup=="Bronx"
airbnb$neighbourhood_group"Staten Island"
I have a data frame for an airbnb and i want from this data frame to create a new data frame for two neighbourhood
enter code here airbnb$neighbourood_grooup=="Bronx"
airbnb$neighbourhood_group"Staten Island"
You need to provide some minimal, reproducible code here. However, in the interests of pointing you in the proper direction, try something like:
# library(tidyverse) # run if tidyverse not loaded
df <- tribble ( # used tribble() for easy, quick dataframe defn at console
~V1,~V2,
"Bronx", 5,
"Staten",7,
"Tribeca",9
)
df
filter(df,V1 == "Bronx" | V1 =="Staten")
# Note reduced tibble is itself returned as a tibble (dataframe, essentially) as well.