Displaying 3 results from an estimated 3 matches for "coercision".
Did you mean:
coercion
2009 Mar 03
2
preparing data for barplot()
...C 0.47171611 0.592037 0.57612168
However
> data.matrix(realdata)
person val1 val2 val3
1 NA 221 71 175
2 NA 222 85 147
Warning messages:
1: NAs introduced by coercion
2: NAs introduced by coercion
So then I converted 'person' from a list to factors, which removed the
coercision error, but barplot() still shows each bar as value instead
of a person.
My serialized() data subset is here (look at bottom half where there
are no line numbers)
http://pastebin.com/m6d1e1d79
Thanks in advance,
Andrew
2002 May 20
0
is.na<- coerces character vectors to be factors within dataframes (PR#1577)
...r to x$var
instead of x[[1]].
> x <- data.frame(var = LETTERS[1:3])
> x$var <- as.character(x$var)
> is.na(x$var) <- 2
> x
var
1 A
2 <NA>
3 C
> is.character(x$var)
[1] TRUE
> is.factor(x$var)
[1] FALSE
>
I could (ort of) imagine a story in which the coercision is the desired
behavior -- by using is.na you are implicitly taking apart a dataframe and
putting it back together and, when you make dataframes, character vectors are
coerced to factor by default. But I can't come up with a story as to why x$var
should be handled differently then x[[1]].
>...
2002 May 20
1
(PR#1577) is.na<- coerces character vectors to be factors
...[1:3])
> > x$var <- as.character(x$var)
> > is.na(x$var) <- 2
> > x
> var
> 1 A
> 2 <NA>
> 3 C
> > is.character(x$var)
> [1] TRUE
> > is.factor(x$var)
> [1] FALSE
> >
>
> I could (ort of) imagine a story in which the coercision is the desired
> behavior -- by using is.na you are implicitly taking apart a dataframe and
> putting it back together and, when you make dataframes, character vectors are
> coerced to factor by default. But I can't come up with a story as to why x$var
> should be handled different...