12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Subset Effect ExampleBlank Returns all your data islands[]Positivenumerical valuesNegativenumerical valuesExtracts the elements at these locationsExtract all but these elements; in other words,excludes these elementsislands[c(8, 1, 1,42)]islands[-(3:46)]Logical valuesText stringsA logical value of TRUE includes element; FALSEexcludes elementIncludes elements where the names matchislands[islands < 20]islands[c(“Madagascar”,“Cuba”)]Subsetting data framesNow that you’ve reviewed the rules for creating subsets, you can try it withsome data frames. You just have to remember that a data frame is a twodimensionalobject and contains rows as well as columns. This means that youneed to specify the subset for rows and columns independently. To do so, youcombine the operators.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!