Hi There,
I am having trouble carrying through an object listed in the outer function 
into the inner function of a nested pair.
This is my code:

FindGreaterThanProportion<- function (y, SSThreshold) {
    DenomCells<-length(y)
    NumerCells<-subset(y,y>SSThreshold)
    PropCells<-length(NumerCells)/DenomCells
    return (PropCells)
    }


GetPropPlot<- function (PrePropData, direction, SSThreshold, cell, stim) {
    # Split up the dataframe with ddply and apply the function
    print(direction)
    print (SSThreshold)

    if (direction==">") {
        PropData<-ddply(PrePropData,.(SUBJECT, STIM, CELL, SIGNAL, DAY), 
summarise,
            PROP=FindGreaterThanProportion(SIMSCORE, SSThreshold))
        }

    PlotSubset <- subset(PropData, PropData$STIM==stim & PropData$CELL == cell)
    PropPlot<-ggplot(data=PlotSubset, aes(x=DAY, y=PROP)) +
        geom_line() +
        geom_point() +
        facet_grid(SIGNAL~SUBJECT)
    return(FinalPropPlot)
    }

When I run the code, I get this error:
[1] ">"
[1] 2
Error in subset.default(y, y > SSThreshold) :
  object 'SSThreshold' not found

It seems as if SSThreshold is not being passed into FindGreaterThanProportion.

Any help would be appreciated to determine what I am doing incorrectly.
Thanks in advance.

George Chen



This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
______________________________________________
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