Standardization/Normalization test data in R
Check out the preProcess function from the caret library.  You can choose the parameters you want to scale/center the training data, and it also saves the transformations it makes so then you can normalize the test set with the same specifications that you normalized the training set with.  Could go something like this:
library(caret)
trainData &lt;- data.frame(v1 = rnorm(15,3,1), v2 = rnorm(15,2,2))
testData &lt;- data.frame(v1 = rnorm(5,3,1), v2 = rnorm(5,2,2))
normParam &lt;- preProcess(trainData)
norm.testData &lt;- predict(normParam, testData)

now your norm.testData is scaled and centered according to the training data set parameters.
Another way to do this without using caret:
## set up data
trainData &lt;- data.frame(v1 = rnorm(15,3,1), v2 = rnorm(15,2,2))
testData &lt;- data.frame(v1 = rnorm(5,3,1), v2 = rnorm(5,2,2))

## find mean and sd column-wise of training data
trainMean &lt;- apply(trainData,2,mean)
trainSd &lt;- apply(trainData,2,sd)

## centered
sweep(trainData, 2L, trainMean) # using the default &quot;-&quot; to subtract mean column-wise   
## centered AND scaled
norm2.testData &lt;- sweep(sweep(testData, 2L, trainMean), 2, trainSd, &quot;/&quot;)