In R:
We will use mtcars dataset to illustrate. (R version 2.5.1)
> mtcars <- as.data.frame(mtcars)
> mtcars$p <- runif(nrow(mtcars)) # create weights
> mtcars2 <- mtcars[c("am", "hp", "wt", "p")]
> head(mtcars2)
am hp wt p
Mazda RX4 1 110 2.620 0.8901532
Mazda RX4 Wag 1 110 2.875 0.4601596
Datsun 710 1 93 2.320 0.9779983
Hornet 4 Drive 0 110 3.215 0.6889322
Hornet Sportabout 0 175 3.440 0.3856835
Valiant 0 105 3.460 0.1209667