If you want all your NAs in the column GPAX to be 2.36, you could also say df2$GPAX[is.na(df2$GPAX)] <- 2.36
If you want only that specific NA to be 2.36, you are probably better off using df2$GPAX[rownames(df2) == 156] <- 2.36. --- On Sun, 1/23/11, Den <[email protected]> wrote: > From: Den <[email protected]> > Subject: Re: [R] Problem with combined two data frame. > To: "Jumlong Vongprasert" <[email protected]> > Cc: "R-help" <[email protected]> > Date: Sunday, January 23, 2011, 1:11 AM > Hi > So let's call first data frame df1 and second df2 > #replace NA with 2.36 > df2y <- lapply(df2, function(x) (ifelse( is.na(x), > 2.36,x))) > > #combibe > both <- rbind(df1, df2) > > With best regards > Denis > > > У Няд, 23/01/2011 у 12:41 +0700, Jumlong Vongprasert > піша: > > Dear All. > > I have some problem with combined two data frame. > > .... > > I have first data frame .. > > > > GPAX THAI MATH SCINCE SOCIAL > HEALT ART CAREER LANGUAGE > > 1227 2.99 3.32 > 2.50 2.64 3.05 3.60 > 3.72 3.57 2.62 > > 1704 2.81 2.56 > 2.48 2.86 3.22 3.19 > 3.55 3.20 2.51 > > 617 2.18 1.90 > 1.97 2.06 2.38 3.50 > 3.54 2.33 1.70 > > 876 2.82 3.14 > 2.73 2.46 2.71 3.11 > 3.04 3.24 2.90 > > 1699 3.00 2.61 > 2.50 2.71 3.52 3.82 > 3.51 3.79 2.71 > > 1054 2.64 2.94 > 2.00 2.35 3.05 3.81 > 3.59 2.98 1.99 > > 31 2.73 2.86 > 2.34 2.57 3.03 3.35 > 3.24 3.18 2.24 > > 164 2.74 2.95 > 2.10 2.64 2.82 3.51 > 3.33 3.32 2.37 > > 1742 2.24 2.43 > 1.82 1.65 2.53 3.35 > 2.51 2.40 2.05 > > 436 2.63 2.58 > 2.11 2.17 2.74 3.44 > 3.67 3.31 2.90 > > 453 2.67 2.46 > 1.90 2.44 3.10 3.74 > 3.38 3.11 1.92 > > > > and second data frame > > > > GPAX THAI MATH SCINCE SOCIAL > HEALT ART CAREER LANGUAGE > > 156 NA 3.38 > 2.78 3.01 3.49 3.83 > 3.67 3.73 2.92 > > > > and y = 2.36 > > > > 1. I want to replace NA with y in second data frame, > how I can do. > > 2. I want to combined first and second data frame, how > I can do. > > > > Many Thanks > > ______________________________________________ > [email protected] > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

