Introduction

Bitcoin is one of the most widely traded cryptocurrencies and its price can experience significant changes over time. For this analysis, I used historical Bitcoin price data to examine its daily closing price and calculate several basic summary statistics.

Reading the Data

bitcoin <- read.csv("BTC-USD.csv", sep = ";")
head(bitcoin)
##                   timeOpen                timeClose                 timeHigh
## 1 2026-09-15T00:00:00.000Z 2026-09-15T23:59:59.999Z 2026-09-15T00:11:00.000Z
## 2 2026-09-14T00:00:00.000Z 2026-09-14T23:59:59.999Z 2026-09-14T20:24:00.000Z
## 3 2026-09-13T00:00:00.000Z 2026-09-13T23:59:59.999Z 2026-09-13T21:25:00.000Z
## 4 2026-09-12T00:00:00.000Z 2026-09-12T23:59:59.999Z 2026-09-12T14:54:00.000Z
## 5 2026-09-11T00:00:00.000Z 2026-09-11T23:59:59.999Z 2026-09-11T14:04:00.000Z
## 6 2026-09-10T00:00:00.000Z 2026-09-10T23:59:59.999Z 2026-09-10T05:59:00.000Z
##                    timeLow name     open     high      low    close      volume
## 1 2026-09-15T18:51:00.000Z 2781 78162.48 78242.54 74944.60 75612.51 39694675220
## 2 2026-09-14T00:30:00.000Z 2781 76830.28 79568.96 76367.37 78163.38 29909358382
## 3 2026-09-13T11:14:00.000Z 2781 77270.18 77415.66 76498.38 76838.16 13607872549
## 4 2026-09-12T19:41:00.000Z 2781 77175.07 77479.66 77045.00 77270.47 12664765797
## 5 2026-09-11T12:31:00.000Z 2781 76559.12 79818.34 76162.92 77173.79 37410998193
## 6 2026-09-10T23:16:00.000Z 2781 78260.39 78520.97 76470.64 76568.12 30120111719
##      marketCap circulatingSupply                timestamp
## 1 1.518660e+12          20084962 2026-09-15T23:59:59.999Z
## 2 1.569851e+12          20084459 2026-09-14T23:59:59.999Z
## 3 1.543060e+12          20084003 2026-09-13T23:59:59.999Z
## 4 1.551857e+12          20083512 2026-09-12T23:59:59.999Z
## 5 1.549909e+12          20083028 2026-09-11T23:59:59.999Z
## 6 1.537501e+12          20082537 2026-09-10T23:59:59.999Z

Exploring the Dataset

