-4

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"
  • Welcome to the site, please [edit as shown here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – NelsonGon Apr 20 '20 at 15:08

1 Answers1

0

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.
John Garland
  • 483
  • 3
  • 8