Skip to content
Prev 32107 / 398506 Next

data.frame contents are not displayed

Dear r-help,

I need to unite contents of two files with variables into one data
frame, produce some derivative variables from them and store them in
that data frame.

Here is the set of commands (processing first file for now)

data7902<-data.frame(year=NULL,lon=NULL,area=NULL,extent=NULL,area.std=NULL,extent.std=NULL,
                     area.norm=NULL,extent.norm=NULL);

area7902<-read.table("a7902-15.txt",
                     col.names=c("year","area","lon"),
                     header=FALSE,
                     comment.char='#');

data7902$year<-area7902$year;
data7902$area<-area7902$area;
data7902$lon<-area7902$lon;
  
Checking:
I type "area7902" in the R console and get

    year         area lon
1   1979  78164.77944   0
2   1979  65492.49919  20
3   1979  41491.50425  40
4   1979  15217.32476  60
....

Then I type "data7902" in the R console.

[1] year area lon
<0 rows> (or 0-length row.names)

For the same time typing "data7902$year" gives the list of years for
all rows in data frame.

Why contents of the newly created and filled data frame are not
displayed?