On Mon, Dec 13, 2010 at 1:09 PM, robert denham <rjadenham@gmail.com> wrote:

> in
> test <- data.frame(V1=c(1,2,3), V2=c(4,5,6))
>
> you are using arguments to the data.frame function in the tag=value format.
> From the help:
>
>    ...: these arguments are of either the form ‘value’ or ‘tag =
>           value’.  Component names are created based on the tag (if
>           present) or the deparsed argument itself.
>
> in
> test <- data.frame(V1<-c(1,2,3), V2<-c(4,5,6))
> you are using the value part, with the values being c(1,2,3) and c(4,5,6).
> Someone might explain whats really going on, but I don't think the
> assignment
> of c(1,2,3) to the variable V1 is done before the data.frame is evaluated.
>
>
>
>
>
> On Mon, Dec 13, 2010 at 12:53 PM, Matt Cooper <mattcstats@gmail.com>wrote:
>
>> Pure curiosity but does anyone know why '<-' and '=' generate different
>> columning headers?
>>
>> > test <- data.frame(V1=c(1,2,3), V2=c(4,5,6))
>> > test
>>  V1 V2
>> 1  1  4
>> 2  2  5
>> 3  3  6
>>
>> > test <- data.frame(V1<-c(1,2,3), V2<-c(4,5,6))
>> > test
>>  V1....c.1..2..3. V2....c.4..5..6.
>> 1                1                4
>> 2                2                5
>> 3                3                6
>>
>> > names(test)
>> [1] "V1....c.1..2..3." "V2....c.4..5..6."
>>
>>        [[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.
>>
>
>

	[[alternative HTML version deleted]]

