Thanks for pointing that out, Gavin.  I was trying to make the coding as
obvious as possible and was a little sloppy.

For completeness, the same thing without subset is...

foo <- function(df,condition,...){
  df. <- df[eval(parse(text=condition)),]
  idx <- sample(1:nrow(df.),...)
  df.[idx,]
}



On Fri, Jun 6, 2014 at 5:48 PM, Rodrigues <rodriguesmsb@gmail.com> wrote:

> Hello,
>
> I would like to thanks everyone for the help.
> I did this one:
>
> blinding=function(sampling){
>   sort1=sample(idf[casod==1],30,replace=F)
>   sort2=sample(idf[casod==3],30,replace=F)
>   var1=factor(c(rep(1,30),rep(2,30)),labels=c("Positivo","Negativo"))
>   var2=cbind(c(pos=sort1,neg=sort2))
>   var3=sample(1:60,replace=F)
>   df=data.frame(Status=var1,IDF=var2,TRP=var3)
>   return(write.csv(df,file="Piloto.csv",row.names=F))
>
> It`s not exactly a function but works for me.
> BTW I found this site:
> http://manuals.bioinformatics.ucr.edu/home/programming-in-r
> I`ll try to learn a little more about r functions
>
>
> Regards,
> Moreno
>
>
>
>
> --
> View this message in context:
> http://r-sig-ecology.471788.n2.nabble.com/Help-with-a-function-tp7578931p7578939.html
> Sent from the r-sig-ecology mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
Glen Sargeant, Ph.D.
Research Wildlife Biologist/Statistician
USGS Northern Prairie Wildlife Research Center
E-mail: gsargeant@usgs.gov
Phone: (701) 253-5528

	[[alternative HTML version deleted]]

