Displaying 1 result from an estimated 1 matches for "datas2".
Did you mean:
data2
2012 Sep 20
1
question on assigning an argument in a function that is create by the function itself
...reated in the function. My
example is below.
Thanks very much!
Ben Caldwell
#make some data
a<-rep("a",9)
b<-rep("b",9)
c<-rep("c",9)
level3<-c(a,b,c)
abc
d1<-9:1
set.seed(20)
d2<-rnorm(9,1,.1)
datas1<-d1*d2
e1<-rep(2.5,4)
e2<-rep(10,5)
datas2<-c(e1,e2)
number<-rep(1:9,3)
dummya<-data.frame(datas1,datas2,number)
dummya
dummy <- data.frame(level3,dummya)
dummy
#first function
cumulative <- function(v,x) {
b <- rep (2,length(v))
o<-order(x)
v <-v[o]
n<-length(v)
b[1] <- v[1]
for (i in 2:n) {
b[i] <...