·
Sistemas de Informação ·
Linguagens de Programação
Send your question to AI and receive an answer instantly
Recommended for you
37
Introdução à Codificação de Métodos em Java
Linguagens de Programação
ESPM
20
Introdução aos Arrays Bidimensionais em Programação
Linguagens de Programação
ESPM
42
Introdução aos Arrays Unidimensionais em Java
Linguagens de Programação
ESPM
19
Introdução à Linguagem R - Histórico, Interfaces e Instalação
Linguagens de Programação
ESPM
8
Métodos de Manipulação de Strings - Exercícios de Programação em Java
Linguagens de Programação
ESPM
18
Exercícios Práticos em R Markdown: Análise de Dados e Visualização
Linguagens de Programação
ESPM
20
Introdução às Janelas Gráficas em Java com JOptionPane
Linguagens de Programação
ESPM
14
Atividade de Revisao - Criacao e Manipulacao de Dataframe com Tidyverse em R
Linguagens de Programação
ESPM
14
Recursividade em Sistemas de Informação: Conceitos e Exemplos
Linguagens de Programação
ESPM
42
Introdução ao Array Unidimensional em Java
Linguagens de Programação
ESPM
Preview text
Base R Cheat Sheet RStudio is a trademark of RStudio Inc CC BY Mhairi McNeill mhairihmcneillgmailcom Learn more at web page or vignette package version Updated 315 Input Ouput Description df readtablefiletxt writetabledf filetxt Read and write a delimited text file df readcsvfilecsv writecsvdf filecsv Read and write a comma separated value file This is a special case of readtable writetable loadfileRData savedf file fileRdata Read and write an R data file a file type special for R mean Get help of a particular function helpsearchweighted mean Search the help files for a word or phrase helppackage dplyr Find help for a package Getting Help Accessing the help files More about an object striris Get a summary of an objects structure classiris Find the class an object belongs to Programming For Loop for variable in sequence Do something Example for i in 14 j i 10 printj While Loop while condition Do something Example while i 5 printi i i 1 If Statements if condition Do something else Do something different Example if i 3 printYes else printNo Functions functionname functionvar Do something returnnewvariable Example square functionx squared xx returnsquared a b Are equal a b Greater than a b Greater than or equal to isnaa Is missing a b Not equal a b Less than a b Less than or equal to isnulla Is null Conditions Creating Vectors c2 4 6 2 4 6 Join elements into a vector 26 2 3 4 5 6 An integer sequence seq2 3 by05 20 25 30 A complex sequence rep12 times3 1 2 1 2 1 2 Repeat a vector rep12 each3 1 1 1 2 2 2 Repeat elements of a vector Using Libraries installpackagesdplyr Download and install a package from CRAN librarydplyr Load the package into the session making all its functions available to use dplyrselect Use a particular function from a package datairis Load a builtin dataset into the environment Vectors Selecting Vector Elements x4 The fourth element x4 All but the fourth x24 Elements two to four x24 All elements except two to four xc1 5 Elements one and five xx 10 Elements which are equal to 10 xx 0 All elements less than zero xx in c1 2 5 Elements in the set 1 2 5 By Position By Value Named Vectors xapple Element with name apple Reading and Writing Data Working Directory getwd Find the current working directory where inputs are found and outputs are sent setwdCfilepath Change the current working directory Use projects in RStudio to set the working directory to the folder you are working in Vector Functions sortx Return x sorted revx Return x reversed tablex See counts of values uniquex See unique values RStudio is a trademark of RStudio Inc CC BY Mhairi McNeill mhairihmcneillgmailcom 8444481212 rstudiocom Learn more at web page or vignette package version Updated 315 Lists Matrixes Data Frames Maths Functions Types Strings Factors Statistics Distributions aslogical TRUE FALSE TRUE Boolean values TRUE or FALSE asnumeric 1 0 1 Integers or floating point numbers ascharacter 1 0 1 Character strings Generally preferred to factors asfactor 1 0 1 levels 1 0 Character strings with preset levels Needed for some statistical models Converting between common data types in R Can always go from a higher value in the table to a lower value a apple a 1 apple The Environment Variable Assignment ls List all variables in the environment rmx Remove x from the environment rmlist ls Remove all variables from the environment You can use the environment panel in RStudio to browse variables in your environment factorx Turn a vector into a factor Can set the levels of the factor and the order m matrixx nrow 3 ncol 3 Create a matrix from x ww ww ww m2 Select a row m 1 Select a column m2 3 Select an element ww ww ww ww ww ww tm Transpose m n Matrix Multiplication solvem n Find x in m x n l listx 15 y ca b A list is collection of elements which can be of different types l2 l1 lx ly Second element of l New list with only the first element Element named x New list with only element named y df dataframex 13 y ca b c A special case of a list where all elements are the same length ttestx y Preform a ttest for difference between means pairwisettest Preform a ttest for paired data logx Natural log sumx Sum expx Exponential meanx Mean maxx Largest element medianx Median minx Smallest element quantilex Percentage quantiles roundx n Round to n decimal places rankx Rank of elements signifx n Round to n significant figures varx The variance corx y Correlation sdx The standard deviation x y 1 a 2 b 3 c Matrix subsetting df2 df 2 df2 2 List subsetting dfx df2 cbind Bind columns rbind Bind rows Viewdf See the full data frame headdf See the first 6 rows Understanding a data frame nrowdf Number of rows ncoldf Number of columns dimdf Number of columns and rows Plotting Dates See the lubridate library Also see the ggplot2 library Also see the stringr library Also see the dplyr library plotx Values of x in order plotx y Values of x against y histx Histogram of x Random Variates Density Function Cumulative Distribution Quantile Normal rnorm dnorm pnorm qnorm Poison rpois dpois ppois qpois Binomial rbinom dbinom pbinom qbinom Uniform runif dunif punif qunif lmx y datadf Linear model glmx y datadf Generalised linear model summary Get more detailed information out a model proptest Test for a difference between proportions aov Analysis of variance pastex y sep Join multiple vectors together pastex collapse Join elements of a vector together greppattern x Find regular expression matches in x gsubpattern replace x Replace matches in x with a string toupperx Convert to uppercase tolowerx Convert to lowercase ncharx Number of characters in a string cutx breaks 4 Turn a numeric vector into a factor but cutting into sections
Send your question to AI and receive an answer instantly
Recommended for you
37
Introdução à Codificação de Métodos em Java
Linguagens de Programação
ESPM
20
Introdução aos Arrays Bidimensionais em Programação
Linguagens de Programação
ESPM
42
Introdução aos Arrays Unidimensionais em Java
Linguagens de Programação
ESPM
19
Introdução à Linguagem R - Histórico, Interfaces e Instalação
Linguagens de Programação
ESPM
8
Métodos de Manipulação de Strings - Exercícios de Programação em Java
Linguagens de Programação
ESPM
18
Exercícios Práticos em R Markdown: Análise de Dados e Visualização
Linguagens de Programação
ESPM
20
Introdução às Janelas Gráficas em Java com JOptionPane
Linguagens de Programação
ESPM
14
Atividade de Revisao - Criacao e Manipulacao de Dataframe com Tidyverse em R
Linguagens de Programação
ESPM
14
Recursividade em Sistemas de Informação: Conceitos e Exemplos
Linguagens de Programação
ESPM
42
Introdução ao Array Unidimensional em Java
Linguagens de Programação
ESPM
Preview text
Base R Cheat Sheet RStudio is a trademark of RStudio Inc CC BY Mhairi McNeill mhairihmcneillgmailcom Learn more at web page or vignette package version Updated 315 Input Ouput Description df readtablefiletxt writetabledf filetxt Read and write a delimited text file df readcsvfilecsv writecsvdf filecsv Read and write a comma separated value file This is a special case of readtable writetable loadfileRData savedf file fileRdata Read and write an R data file a file type special for R mean Get help of a particular function helpsearchweighted mean Search the help files for a word or phrase helppackage dplyr Find help for a package Getting Help Accessing the help files More about an object striris Get a summary of an objects structure classiris Find the class an object belongs to Programming For Loop for variable in sequence Do something Example for i in 14 j i 10 printj While Loop while condition Do something Example while i 5 printi i i 1 If Statements if condition Do something else Do something different Example if i 3 printYes else printNo Functions functionname functionvar Do something returnnewvariable Example square functionx squared xx returnsquared a b Are equal a b Greater than a b Greater than or equal to isnaa Is missing a b Not equal a b Less than a b Less than or equal to isnulla Is null Conditions Creating Vectors c2 4 6 2 4 6 Join elements into a vector 26 2 3 4 5 6 An integer sequence seq2 3 by05 20 25 30 A complex sequence rep12 times3 1 2 1 2 1 2 Repeat a vector rep12 each3 1 1 1 2 2 2 Repeat elements of a vector Using Libraries installpackagesdplyr Download and install a package from CRAN librarydplyr Load the package into the session making all its functions available to use dplyrselect Use a particular function from a package datairis Load a builtin dataset into the environment Vectors Selecting Vector Elements x4 The fourth element x4 All but the fourth x24 Elements two to four x24 All elements except two to four xc1 5 Elements one and five xx 10 Elements which are equal to 10 xx 0 All elements less than zero xx in c1 2 5 Elements in the set 1 2 5 By Position By Value Named Vectors xapple Element with name apple Reading and Writing Data Working Directory getwd Find the current working directory where inputs are found and outputs are sent setwdCfilepath Change the current working directory Use projects in RStudio to set the working directory to the folder you are working in Vector Functions sortx Return x sorted revx Return x reversed tablex See counts of values uniquex See unique values RStudio is a trademark of RStudio Inc CC BY Mhairi McNeill mhairihmcneillgmailcom 8444481212 rstudiocom Learn more at web page or vignette package version Updated 315 Lists Matrixes Data Frames Maths Functions Types Strings Factors Statistics Distributions aslogical TRUE FALSE TRUE Boolean values TRUE or FALSE asnumeric 1 0 1 Integers or floating point numbers ascharacter 1 0 1 Character strings Generally preferred to factors asfactor 1 0 1 levels 1 0 Character strings with preset levels Needed for some statistical models Converting between common data types in R Can always go from a higher value in the table to a lower value a apple a 1 apple The Environment Variable Assignment ls List all variables in the environment rmx Remove x from the environment rmlist ls Remove all variables from the environment You can use the environment panel in RStudio to browse variables in your environment factorx Turn a vector into a factor Can set the levels of the factor and the order m matrixx nrow 3 ncol 3 Create a matrix from x ww ww ww m2 Select a row m 1 Select a column m2 3 Select an element ww ww ww ww ww ww tm Transpose m n Matrix Multiplication solvem n Find x in m x n l listx 15 y ca b A list is collection of elements which can be of different types l2 l1 lx ly Second element of l New list with only the first element Element named x New list with only element named y df dataframex 13 y ca b c A special case of a list where all elements are the same length ttestx y Preform a ttest for difference between means pairwisettest Preform a ttest for paired data logx Natural log sumx Sum expx Exponential meanx Mean maxx Largest element medianx Median minx Smallest element quantilex Percentage quantiles roundx n Round to n decimal places rankx Rank of elements signifx n Round to n significant figures varx The variance corx y Correlation sdx The standard deviation x y 1 a 2 b 3 c Matrix subsetting df2 df 2 df2 2 List subsetting dfx df2 cbind Bind columns rbind Bind rows Viewdf See the full data frame headdf See the first 6 rows Understanding a data frame nrowdf Number of rows ncoldf Number of columns dimdf Number of columns and rows Plotting Dates See the lubridate library Also see the ggplot2 library Also see the stringr library Also see the dplyr library plotx Values of x in order plotx y Values of x against y histx Histogram of x Random Variates Density Function Cumulative Distribution Quantile Normal rnorm dnorm pnorm qnorm Poison rpois dpois ppois qpois Binomial rbinom dbinom pbinom qbinom Uniform runif dunif punif qunif lmx y datadf Linear model glmx y datadf Generalised linear model summary Get more detailed information out a model proptest Test for a difference between proportions aov Analysis of variance pastex y sep Join multiple vectors together pastex collapse Join elements of a vector together greppattern x Find regular expression matches in x gsubpattern replace x Replace matches in x with a string toupperx Convert to uppercase tolowerx Convert to lowercase ncharx Number of characters in a string cutx breaks 4 Turn a numeric vector into a factor but cutting into sections