NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

# Gerekli paketlerin yüklenmesi ve yüklenmesi
install.packages("ggplot2")
install.packages("dplyr")
install.packages("ggrepel")
library(ggplot2)
library(dplyr)
library(ggrepel)

# Dosya yolunu ve dosya adlarını tanımlayın
file_path <- "C:/qq"
file_names <- c("1.txt", "2.txt", "3.txt", "4.txt", "5.txt", "6.txt", "7.txt", "8.txt", "9.txt", "10.txt",
"11.txt", "12.txt", "13.txt", "14.txt", "15.txt", "16.txt", "17.txt", "18.txt", "19.txt",
"20.txt", "21.txt", "22.txt", "23.txt", "24.txt", "25.txt", "26.txt", "27.txt", "28.txt",
"29.txt", "30.txt", "31.txt", "32.txt", "33.txt", "34.txt", "36.txt", "37.txt", "Ahmet Şinasi.txt",
"Emel Kıraç.txt", "Gülüstan Işık.txt", "Hasan Öztürkmen.txt", "Hidayet Cengiz.txt", "İdris Çelik.txt",
"İslim Vural.txt", "Mehmet Cengiz.txt", "Metın Kurt.txt", "Mevlüt Kaya.txt", "Rıza Çiftçi.txt",
"Yakup Kaya.txt", "Yusuf Kenan Uğur.txt")

# Boş bir veri çerçevesi oluşturun
all_data <- data.frame()

# Tüm dosyaları okuyun ve verileri birleştirin
for (file_name in file_names) {
file_path_full <- paste(file_path, file_name, sep = "/")
data <- read.table(file_path_full, header = FALSE, skip = 5)
names(data) <- c("Wavenumber", "Transmittance")
data$File <- file_name # Dosya kimliğini ekleyin
all_data <- rbind(all_data, data)
}

# Pikleri belirlemek için fonksiyon
find_peaks <- function(x, y, span = 3) {
pks <- sapply(1:length(y), function(i) {
start <- max(1, i - span)
end <- min(length(y), i + span)
return(all(y[i] >= y[start:end]))
})
return(which(pks))
}

# En yüksek 5 pik noktasını her dosya için hesaplayın
top_peaks <- all_data %>%
group_by(File) %>%
do({
peaks <- find_peaks(.$Wavenumber, .$Transmittance)
peak_values <- .$Transmittance[peaks]
top_peak_indices <- order(peak_values, decreasing = TRUE)[1:min(5, length(peak_values))]
data.frame(Wavenumber = .$Wavenumber[peaks][top_peak_indices],
Transmittance = .$Transmittance[peaks][top_peak_indices],
File = .$File[1])
})

# En yüksek 5 pik değerlerini yazdırın
print(top_peaks)

# Üst üste çakışmaların görülebileceği çizgi grafiği ve en yüksek 5 pik noktaları
ggplot(all_data, aes(x = Wavenumber, y = Transmittance, color = File, group = File)) +
geom_line() +
geom_point(data = top_peaks, aes(x = Wavenumber, y = Transmittance), color = "red") +
geom_text_repel(data = top_peaks, aes(x = Wavenumber, y = Transmittance, label = round(Transmittance, 2)),
color = "red", size = 3, nudge_y = 0.05,
direction = "y", hjust = 0.5) +
labs(title = "Infrared Spectrum - Overlapping Data with Top 5 Peak Values", x = "Wavenumber (1/CM)", y = "Transmittance (%)") +
theme_minimal() +
theme(legend.position = "right") # Legend'i grafiğin sağ tarafına yerleştirin
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.