your two dataframe defintions are different.  In the case of df1, you
have 'names' the elements, and in the case of df2,you have done an
assignment to 'nam' and 'num' (look in the workspace and you will see
the object.  Since you haven't names the elements in df2, is tries to
constuct a name from the expressions that is given (e.g., nums = c(3,
  2,    1,   1,   2,    3,  7)), so you get.

This is what happens:

> make.names("nums  <- c(3,    2,    1,   1,   2,    3, 7)")
[1] "nums.....c.3.....2.....1....1....2.....3..7."

It tries to make a name from the expression.

On 10/2/07, John Kane <[EMAIL PROTECTED]> wrote:
> This is just a curiosity question.  Why do the two
> different syntaxes for df1 and df2 give such different
> results in the names(dfx)?
>
> Thanks
>
>
> df1 <- data.frame(nas = c("A",  "B" , "B" ,"C" ,"B",
> "A", "D"),nums = c(3,    2,    1,   1,   2,    3,  7))
>
> df2 <- data.frame(nas  <- c("A",  "B" , "B" ,"C" ,"B",
> "A", "D"),nums  <- c(3,    2,    1,   1,   2,    3,
> 7))
>
> df1; df2
>
> >df1
>  nas nums
> 1   A    3
> 2   B    2
>    .   .
>
> >  df2
>
>   nas....c..A....B....B....C....B....A....D..
> nums....c.3..2..1..1..2..3..7.
> 1                                           A
>                    3
> 2                                           B
>
> 3
> .                                           .
>
> ______________________________________________
> 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.
>


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

What is the problem you are trying to solve?

______________________________________________
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