R basics: Dataframe, for loop and if condition Flashcards
what are data frames used for?
used to store structured data in tabular format similar to a spreadsheet
what do columns contain?
each column can contain data of different types, numbers, text, dates etc.
what do rows contain?
each row is associated with a unique index or identifer.
what are dimensions?
dimensions are represented as the number of rows and columns.
what is the code for dimensions?
dim()
what is a for loop
a for loop is used to iterate over a sequence of elemts and perfomr a set of operations repeatedly
a for loop is a control structure that allows you to execute a block of code multiple times
what are the three main components of for loops?
Initialization: you specify a variable and set its initial value. this variable is used as a counter during the loop
iteration: After each iteration of the loop, the counter variable is updated according to specified increment or decrement.