Q:

R: How to find minimum of a variable when an attribute is not equal to own? 

I have been trying to calculate the minimum of a variable with a condition.  I have the following data:
Data
Date       Net Price 
2013-12-01  A   39  
2013-12-01  B   23  
2013-12-01  C   25  
2013-12-08  A   52  
2013-12-08  B   12  
2013-12-08  C   19  
2013-12-15  A   32  
2013-12-15  B   36  
2013-12-15  C   40  

I want to add a column of min price against A which is Min(B,C) and against B which is Min(A,B) and so on for date. 
Date       Net Price Min 
2013-12-01  A   39  23
2013-12-01  B   23  25
2013-12-01  C   25  23
2013-12-08  A   52  12
2013-12-08  B   12  19
2013-12-08  C   19  12
2013-12-15  A   32  36
2013-12-15  B   36  32
2013-12-15  C   40  32

Can someone help me find the minimum by a date when Network not equal to own. 
Thanks

A:

You can also use this:
f <- function(x){m <- min(x); ifelse(x==m, min(x[x>m]), m)}
within(Data, Min <- ave(Price, Date, FUN=f))

Result:
        Date Net Price Min
1 2013-12-01   A    39  23
2 2013-12-01   B    23  25
3 2013-12-01   C    25  23
4 2013-12-08   A    52  12
5 2013-12-08   B    12  19
6 2013-12-08   C    19  12
7 2013-12-15   A    32  36
8 2013-12-15   B    36  32
9 2013-12-15   C    40  32

