-1

I'm relatively new to R. I'm looking to filter out some data so I'm left with only the data I want to work with.
The data called "Ireland" consists of columns titled - Year, OpennesstoTrade, Population, Inflation and TFP Growth.
The years go from 1984 - 2015.
I want to filter out the years 1984-1994.

How would I do this?

Any help would be much appreciated?

2 Answers2

-1
Ireland2 = Ireland[Ireland$Year < 1984 | Ireland$Year > 1994,]

This part: Ireland$Year < 1984 | Ireland$Year > 1994

Gets the TRUE / FALSE values for the column.

This part: Ireland2 = Ireland[ ... ,]

Creates your new data matrix, and assigns it to your new variable.

c z
  • 7,726
  • 3
  • 46
  • 59
-2

You can do this.

df <- subset(ireland, Year > 1994) 
rafa.pereira
  • 13,251
  • 6
  • 71
  • 109