0% found this document useful (0 votes)
2 views2 pages

Introduction To R Programming Summary

The document provides an introduction to R programming, covering essential data types such as numeric, integer, character, logical, complex, and raw. It explains how to create and manipulate various data structures including factors, vectors, matrices, lists, and data frames, along with methods for subsetting these structures. Key functions like class(), factor(), c(), and data.frame() are highlighted for data manipulation.

Uploaded by

ririn79475
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Introduction To R Programming Summary

The document provides an introduction to R programming, covering essential data types such as numeric, integer, character, logical, complex, and raw. It explains how to create and manipulate various data structures including factors, vectors, matrices, lists, and data frames, along with methods for subsetting these structures. Key functions like class(), factor(), c(), and data.frame() are highlighted for data manipulation.

Uploaded by

ririn79475
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Introduction to R Programming - Summary

1. Data Types / Objects in R

- Numeric: Decimal numbers (e.g., 3.14)

- Integer: Whole numbers (e.g., 10L)

- Character: Text data (e.g., 'Hello')

- Logical: TRUE or FALSE

- Complex: Numbers with imaginary parts (e.g., 4 + 2i)

- Raw: Byte-level data

Use class(), typeof(), is.numeric() etc. to check types.

2. Creating and Manipulating Factors

- Factors represent categorical data.

- Created with factor(): factor(c('low', 'medium', 'high'))

- Can be ordered: factor(..., ordered=TRUE)

- Useful in statistical modeling and grouping.

3. Creating and Manipulating Vectors

- Vectors are 1D homogeneous data structures.

- Created with c(), seq(), rep().

- Access via [index], modify via assignment.

- Supports vectorized operations.

4. Creating and Manipulating Matrices

- Matrices are 2D homogeneous data structures.

- Created with matrix(), rbind(), cbind().

- Access via [row, column].

- Supports transpose, multiplication, row/column sums.

5. Creating and Manipulating Lists

- Lists hold heterogeneous elements.

- Created with list().

- Access using $, [[ ]], or [ ].

- Can be nested; useful for complex data.

6. Creating and Manipulating Data Frames

- Data frames are 2D tabular structures with columns as vectors.

- Columns can be different data types.


- Created with data.frame().

- Access with df[row, col], df$colname.

- Use read.csv(), write.csv() to import/export.

7. Subsetting Matrices and Data Frames

- Extract specific rows, columns, or elements.

- Use [row, col], negative indexing, logical indexing.

- For data frames, use df[df$Age > 20, ] or subset() function.

You might also like