[R] random discrete from the first tuple
Xiyan Lon
xiyanlon at yahoo.com
Tue Sep 28 09:52:27 CEST 2004
Dear UseR
I have a dataset, for instance x1(A, B, C), x2(M,F),
x3(X1,X2,X3,X4) and x4(W,F,P). I want to make a small
dataset with the random tuple. I know package e1071
can handle a random discrete,
> library(e1071)
> x1 <- rdiscrete(6, c(2,2,2),c("A","B","C"))
> x2 <- rdiscrete(6, c(3,3),c("M","F"))
> x3 <- rdiscrete(6,
c(2,2,1,1),c("X1","X2","X3","X4"))
> x4 <- rdiscrete(6, c(2,2,2),c("W","F","P"))
> x <- data.frame(cbind(x1,x2,x3,x4))
> x
x1 x2 x3 x4
1 C F X1 F
2 B M X2 F
3 A F X2 W
4 A F X2 F
5 C M X3 P
6 A F X1 F
>
but I want to make from the first tuple only one
variable change to next tuple,
C F X1 F
B F X1 F
A F X1 F
C M X1 F
B M X1 F
A M X1 F
C F X2 F
B F X2 F
A F X2 F
C M X2 F
B M X2 F
A M X2 F
.
.
.
Are there any package can handle this problem.
Xiyan Lon
More information about the R-help
mailing list