[R] (no subject)

David Winsemius dwinsemius at comcast.net
Thu Jul 2 16:17:38 CEST 2009


On Jul 2, 2009, at 9:01 AM, Andriy Fetsun wrote:

> Hi Guys,
>
> It is very simple question, but I can't find the answer! Please help  
> me.
>
> I use R and such simple function as length() doesn't work. The  
> result is
> always 1 even if my data are more then 1 observations!
>
> Do I have to load any additional library?
>
>> length(Ret_1)
> [1] 1

Perhaps Ret_1 is not a vector? If Ret_1 is a data.frame with one  
column then this would be expected behavior. It is a result of  
data.frames really being lists.  Perhaps you should try:

str(Ret_1)    .... to see what sort of object you have created and  
then perhaps,

nrow(Ret_1)

>> length
> function (x)  .Primitive("length")
>
If you type a function name you get the code or something informative  
about where to find the code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list