R

R: Reading Data

When importing data from a file into R, the common methods are: read.table() read.csv() read.csv2() read.table() is a common method, but requires more parameters to be passed like (file, header, the separator, row names, number of rows.) It also reads the data directly into your computers RAM, which for big data sets this could be a problem. If it is a big data set, it might be more prudent (if us... »

R: Getting and Importing Data

R can directly import data from URL’s by using the following syntax: fileCameras <- "https://data.baltimorecity.gov/api/views/hdyb-27ak/rows.csv?accessType=DOWNLOAD" download.file(fileCameras, destfile="baltimore_cameras.csv",method="curl")fileCameras <- "https://data.baltimorecity.gov/api/views/hdyb-27ak/rows.csv?accessType=DOWNLOAD" download.fi... »

NASA’s OpenNEX Datasets

NASA has a really cool website: https://nex.nasa.gov/nex/static/htdocs/site/extra/opennex/ The website allows you to access large data sets and connect to virtual lab’s using Amazon AWS. Not only do you get the data sets, virtual lab’s, but you also have the ability to win prizes and listen to various lecturers on this subject matter. Caveat While it’s all free, AWS is a tricky p... »

R Functions

Much like my other basic post on functions… R has it’s own use of functions. In R, you assign a function class to a object (remember in R class and object mean something different then in OO languages.)  A class is like a type (int, character, etc.)  and object is like the symbol. f <- function(argument){    some code } In the above example, the symbol (object) f, is set to the clas... »

R Control structures

Much like other languages, R has a set of control structures.  Namely: If / else (if a condition is met, do something) For (loop for x number of times) While (while something is true, loop) Repeat (infinite loop) Break (exit a loop) Next (skip an iteration of a loop) Return (exit a function) IF If you are familiar with Java or Groovy, the R if statement looks the same: if(some condition){    run s... »

R Info – basics

R Basics R History R is derived from S that came from Bell Labs.  S was written over Fortran.  S was later rewritten to be driven by C. R Types base types in R are called “atomic” types. The atomic types in R are: character numeric (real numbers) integer complex logical (boolean) Vector most basic object in R contains objects of the same class The only type of vector that can have different atomic... »

Page 1 of 212