
Hi 
Try the following...

df <- data.frame(A = c(1,1,3,2,2,3,3),
 B = c(2,1,1,2,7,8,7),
 K = c("a.1", "d.2", "f.3",
 "a.1", "k.4", "f.9", "f.5"))
df$ID<-rownames(df)
df$K<-as.character(as.character(df$K))

changefunction<-function(z)
{
tmp <- lapply(split(z, z[,4]), 
 function(x) within(x, if(A==3)B <- 5 ))
dat2<-tmp
df<-unsplit(dat2,df$ID)
tmp <- lapply(split(df, df[,4]), 
 function(x) within(x, if(A==3)K <- chartr("f","m",K)))
dat2<-tmp
df<-unsplit(dat2,df$ID)
return(df)
}
dfnew<-changefunction(df)
df$ID<-NULL
dfnew$ID<-NULL
dfnew



Regards
Vijayan Padmanabhan


"What is expressed without proof can be denied without proof" - Euclide. 


Can you avoid printing this?
Think of the environment before printing the email.
-------------------------------------------------------------------------------
Please visit us at www.itcportal.com
******************************************************************************
This Communication is for the exclusive use of the intended recipient (s) and shall
not attach any liability on the originator or ITC Ltd./its Subsidiaries/its Group 
Companies. If you are the addressee, the contents of this email are intended for your 
use only and it shall not be forwarded to any third party, without first obtaining 
written authorisation from the originator or ITC Ltd./its Subsidiaries/its Group 
Companies. It may contain information which is confidential and legally privileged
and the same shall not be used or dealt with by any third party in any manner 
whatsoever without the specific consent of ITC Ltd./its Subsidiaries/its Group 
Companies.
	[[alternative HTML version deleted]]

