| sample,DataFrame,logical,numeric-method {SparkR} | R Documentation | 
Return a sampled subset of this DataFrame using a random seed.
## S4 method for signature 'DataFrame,logical,numeric' sample(x, withReplacement, fraction) ## S4 method for signature 'DataFrame,logical,numeric' sample_frac(x, withReplacement, fraction) sample(x, withReplacement, fraction, seed) sample_frac(x, withReplacement, fraction, seed)
| x | A SparkSQL DataFrame | 
| withReplacement | Sampling with replacement or not | 
| fraction | The (rough) sample target fraction | 
## Not run: 
##D sc <- sparkR.init()
##D sqlContext <- sparkRSQL.init(sc)
##D path <- "path/to/file.json"
##D df <- jsonFile(sqlContext, path)
##D collect(sample(df, FALSE, 0.5))
##D collect(sample(df, TRUE, 0.5))
## End(Not run)