r - Adjusting Train/Test for training a model to a selected range with an expression -


I am following a vector and also use the expression given below to train a model - In the example given below I want the final element of the train / examination as the test (FALSE) (true / false)

  x   

I have two questions:

  1. Why do I run a 90% train (TRUE) / 10% test ( Incorrect test) I get more than 10% wrong number in the form of a test and only one way to do 10% of FALSE is

  2. I will be consistent with FALSE For how "when (s ...)" can frame the second part of the expression (eg - test-fail) 10% are found at the end of "train" rather than randomly distributed. .

    Thank you