Displaying 2 results from an estimated 2 matches for "mytable2".
Did you mean:
mytable
2005 Feb 17
5
Again: Variable names in functions
...now that this function is useless.)
> mytable1<-function(x,y){table(x,y)}
> mytable1(charly, delta)
y
x 1 2
1 2 1
2 3 4
If I define the function in the following way, it does what I wish, namely
it returns output equivalent to the simple call "table(charly, delta)".
> mytable2<-function(x,y){
+ cat("table(",as.symbol((deparse(substitute(x)))),
+ "," , as.symbol(deparse(substitute(y))),")\n",
+ file="temp",sep="",append=F)
+ eval(parse("temp",n=-1))
+ }
> mytable2(charly, delt...
2005 Jul 26
4
elegant solution to transform vector into percentages?
Hi,
I am looking for an elegant way to transform a vector into percentages of values
that meet certain criteria.
store<-c(1,1.4,3,1.1,0.3,0.6,4,5)
# now I want to get the precentages of values
# that fall into the categories <=M , >M & <=N , >N
# let
M <-.8
N <- 1.2
# In my real example I have many more of these cutoff-points
# What I did is:
out <- matrix(NA,1,3)