Displaying 3 results from an estimated 3 matches for "0.2002145".
2009 Dec 09
1
Why cannot get the expected values in my function
Hi,
In the following function, i hope to save my simulated data into the
"result" dataset, but why the final "result" dataset seems not to be
generated.
#Function
simdata<-function (nsim) {
result<-matrix(NA,nrow=nsim,ncol=2)
colnames(result)<-c("x","y")
for (i in 1:nsim) {
set.seed(i)
result[i,]<- cbind(runif(1),runif(1))
}
2012 Dec 02
2
How to re-combine values based on an index?
I am able to split my df into two like so:
dataset <- trainset
index <- 1:nrow(dataset)
testindex <- sample(index, trunc(length(index)*30/100))
trainset <- dataset[-testindex,]
testset <- dataset[testindex,-1]
So I have the index information, how could I re-combine the data using that back into a single df?
I tried what I thought might work, but failed with:
2012 Nov 28
3
filter data.frame with a vector
Hello together,
i have a data.frame, which i want to filter with numbers in a vector.
I have a vector (Top10) with these numbers:
[1] 205 302 156 378 235 328 183 375 296 374
and i have a data.frame with a Column (CU_NO) with all my Customer numbers.
How can i filter this data.frame, with the Numbers in my vector.
this one doens't work: