[R] level sets

2006-11-06 Thread David Hugh-Jones
Hi,

Can anyone suggest a good way to draw level curves of a function with
R? I am thinking of something analogous to curve. If there is a
package I should be looking at for this kind of mathematical stuff,
I'd like to know too...

cheers
d

__
R-help@stat.math.ethz.ch 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.


[R] level sets of factors are different

2006-01-07 Thread Richard van Wingerden
Hi,

I have two data frames A en B.
I want to filter B with values of A

data_frame_b
names - colnames(data_frame_b[1:1, ])

filtera - data.frame(data_frame_a[1:1])

print(nrow(filtera))

if (nrow(filtera)0){

filtered_frame_b - subset(data_frame_b, ColumnX == filtera[1, 
1], names)
 }
The results are:

[1] 124
Error in Ops.factor(ColumnX, filtera[1, 1]) :
level sets of factors are different


What is wrong??

Richard

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] level sets of factors are different

2006-01-07 Thread Prof Brian Ripley
The message is really explicit.

You are trying to compare the equality of two factors with different level 
sets.  Such factors are not comparable (and this is discussed on ?factor). 
You didn't give a reproducible example, and you have not told us what you 
are trying to do, so all we can do is repeat R's report that what you 
actually did is not sensible.

On Sat, 7 Jan 2006, Richard van Wingerden wrote:

 Hi,

 I have two data frames A en B.
 I want to filter B with values of A

 data_frame_b
 names - colnames(data_frame_b[1:1, ])

 filtera - data.frame(data_frame_a[1:1])

This is bit strange. data_frame_a[1:1] is data_frame_a[1] and is a 
single-column data-frame.  I think you might just as well use

filtera - data_frame_a[[1]]

which is (probably) a factor.  You then seem to want to extract values 
equal to its first element, so maybe you actually wanted
columnX == as.character(data_frame_a[1,1]) ?


   print(nrow(filtera))

   if (nrow(filtera)0){

   filtered_frame_b - subset(data_frame_b, ColumnX == filtera[1, 
 1], names)
 }
 The results are:

 [1] 124
 Error in Ops.factor(ColumnX, filtera[1, 1]) :
level sets of factors are different


 What is wrong??

 Richard


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] level sets of factors are different

2006-01-07 Thread Richard van Wingerden
Thanks!

The as.character fixed it!

Regards,
Richard

On 1/7/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 The message is really explicit.

 You are trying to compare the equality of two factors with different level
 sets.  Such factors are not comparable (and this is discussed on ?factor).
 You didn't give a reproducible example, and you have not told us what you
 are trying to do, so all we can do is repeat R's report that what you
 actually did is not sensible.

 On Sat, 7 Jan 2006, Richard van Wingerden wrote:

  Hi,
 
  I have two data frames A en B.
  I want to filter B with values of A
 
  data_frame_b
  names - colnames(data_frame_b[1:1, ])
 
  filtera - data.frame(data_frame_a[1:1])

 This is bit strange. data_frame_a[1:1] is data_frame_a[1] and is a
 single-column data-frame.  I think you might just as well use

 filtera - data_frame_a[[1]]

 which is (probably) a factor.  You then seem to want to extract values
 equal to its first element, so maybe you actually wanted
 columnX == as.character(data_frame_a[1,1]) ?

 
print(nrow(filtera))
 
if (nrow(filtera)0){
 
filtered_frame_b - subset(data_frame_b, ColumnX == 
  filtera[1, 1], names)
  }
  The results are:
 
  [1] 124
  Error in Ops.factor(ColumnX, filtera[1, 1]) :
 level sets of factors are different
 
 
  What is wrong??
 
  Richard


 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html