[R] data frame

Jeffrey Robert Spies jspies at nd.edu
Mon Sep 17 18:51:24 CEST 2007


I believe you're looking for:

dim(a)

dim(a)[1]  # Number of observations, in your example, 12
dim(a)[2]  # Number of variables per observation, in your example, 9

--Jeff.


On Sep 17, 2007, at 12:05 PM, Alfredo Alessandrini wrote:

> Hi everybody,
>
> If I've a data frame like this:
>
> dataframe a
>
>       X0  X2  X4  X6  X8 X10 X12 X14 X16
> 1957   0   0   0   0   0   0   0   0   0
> 1958   0   0   0   0   0   0   0   0   0
> 1959 831   0   0   0   0   0   0   0   0
> 1960 544 282   0   0   0   0   0   0   0
> 1961 446 365   0   0   0   0   0   0   0
> 1962 442 473   0   0   0   0   0   0   0
> 1963 595 468   0   0   0   0   0   0   0
> 1964 400 397 516   0   0   0   0   0   0
> 1965 417 382 401   0   0   0   0   0   0
> 1966 642 518 509 453   0   0   0   0   0
> 1967 505 340 621 458   0   0   0   0   0
> 1968 451 383 428 318 339   0   0   0   0
>
>> length (a)
> [1] 9
>
> I've a questions...
>
> There is a function for show the lenght of single observation?
>
>> ???? (a)
> [1] 12
>
>
>
> Best Wishes,
>
> Alfredo
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list