You can create a new data frame and subset it:

myHist.df <- data.frame(counts = myHist$counts, mids = myHist$mids )
myHist.df <- subset( myHist, counts > 0 )
lm( mids ~ log(counts), data = myHist.df )

---
Date:   Mon, 23 Feb 2004 18:40:22 +0100 (CET) 
From:   =?iso-8859-1?q?Fulvio=20Copex?= <[EMAIL PROTECTED]>
To:   <[EMAIL PROTECTED]> 
Subject:   [R] deleting elements from an array/object 

 
Hello,
I created a simple histogram with:
myHist<-hist(myData)
the object myHist now has two arrays (among the others):

myHist$mids
myHist$counts

Since myHist$counts contains some "0", and I want to calculate the linear fit among 
myHist$mids and log(myHist$counts), I want remove the elements of both arrays where 
these "0" occurs.

which are the possible solutions to this problem?
(I'd like to avoid getting the indexes...)

Thanks a lot,
copex

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

Reply via email to