On 16-Mar-11 13:28:00, rens wrote:
>> b
> [1] "2" "1" "1" "1" "1" "1"
>> pie(b)
> Error in pie(b) : 'x' values must be positive.
> 
> Can someone help me?
> 
> And sorry i am an beginner

The problem (as indicated by the "" marks around each value)
is that the variable 'b' is a vector of *characters*, not of
numbers.

Compare the result of

  x <- c(2,1,1,1,1,1)
  x
  # [1] 2 1 1 1 1 1
  pie(x)

with the result of

  b <- c("2","1","1","1","1","1")
  b
  # [1] "2" "1" "1" "1" "1" "1"
  pie(b)
  # Error in pie(b) : 'x' values must be positive.

and:

  typeof(x)
  # [1] "double"

  typeof(b)
  # [1] "character"

The underlying important question is:
  How was the vector 'b' constructed?
You clearly expect 'b' to be numeric, but it is of
type character. The reason for this is what you need
to find out!

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.hard...@wlandres.net>
Fax-to-email: +44 (0)870 094 0861
Date: 16-Mar-11                                       Time: 14:48:47
------------------------------ XFMail ------------------------------

______________________________________________
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