Hi,

Let's create your data.frame:
> dataframe <- structure(list(column1 = c(0.1, 0.3), column2 = c(0.2, 0.4)), .Names = c("column1",
"column2"), row.names = c("row1", "row2"), class = "data.frame")
> dataframe[,2]
[1] 0.2 0.4
> dataframe[,2, drop=FALSE]
     column2
row1     0.2
row2     0.4

So I don't know what's wrong with your data.
Maybe, providing the output from str(dataframe) would help us to help you!

HTH,
Ivan

Le 5/31/2010 13:23, e-letter a écrit :
Readers,

I have entered a file into r:

,column1,column2
row1,0.1,0.2
row2,0.3,0.4

using the command:

dataframe<-read.table("/path/to/file.csv",header=T,row.names=1)

When I try the command:

dataframe[,2]

I receive the response:

NULL

I was expecting:

row1 0.2
row2 0.4

What is my error with the syntax please?

Yours,

r251
mandriva2009

______________________________________________
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.


--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

______________________________________________
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