Hi,

I have a data frame with two columns of data, one an indexing column  
and the other a data column. My issue is, this data frame is  
incomplete and there are missing lines.  I want to know how I can  
find and add data into these missing lines.  See example below

## Example data

data <- data.frame(index=c(1:4,6:10), data=c 
(1.5,4.3,5.6,6.7,7.1,12.5,14.5,16.8,3.4))

index data
1     1  1.5
2     2  4.3
3     3  5.6
4     4  6.7
5     6  7.1
6     7 12.5
7     8 14.5
8     9 16.8
9    10  3.4

## note: index number 5 is missing

## What I want

index data
1     1  1.5
2     2  4.3
3     3  5.6
4     4  6.7
5       5 NA
6     6  7.1
7     7 12.5
8     8 14.5
9     9 16.8
10    10  3.4

I'm running R2.6.0 on Mac OSX.

Thanks in advance,

Andrew Hoskins
PhD Candidate
Deakin University, Australia
Email: [EMAIL PROTECTED]




        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to