2007/10/15, Stephen Tucker <[EMAIL PROTECTED]>:
>
> Hi Klaus,
>
> I am not exactly sure what you are asking for, but something like this?
> This
> would be option (2) from your list - I don't know that it would be too
> difficult in R that you would want to use another tool.
>
> filt <- function(x)
>   with(x,which(Hole > 1))
>
> normalize <- function(x,y)
> {
>   x$Feature <- x$Feature - with(y,Nominel[match(x$Hole,Hole)])
>   return(x)
> }
>
> # from CSV import
> mydata <- read.csv(...)
>
> # answer
> normalizedData <- normalize(filt(mydata))


I have not tried your solution yet, I was maybe more looking for somewhat
like this

rawdate$nomalized <- rawdata$Value - nom$Nominel[nom$Hole == rawdata$Hole &&
nom$Feature == rawdata$Feature]

maybe it should be like this

nominel.value <- function(hole, feature, nominel.array)
{
 n <- nominel.array$nominel[nominel.array$Hole == hole &
                                         nominel.array$Feature == feature]
 return(n)
}

rawdata$normalised <- rawdata$Value - nominel.value(rawdata$Hole,
rawdata$Feature, nom)

But it does not seem to work, the problem is that I expect nominel.value to
return a single value but it returns a vector, but not as expected.

I think that adding a new column to the data frame is better.

The rawdata is actually hole position and radius (x,y, r), Hole is the index
number of a hole on a singel sample, and I have measured on 98 different
samples. As a part of a process capability analysis I would like to compare
the measured values for each holes by subtracting the target/should be/
nominel value, so i look at deviation from the "true" value. I hope this
explains this better.


/Klaus






--- Klaus Friis Østergaard <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > I have a data set which is like this I write as the CSV I import:
> >
> > Sample;Hole;Feature;Value
> > 1;5;x;4,2334
> > 1;5;y;3,3434
> > 1;5;r;0,1080
> > 1;10;x;5,2526
> > 1;10;y;4,3434
> > 1;10;r;0,1080
> > ....
> >
> > with 98 sample and 10 different holes. These are measured values.
> >
> > Now I also have a list of nominel values:
> >
> > Hole;Feature;Nominel;LSL;USL
> > 5;x;4,25,4,20;4,30
> > 5;y;3,35;3,30;3,40
> > 5;r;0,10;0,07;0,13
> > 10;x;5,25;5,20;5,30
> > ...
> >
> > If I want to "normalize" the measured values. The results are to be used
> in
> > a Sweave file that I plan to reuse for several similar data sets in the
> > furture.
> >
> > I have been looking at different approache:
> > 1. do it in a script out side R
> > 2. do it the long and hard way by filtering out all the single holes and
> > Feature, the on this list subtract the nominel values, and then combine
> it
> > back.
> > 3. ?
> >
> > Any help and guidence apriciated
> > --
> > Klaus F. Østergaard, <farremosen(at)gmail dot com>
> >
> >       [[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.
> >
>
>
>
>
> ____________________________________________________________________________________
>
> Looking for a deal? Find great prices on flights and hotels with Yahoo!
> FareChase.
> http://farechase.yahoo.com/
>



-- 
Klaus F. Østergaard, <farremosen(at)gmail dot com>

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

Reply via email to