100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary Introduction to Programming Course Commands Guide $17.79   Add to cart

Summary

Summary Introduction to Programming Course Commands Guide

 3 views  0 purchase
  • Course
  • Institution

This document contains a guide on the R studio commands and what the command is used for to create and work with mathematical operations, readline variables, character variables, conditional statements, loops, functions, arrays and vectors, data frames, merges, and all of the dplyr commands.

Preview 2 out of 9  pages

  • May 9, 2023
  • 9
  • 2022/2023
  • Summary
avatar-seller
● cat(“ “) → display a sentence on the screen
Cat without quotation is used to display variables. Ex. a=3, cat(a), 3 is displayed


● typeof → show what kind of variable it is


OPERATIONS FOR NUMERIC VARIABLES


● + → addition
● - → subtraction
● * → multiplication
● %/% → floor division: without decimals (rounded)
● %%==0 → modulus: check if remainder of a division is 0
● %%# → modulus: divide numbers by # and extract the remainder of the division


READLINE


● readline(”TEXT”) → Ask for information from the user of the script. Always
character variable


To convert readline variables into other variables:
● variable = as.numeric(variable)
● variable = as.integer(variable)
● variable = as.character(variable)
● variable = as.logic = (variable)


COMMANDS FOR CHARACTER VARIABLES


● nchar(text_variable) → number of characters in text_variable


● toupper(text_variable) → put in uppercase


● tolower(text_variable) → put in lowercase

, ● gsub(“st”,”street”, text) → change “st” for “street” in text


● trimws(text_variable) → delete unnecessary spaces


● gsub(“ “,””,name of variable) → to delete all spaces in a variable


● grepl(“word”, text_variable) → check if a word is in the variable
Transform word to lower case first


● substr(text_variable, number, number) → Show the characters in position of first
number until the second number


● paste0(variable 1, variable 2) → paste two variables together


CONDITIONAL STATEMENTS


If (condition a) {


if it is false, then…

}else if (condition b)
….


}else{
}
Final else is optional and always without condition


For conditions:
● a > b → greater than
● a < b → less than
● a == b → equal to
● a & b → a and b
● a|b → a or b


LOOPS

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller dannaadelapaz03. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $17.79. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73918 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$17.79
  • (0)
  Add to cart