Gaurav Gaurav - 6 months ago 269
R Question

How to create a subset (dataset2) from dataset1 in R script

I have a dataset1 in AzureML R script

dataset1 <- maml.mapInputPort(1)

How to create a subset of dataset1 which has first 5 rows of dataset1 ?

I tried with
dataset2 <- subset(dataset1, 1:5);
but it is not working. How can i do this ?

Then what would be the best way to sort dataset in R script ?

I am new in R script, any help/suggestion would be appreciated.


you need to use

dataset2 <- dataset[1:5,] 

if you want to select the first 5 rows.