begin ex03

This commit is contained in:
eneller
2025-11-14 13:12:04 +01:00
parent 63d9254247
commit 1f048bbb7f
4 changed files with 3083 additions and 0 deletions

69
LE9.R Normal file
View File

@@ -0,0 +1,69 @@
## Laboratory exercise 9
rm(list=ls())
library(leaflet)
library(sf)
library(DataExplorer)
library(lubridate)
setwd('E://')
pnt_data <- read.csv('rec.csv',header = FALSE,
sep='',skip=15)
#Time instants reformatting
doy <- yday(pnt_data$V1)
res1 <- ymd_hms(paste(pnt_data$V1,pnt_data$V2, sep=' '))
hour <- hour(res1)
min <- minute(res1)
sec <- second(res1)
timer <- doy + hour/24 + min/(24*60) + sec/(24*3600)
latitude <- (pnt_data$V3 + 12.843697222222223)*6378137*pi/180
longitude <- (pnt_data$V4 - 131.13274444444443)*6378137*pi/180
height <- pnt_data$V5 - 125.1
data <- as.data.frame(cbind(longitude, latitude, height))
summary(data)
plot(timer, latitude, type='l', col = 'red',
ylim = c(min(latitude, longitude,height),
max(latitude, longitude,height)),
xlab='time [day in 2015]',ylab='errors [m]')
lines(timer, longitude, col= 'dark green')
lines(timer, height, col= 'blue')
legend('topright', legend=c('latitude', 'longitude','height'),
col=c('red','dark green', 'blue'), lty=1:1, cex=0.8,
box.lty=0)
plot_histogram(data)
plot_correlation(data, maxcat = 5L)
plot_boxplot(data, by = "height")
boxplot(data, names=c('easting [m]',
'northing [m]',
'height [m]'),
ylab='# of occurences', main='GPS only')
# Define the coordinates
lat2 <- -12.844
lon2 <- 131.133
# Create a spatial object from the data frame
lon = lon2
lat = lat2
points <- st_as_sf(data.frame(lon= lon,
lat = lat), coords = c("lon", "lat")) #,
#crs = 4326)
# Add tiles to the map
map <- leaflet(points) %>%
addTiles() %>%
# Add markers for the two points with popup labels
addMarkers(lng = ~lon, lat = ~lat,
popup = ~paste("Point", round(lat), round(lon)))
map

45
ex03.Rmd Normal file
View File

@@ -0,0 +1,45 @@
---
title: "Location Based Services Assignment 03"
author: "Erik Neller"
date: "`r Sys.Date()`"
output:
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Task 1
```{r plot}
# Load required packages
sy <- sunspots
plot(sunspots, col='blue', xlab='time [year]', ylab='Sunspot number')
```
```{r summary}
print(summary(sunspots))
print(sd(sunspots))
```
```{r whisker}
boxplot(sunspots, main='Boxplot diagram', xlab='Sunspot number', ylab='quartiles')
```
```{r hist}
hist(sunspots, xlab= 'Sunspot number', ylab= 'number of occurrences', main='Sunspot number histogram')
```
```{r density}
plot(density(sunspots), xlab= 'Sunspot number', ylab= 'probability of occurrence', main='Experimental PDF')
```
# Task 2
```{r exploratory}
library(leaflet)
library(sf)
library(DataExplorer)
library(lubridate)
pnt_data <- read.csv('rec.csv', header=FALSE, sep='',skip=15)
doy <- yday
```

