Re: [R] Length problem

From: jim holtman <jholtman_at_gmail.com>
Date: Mon, 11 Feb 2008 10:51:59 -0500

You were asking for the length of the first element of the vector coppie, which is of course 1. Did you mean to say lgngth(coppie)? length(data[,4]) is asking how many elements in that column, which seems to be 5. also your statement

coppie <- c(data[4:length(data)])

seems strange. What did you intend to do?

On 2/11/08, Paolo Grillo <paolo.grillo_at_guest.unimi.it> wrote:
>
> Hi all
> I have this problem:
> In my database .dta, called "data" I have five rows
> data<-read.dta("C:\\2_CO_mmobile_ALL_Rid.dta")
> # From this database I wuold like to create another
> coppie<-c(data[4:length(data)])
> but I find this
>
> # Length of original data
> length(data[,4])
> 5 RIGHT!!
> # Length of new data
> length(coppie[1])
> 1 WHY??
> Thank you all for your help
> Paolo Grillo
> ______________________________________________
> 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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
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.
Received on Mon 11 Feb 2008 - 15:57:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 11 Feb 2008 - 16:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive