Dear R experts
Sorry for this question
M1 - 1:10
lcd1 - c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11)
lcd2 - c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22)
lcd3 - c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12)
#generating variables through sampling
pvec - c(PR1, PR2, PR3, PR4, PR5, PR6, PR7, PR8, PR9,
PR10)
Ram -
I think you'll have to explain what you're trying to do.
First, you're creating a 10x10 matrix newd, which could
be done a bit more efficiently by using
newd = matrix(sample(c(1,2,3,3,),10*length(pvec),replace=TRUE),ncol=10)
Notice that calling sapply on a matrix applies the
Hi Phil and R users
Let me clear my problem. The generating sample is not prime issue here. I am
simulating a situation, for which I need to sample. But once I have sampling
done, I need to do a conditional decoding. Let me clear it with more clear
data example:
x - read.table(textConnection(
try this:
x - read.table(textConnection(
+ mark lcd1 lcd2 lcd3 PR1 PR2 PR3 PR4
+ 1 11 22 12 1 2 3 1
+ 2 33 44 34 1 2 3 1
+ 3 22 44 24 3 1 2 1
+ 4 11 33 13 2 2 1 3
+ 5 22 11 12 3 2 2 1 ), header = TRUE)
closeAllConnections()
x # before
mark lcd1 lcd2 lcd3 PR1 PR2 PR3 PR4
11 11 22
4 matches
Mail list logo