R for Reproducible Scientific Analysis: Referencia

Key Points

Referencia

Introducción a R y RStudio

Manejo de proyectos con RStudio

Buscando ayuda

Estructuras de datos

Los valores atómicos en R deben ser de alguno de los 5 tipos de datos, múltiples valores se pueden agrupar en estructuras de datos.

Tipos de datos

Estructuras de datos básicas en R:

Recuerda que las matrices son realmente vectores atómicos, y que los data.frames son realmente listas(esto explica algunos de los comportamientos extraños de R).

Vectores

Factores

Listas

Matrices

Data Frames

Funciones útiles para consultar estructuras de datos:

Explorando Dataframes

Subconjunto de datos

Control de flujo

Creación de gráficos con calidad para publicación

Vectorización

Funciones

Escribiendo datos

Split-apply-combine

Manejo de dataframe con dplyr

Manejo de dataframe con tidyr

Generando reportes con knitr

Buenas prácticas para escribir un buen código

Glosario

argument
A value given to a function or program when it runs. The term is often used interchangeably (and inconsistently) with parameter.
assign
To give a value a name by associating a variable with it.
body
(of a function): the statements that are executed when a function runs.
comment
A remark in a program that is intended to help human readers understand what is going on, but is ignored by the computer. Comments in Python, R, and the Unix shell start with a # character and run to the end of the line; comments in SQL start with --, and other languages have other conventions.
comma-separated values
(CSV) A common textual representation for tables in which the values in each row are separated by commas.
delimiter
A character or characters used to separate individual values, such as the commas between columns in a CSV file.
documentation
Human-language text written to explain what software does, how it works, or how to use it.
floating-point number
A number containing a fractional part and an exponent. See also: integer.
for loop
A loop that is executed once for each value in some kind of set, list, or range. See also: while loop.
index
A subscript that specifies the location of a single value in a collection, such as a single pixel in an image.
integer
A whole number, such as -12343. See also: floating-point number.
library
In R, the directory(ies) where packages are stored.
package
A collection of R functions, data and compiled code in a well-defined format. Packages are stored in a library and loaded using the library() function.
parameter
A variable named in the function’s declaration that is used to hold a value passed into the call. The term is often used interchangeably (and inconsistently) with argument.
return statement
A statement that causes a function to stop executing and return a value to its caller immediately.
sequence
A collection of information that is presented in a specific order.
shape
An array’s dimensions, represented as a vector. For example, a 5×3 array’s shape is (5,3).
string
Short for “character string”, a sequence of zero or more characters.
syntax error
Un error de programación que ocurre cuando las instrucciones están en un orden o contienen caracteres no esperados por el lenguaje de programación.
type
La clasificación de algo en un programa (por ejemplo, el contenido de una variable) como un tipo de número (por ejemplo floating-point, integer), string, o algo más. En R el comando typeof() se usa para consultar el tipo de una variable.
while loop
Un bucle que se ejecuta siempre que una condición dada sea verdadera. See also: for loop.