[R] Accessing single element of data.frame

David Winsemius dwinsemius at comcast.net
Tue Jul 27 02:43:16 CEST 2010


On Jul 26, 2010, at 3:22 PM, vacas wrote:

>
> Hi I am new to R.
> I am having this problem
> t1 <- read.csv("myfile.csv")
> t2 <- data.frame(t1)
> which have 10 row and 10 columns
> t2[1,1] does not give the first element but it gives the levels, how  
> can I
> fix it.

It gives you both. Factors are generally printed with the value and  
then the vector of possible values. By the way the use of data.frame  
would be redundant. The object returned by read.csv would already be a  
dataframe.

?read.csv
?data.frame

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list