[R] how to quote "factors" in a function?
casperyc
casperyc at hotmail.co.uk
Mon Sep 12 00:11:55 CEST 2011
### code ###
x=sample(LETTERS[1:26],100,T)
prob=function(y){
count=sum(x==y)
total=length(x)
count/total
}
### end ###
How do I quote the letters A,B,C,D ect, in order to make the "prob" function
return the weights of the desired Letter?
Thanks!
--
View this message in context: http://r.789695.n4.nabble.com/how-to-quote-factors-in-a-function-tp3805913p3805913.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list