Bytes
rocket

Your Success, Our Mission!

6000+ Careers Transformed.

Why Import Data?

Last Updated: 20th August, 2026

Most real-world data does not come preloaded in R. Data is usually stored in files such as CSV or Excel, which must be imported before analysis.

Importing CSV Files

data <- read.csv("data.csv")

Explanation:

  • read.csv() reads a CSV file
  • "data.csv" is the file name (must be in the working directory)
  • The dataset is stored in the variable data

To check where R looks for files:

getwd()

To change the working directory:

setwd("C:/Users/YourName/Documents")

Importing Excel Files

library(readxl)
data <- read_excel("data.xlsx")

Explanation:

  • library(readxl) loads the package
  • read_excel() reads Excel files
  • Useful when working with business datasets

Data Exploration

Understanding Dataset Structure

head(data)

Explanation:
Shows the first 6 rows to quickly inspect the data.

str(data)

Explanation:
Displays:

  • Number of rows and columns
  • Column names
  • Data types of each column
summary(data)

Explanation:
Provides statistical summaries like:

  • Minimum
  • Maximum
  • Mean
  • Median
  • Quartiles

Checking Dimensions

dim(data)

Explanation:
Returns number of rows and columns.

Accessing Columns

data$age

Explanation:
Extracts the age column for analysis.

Simple Statistical Analysis

Measures of Central Tendency

mean(data$score)

Explanation:
Calculates the average score.

median(data$score)

Explanation:
Finds the middle value of the data.

Measures of Dispersion

sd(data$score)

Explanation:
Calculates standard deviation, which shows data spread.

Correlation Analysis

cor(data$age, data$score)

Explanation:
Measures the relationship between age and score:

  • Value close to 1 → strong positive relationship
  • Value close to -1 → strong negative relationship
  • Value close to 0 → weak or no relationship

Basic Visualization

plot(data$age, data$score)

Explanation:
Creates a scatter plot to visually inspect the relationship between two variables.

Module 6: Basic Data Analysis in RWhy Import Data?

Top Tutorials

Logo
Computer Science

CNN in Deep Learning 2026

A beginner-friendly guide to CNNs: understand deep learning essentials, create Python-based models, and explore advanced applications.

4 Modules12 Lessons189 Learners
Start Learning
Logo
Computer Science

Breaking The Limits: Scaling Databases with MySQL Partitioning

Learn MySQL partitioning with examples. Improve query performance, scalability, and data management using RANGE, LIST, HASH, KEY, and composite techniques.

7 Modules11 Lessons91 Learners
Start Learning
Logo

ML in Action: Hands-On Guide to Deploying and Serving Models

Learn model deployment and serving—from concepts to real-world architectures, tools, APIs, containers, and cloud workflows for production-ready ML.

3 Modules6 Lessons91 Learners
Start Learning
  • Official Address
  • 4th floor, 133/2, Janardhan Towers, Residency Road, Bengaluru, Karnataka, 560025
  • Communication Address
  • Follow Us
  • facebook
    instagram
    linkedin
    twitter
    youtube
    telegram

© 2026 AlmaBetter