2895
rec.csv Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1957,6 +1957,52 @@
"Maintainer": "Lionel Henry <lionel@posit.co>",
"Repository": "CRAN"
},
"lubridate": {
"Package": "lubridate",
"Version": "1.9.4",
"Source": "Repository",
"Type": "Package",
"Title": "Make Dealing with Dates a Little Easier",
"Authors@R": "c( person(\"Vitalie\", \"Spinu\", , \"spinuvit@gmail.com\", role = c(\"aut\", \"cre\")), person(\"Garrett\", \"Grolemund\", role = \"aut\"), person(\"Hadley\", \"Wickham\", role = \"aut\"), person(\"Davis\", \"Vaughan\", role = \"ctb\"), person(\"Ian\", \"Lyttle\", role = \"ctb\"), person(\"Imanuel\", \"Costigan\", role = \"ctb\"), person(\"Jason\", \"Law\", role = \"ctb\"), person(\"Doug\", \"Mitarotonda\", role = \"ctb\"), person(\"Joseph\", \"Larmarange\", role = \"ctb\"), person(\"Jonathan\", \"Boiser\", role = \"ctb\"), person(\"Chel Hee\", \"Lee\", role = \"ctb\") )",
"Maintainer": "Vitalie Spinu <spinuvit@gmail.com>",
"Description": "Functions to work with date-times and time-spans: fast and user friendly parsing of date-time data, extraction and updating of components of a date-time (years, months, days, hours, minutes, and seconds), algebraic manipulation on date-time and time-span objects. The 'lubridate' package has a consistent and memorable syntax that makes working with dates easy and fun.",
"License": "GPL (>= 2)",
"URL": "https://lubridate.tidyverse.org, https://github.com/tidyverse/lubridate",
"BugReports": "https://github.com/tidyverse/lubridate/issues",
"Depends": [
"methods",
"R (>= 3.2)"
],
"Imports": [
"generics",
"timechange (>= 0.3.0)"
],
"Suggests": [
"covr",
"knitr",
"rmarkdown",
"testthat (>= 2.1.0)",
"vctrs (>= 0.6.5)"
],
"Enhances": [
"chron",
"data.table",
"timeDate",
"tis",
"zoo"
],
"VignetteBuilder": "knitr",
"Config/Needs/website": "tidyverse/tidytemplate",
"Config/testthat/edition": "3",
"Encoding": "UTF-8",
"LazyData": "true",
"RoxygenNote": "7.2.3",
"SystemRequirements": "C++11, A system with zoneinfo data (e.g. /usr/share/zoneinfo). On Windows the zoneinfo included with R is used.",
"Collate": "'Dates.r' 'POSIXt.r' 'util.r' 'parse.r' 'timespans.r' 'intervals.r' 'difftimes.r' 'durations.r' 'periods.r' 'accessors-date.R' 'accessors-day.r' 'accessors-dst.r' 'accessors-hour.r' 'accessors-minute.r' 'accessors-month.r' 'accessors-quarter.r' 'accessors-second.r' 'accessors-tz.r' 'accessors-week.r' 'accessors-year.r' 'am-pm.r' 'time-zones.r' 'numeric.r' 'coercion.r' 'constants.r' 'cyclic_encoding.r' 'data.r' 'decimal-dates.r' 'deprecated.r' 'format_ISO8601.r' 'guess.r' 'hidden.r' 'instants.r' 'leap-years.r' 'ops-addition.r' 'ops-compare.r' 'ops-division.r' 'ops-integer-division.r' 'ops-m+.r' 'ops-modulo.r' 'ops-multiplication.r' 'ops-subtraction.r' 'package.r' 'pretty.r' 'round.r' 'stamp.r' 'tzdir.R' 'update.r' 'vctrs.R' 'zzz.R'",
"NeedsCompilation": "yes",
"Author": "Vitalie Spinu [aut, cre], Garrett Grolemund [aut], Hadley Wickham [aut], Davis Vaughan [ctb], Ian Lyttle [ctb], Imanuel Costigan [ctb], Jason Law [ctb], Doug Mitarotonda [ctb], Joseph Larmarange [ctb], Jonathan Boiser [ctb], Chel Hee Lee [ctb]",
"Repository": "CRAN"
},
"magrittr": {
"Package": "magrittr",
"Version": "2.0.4",
@@ -3188,6 +3234,34 @@
"Maintainer": "Lionel Henry <lionel@posit.co>",
"Repository": "CRAN"
},
"timechange": {
"Package": "timechange",
"Version": "0.3.0",
"Source": "Repository",
"Title": "Efficient Manipulation of Date-Times",
"Authors@R": "c(person(\"Vitalie\", \"Spinu\", email = \"spinuvit@gmail.com\", role = c(\"aut\", \"cre\")), person(\"Google Inc.\", role = c(\"ctb\", \"cph\")))",
"Description": "Efficient routines for manipulation of date-time objects while accounting for time-zones and daylight saving times. The package includes utilities for updating of date-time components (year, month, day etc.), modification of time-zones, rounding of date-times, period addition and subtraction etc. Parts of the 'CCTZ' source code, released under the Apache 2.0 License, are included in this package. See <https://github.com/google/cctz> for more details.",
"Depends": [
"R (>= 3.3)"
],
"License": "GPL (>= 3)",
"Encoding": "UTF-8",
"LinkingTo": [
"cpp11 (>= 0.2.7)"
],
"Suggests": [
"testthat (>= 0.7.1.99)",
"knitr"
],
"SystemRequirements": "A system with zoneinfo data (e.g. /usr/share/zoneinfo) as well as a recent-enough C++11 compiler (such as g++-4.8 or later). On Windows the zoneinfo included with R is used.",
"BugReports": "https://github.com/vspinu/timechange/issues",
"URL": "https://github.com/vspinu/timechange/",
"RoxygenNote": "7.2.1",
"NeedsCompilation": "yes",
"Author": "Vitalie Spinu [aut, cre], Google Inc. [ctb, cph]",
"Maintainer": "Vitalie Spinu <spinuvit@gmail.com>",
"Repository": "CRAN"
},
"tinytex": {
"Package": "tinytex",
"Version": "0.57",