# View the structure of the dataset
str(bitcoin)
## 'data.frame':    400 obs. of  13 variables:
##  $ timeOpen         : chr  "2026-09-15T00:00:00.000Z" "2026-09-14T00:00:00.000Z" "2026-09-13T00:00:00.000Z" "2026-09-12T00:00:00.000Z" ...
##  $ timeClose        : chr  "2026-09-15T23:59:59.999Z" "2026-09-14T23:59:59.999Z" "2026-09-13T23:59:59.999Z" "2026-09-12T23:59:59.999Z" ...
##  $ timeHigh         : chr  "2026-09-15T00:11:00.000Z" "2026-09-14T20:24:00.000Z" "2026-09-13T21:25:00.000Z" "2026-09-12T14:54:00.000Z" ...
##  $ timeLow          : chr  "2026-09-15T18:51:00.000Z" "2026-09-14T00:30:00.000Z" "2026-09-13T11:14:00.000Z" "2026-09-12T19:41:00.000Z" ...
##  $ name             : int  2781 2781 2781 2781 2781 2781 2781 2781 2781 2781 ...
##  $ open             : num  78162 76830 77270 77175 76559 ...
##  $ high             : num  78243 79569 77416 77480 79818 ...
##  $ low              : num  74945 76367 76498 77045 76163 ...
##  $ close            : num  75613 78163 76838 77270 77174 ...
##  $ volume           : num  3.97e+10 2.99e+10 1.36e+10 1.27e+10 3.74e+10 ...
##  $ marketCap        : num  1.52e+12 1.57e+12 1.54e+12 1.55e+12 1.55e+12 ...
##  $ circulatingSupply: int  20084962 20084459 20084003 20083512 20083028 20082537 20082100 20081609 20081181 20080743 ...
##  $ timestamp        : chr  "2026-09-15T23:59:59.999Z" "2026-09-14T23:59:59.999Z" "2026-09-13T23:59:59.999Z" "2026-09-12T23:59:59.999Z" ...
# View summary statistics
summary(bitcoin)
##       timeOpen       timeClose        timeHigh        timeLow         name     
##  Length   :400   Length   :400   Length   :400   Length   :400   Min.   :2781  
##  N.unique :400   N.unique :400   N.unique :400   N.unique :400   1st Qu.:2781  
##  N.blank  :  0   N.blank  :  0   N.blank  :  0   N.blank  :  0   Median :2781  
##  Min.nchar: 24   Min.nchar: 24   Min.nchar: 24   Min.nchar: 24   Mean   :2781  
##  Max.nchar: 24   Max.nchar: 24   Max.nchar: 24   Max.nchar: 24   3rd Qu.:2781  
##                                                                  Max.   :2781  
##       open             high             low             close       
##  Min.   : 58562   Min.   : 60173   Min.   : 57748   Min.   : 58559  
##  1st Qu.: 67799   1st Qu.: 69181   1st Qu.: 66083   1st Qu.: 67799  
##  Median : 78490   Median : 79463   Median : 77252   Median : 78387  
##  Mean   : 84046   Mean   : 85314   Mean   : 82596   Mean   : 83939  
##  3rd Qu.: 95157   3rd Qu.: 95949   3rd Qu.: 93692   3rd Qu.: 94573  
##  Max.   :124752   Max.   :126198   Max.   :123196   Max.   :124753  
##      volume            marketCap         circulatingSupply      timestamp  
##  Min.   :9.079e+09   Min.   :1.174e+12   Min.   :19905281   Length   :400  
##  1st Qu.:2.721e+10   1st Qu.:1.356e+12   1st Qu.:19950600   N.unique :400  
##  Median :3.996e+10   Median :1.572e+12   Median :19995943   N.blank  :  0  
##  Mean   :4.425e+10   Mean   :1.678e+12   Mean   :19995430   Min.nchar: 24  
##  3rd Qu.:5.646e+10   3rd Qu.:1.888e+12   3rd Qu.:20039087   Max.nchar: 24  
##  Max.   :1.531e+11   Max.   :2.486e+12   Max.   :20084962

The dataset contains information including Bitcoin’s daily opening price, high price, low price, closing price, trading volume, and market capitalization.

Average and Median Closing Price

# Calculate the average Bitcoin closing price
mean(bitcoin$close, na.rm = TRUE)
## [1] 83938.84
# Calculate the median Bitcoin closing price
median(bitcoin$close, na.rm = TRUE)
## [1] 78386.88

The mean represents the average daily closing price in the dataset, while the median represents the middle closing price in the dataset.

Minimum and Maximum Closing Price

# Min Bitcoin closing price
min(bitcoin$close, na.rm = TRUE)
## [1] 58558.86
# Max Bitcoin closing price
max(bitcoin$close, na.rm = TRUE)
## [1] 124752.5

These values show the lowest and highest daily closing prices observed during the period.

Variation in Bitcoin Price

sd(bitcoin$close, na.rm = TRUE)
## [1] 18417.58

The standard deviation provides a measure of how much Bitcoin’s daily closing price varied during the period.

Average Daily Trading Volume

mean(bitcoin$volume, na.rm = TRUE)
## [1] 44246791402

Trading volume represents the amount of Bitcoin trading activity occurring during each day.

Bitcoin’s Daily Closing Price

plot(x = 1:nrow(bitcoin), y = bitcoin$close, type = "l", xlab = "Day", ylab = "Bitcoin Closing Price (USD)", main = "Bitcoin Closing Price Over Time")

Conclusion

This analysis demonstrates how R can be used to read financial market data and quickly calculate descriptive statistics. The results show the average, median, minimum, and maximum Bitcoin closing prices during the selected period, while the standard deviation provides additional insight into how much the price varied. The line chart also makes it easier to see how Bitcoin’s price changed over time.