Re: [R] how use the subset?

2009-07-31 Thread jim holtman
'scan' creates a 'list'; subset is typically used on dataframes.  I
can get a similar message below:

 x - list(a=1:10, b=1:10)
 subset(x, a5)
Error in subset.default(x, a  5) : object 'a' not found
 # now convert the list to a dataframe
 x.df - as.data.frame(x)
 subset(x.df, a  5)
  a b
1 1 1
2 2 2
3 3 3
4 4 4



On Fri, Jul 31, 2009 at 12:02 AM, Jie TANGtotang...@gmail.com wrote:
 hi ,everyone

 I  want subtract some dataset by subset.

 From the help running  help(subset),  ths information is *subset(airquality,
 Day == 1, select = -Temp)* 



 while  I running my script written as *g1data-subset(errdata, fac12) *
 ,it is wrong with the error information *subset.default(newerrdata,
 fac12),can not find fac*


 and g1 in read from the file as shown below
 *errdata-scan(err.dat,what = list(mon=0,day=0,err=0,fac=0))*

 While I changed to *g1data-subset(errdata, errdata$fac12)*, there is no
 error message any more  but it seems that *g1data* dooes be selected.

 who can help me to subset the dataset?

 thank you .:)

 --
 TANG Jie
 Email: totang...@gmail.com
 Tel: 0086-2154896104
 Shanghai Typhoon Institute,China

        [[alternative HTML version deleted]]

 __
 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 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] how use the subset?

2009-07-30 Thread Steve Lianoglou

Hi,

On Jul 31, 2009, at 12:02 AM, Jie TANG wrote:


hi ,everyone

I  want subtract some dataset by subset.

From the help running  help(subset),  ths information is  
*subset(airquality,

Day == 1, select = -Temp)* 



while  I running my script written as *g1data-subset(errdata,  
fac12) *

,it is wrong with the error information *subset.default(newerrdata,
fac12),can not find fac*


and g1 in read from the file as shown below
*errdata-scan(err.dat,what = list(mon=0,day=0,err=0,fac=0))*

While I changed to *g1data-subset(errdata, errdata$fac12)*, there  
is no

error message any more  but it seems that *g1data* dooes be selected.

who can help me to subset the dataset?


As per the posting guide, please post a small/simple example of a  
data.frame you are trying to subset and show us the queries you are  
using and what you expect to get out of it.


We'll show you where you're going wrong ;-)

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
  |  Memorial Sloan-Kettering Cancer Center
  |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

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