100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Introduction to Programming Course Commands Guide

Rating
-
Sold
-
Pages
9
Uploaded on
09-05-2023
Written in
2022/2023

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.

Show more Read less
Institution
Course









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Study
Course

Document information

Uploaded on
May 9, 2023
Number of pages
9
Written in
2022/2023
Type
Summary

Subjects

Content preview

● 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
$19.89
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
dannaadelapaz03

Get to know the seller

Seller avatar
dannaadelapaz03 IE University
Follow You need to be logged in order to follow users or courses
Sold
0
Member since
2 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions