Re: [R] 'x' values must be positive.

2011-03-16 Thread rens
It's ok, i solved it.
It wasn't an integer,

--
View this message in context: 
http://r.789695.n4.nabble.com/x-values-must-be-positive-tp3381744p3381859.html
Sent from the R help mailing list archive at Nabble.com.

__
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.


Re: [R] 'x' values must be positive.

2011-03-16 Thread jim holtman
'b' appears to be characters.  try

pie(as.integer(b))

On Wed, Mar 16, 2011 at 9:28 AM, rens picca...@hotmail.com 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

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/x-values-must-be-positive-tp3381744p3381744.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 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
Data Munger Guru

What is the problem that 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.


Re: [R] 'x' values must be positive.

2011-03-16 Thread Ted Harding
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.


Re: [R] 'x' values must be positive.

2011-03-16 Thread Ivan Calandra

Hi,

b is a character vector.
Try as.numeric(b).

You probably need to read some documentation about R.

Ivan

Le 3/16/2011 14:28, rens a écrit :

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

--
View this message in context: 
http://r.789695.n4.nabble.com/x-values-must-be-positive-tp3381744p3381744.html
Sent from the R help mailing list archive at Nabble.com.

__
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.



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php

__
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.