Please read An Introduction to R, which ships with every copy of R,
where you will learn how to properly subscript data frames and lists,
among other things. There is a reason for such tutorials -- they
enable you to avoid elementary mistakes like this and wasting time and
effort with such posts as this.

-- Bert

On Wed, Aug 1, 2012 at 2:13 PM, Jie Tang <totang...@gmail.com> wrote:
> I defined a data.frame by a two-dimensional array.
>> aa = data.frame(rbind(  11:20,   1:10))
>> aa
>   X1 X2 X3 X4 X5 X6 X7 X8 X9 X10
> 1 11 12 13 14 15 16 17 18 19  20
> 2  1   2   3     4    5  6   7    8  9  10
>
> Now I want to use the data in the second line of aa which from 1 to 10 to
>
> output.But I find that when I use the aa[[1]][1:10] and it seems be mistake.
> aa[[1]][1:10]
>  [1] 11  1 NA NA NA NA NA NA NA NA
>
> But when I just indice one element of the dataframe .e.g.aa[[1]][2]
> It will be ok. How could I subset the data.frame data by lines?
>
> Thank you ?
>
> --
> TANG Jie
> Email: totang...@gmail.com
> Tel: 0086-2154896104
> Shanghai Typhoon Institute,China
>
>         [[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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

______________________________________________
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