On 18.04.2011 17:04, Mohammad Tanvir Ahamed wrote:
Hello all ,
I have a data frame like this

X1X2X3
11815
22916
331017
441118
551219
661320
771421

now i want to randomly reorder the variable X2  but the row element should be 
same
as for example

X1X2X3
12916
251219
331017
471421
561320
61815
741118

how can i do that ??

Hint :
this could be helpful :

if X2 is only a vector like this
X2<-c(8,9,10,11,12,13,14)

so i can easily reorder it by using sample commend
sample (X2 , size=length(X2), replace=FALSE)



Yes, and then replace X2 with your reordered X2.

Uwe Ligges





may be i have to use lapply commend with sample commend .


/.......Tanvir Ahamed

        [[alternative HTML version deleted]]




______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to