1

I am new here and have a problem

    Year       Market         Winner          BID
1  1990        ABC             Apple          0.1260
2  1990        ABC             Apple          0.1395
3  1990        EFG             Pear           0.1350
4  1991        EFG             Apple          0.1113
5  1991        EFG             Orange         0.1094

For each year and separately for the two markets (i.e.,ABC,EFG), examine the combined data for Apple and Pear on the bid price variable BID for presence of potential outliers.5 Identify instances where you observe the presence of potential outliers.

I managed to separate the data by year only

y <- c(1, seq(300))
year1991 <- subset(X, y < 39)
year1991
Year1991 <- year1991[, c(1,2,3,5)]
Year1991

now I need help on whats the right R command to key to select(View) only ABC of the Market COLUMN, which the other column values remains.

Is it possible to do multiple separation at one time? or step by step

Possible to give me a tip,how do I exlude if I wanna view the date in such a manner

   Year       Market         Winner          BID
1  1990        ABC             Apple         0.1260
2  1990        ABC             Apple         0.1395

  Year       Market         Winner          BID
1 1990        EFG             Pear           0.1350

Like trying to split the 'Market' but still see the whole list of values

Thanks in advance :)

Charles
  • 50,943
  • 13
  • 104
  • 142

1 Answers1

0
> df
  Year Market Winner    BID
1 1990    ABC  Apple 0.1260
2 1990    ABC  Apple 0.1395
3 1990    EFG   Pear 0.1350
4 1991    EFG  Apple 0.1113
5 1991    EFG Orange 0.1094


library(plyr)
# Then you can break up the data into chunks of year x market.
# I split your data.frame into a list. You can do further things with that list.
# alternatively, you can use ddply and add a function to do your hw bit and collate all
# results back into a final data.frame. This should be a helpful start.
> dlply(df, .(Year,Market))
$`1990.ABC`
  Year Market Winner    BID
1 1990    ABC  Apple 0.1260
2 1990    ABC  Apple 0.1395

$`1990.EFG`
  Year Market Winner   BID
3 1990    EFG   Pear 0.135

$`1991.EFG`
  Year Market Winner    BID
4 1991    EFG  Apple 0.1113
5 1991    EFG Orange 0.1094
Maiasaura
  • 32,226
  • 27
  • 104
  • 108