rm(list=ls())
library(tidyr)
library(readxl)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)
data <- read_excel("data_transecten.xlsx", sheet = "Tabel")
data <- data |>
mutate(transectsample_ID = cur_group_rows(), .before = Sample_ID)
data <- data |>
mutate(across(where(is.character), ~ as.numeric(.x)))Warning: There were 15 warnings in `mutate()`.
The first warning was:
ℹ In argument: `across(where(is.character), ~as.numeric(.x))`.
Caused by warning:
! NAs introduced by coercion
ℹ Run `dplyr::last_dplyr_warnings()` to see the 14 remaining warnings.
data <- data |>
mutate(across(where(is.numeric), ~ round(.x, 3)))
pH_waarde <- data |>
select(transectsample_ID, pH, `Afstand (m)`)
pH_waarde <- pH_waarde |>
slice( 1:(n() - 3))
data_zonder_controle <- data |>
slice( 1:(n() - 3))
ggplot(pH_waarde, aes(y = pH, x = `Afstand (m)`)) +
geom_point() +
labs(x = "afstand tot boerderij", y = "pH")ggplot(data_zonder_controle, aes(y = `N-NH4 getransformeerd`, x = `Afstand (m)`)) +
geom_point() +
labs(x = " afstand tot boerderij", y = " ln N-NH4 mg/ gram dry soil" )ggplot(data_zonder_controle, aes(y = `N-NO3 getransformeerd`, x = `Afstand (m)`)) +
geom_point() +
labs(x = " afstand tot boerderij", y = " ln N-NO3 mg/ gram dry soil" )ggplot(data_zonder_controle, aes(y = data_zonder_controle$`P (mg/gram dry soil)`, x = `Afstand (m)`)) +
geom_point() +
labs(x = " afstand tot boerderij", y = " P mg/ gram dry soil" )Warning: Use of `` data_zonder_controle$`P (mg/gram dry soil)` `` is discouraged.
ℹ Use `P (mg/gram dry soil)` instead.