library(gelxx) s6.5k.sub1 <-read.delim("~/s6-5k sub1.txt", header=FALSE) #View(s6.5k.sub1) #Change the data set name data <-s6.5k.sub1 # Extract first row as wavelengths and remove first row from data wavelengths <-data[1.] data <-data[-1,] nr = now(data) DE=D.Cl(data) #Store the minimum values in a list of arrays (list size = nr) # Store the minimum indices in a list of arrays (list size = nr) minima..values <- minima..indices <- # Loop through the rows of the array for (i in 1:nr) { # Find second derivative of the data second.derivative <- data[i, 1:nc-2] - 2*data[i, 2:nc-1] + data[i,3:nc] # Find ALL local minima of the second derivative for the given row # Local min means the entry is less than the one before and the one aft # the entry should also be negative min._index <-which.min(second.derivative) minima_indices[i]<- min.index # be careful that the index is not offset minima_values[i]<-second.derivative[min.index] } #Store the minimum values and their indices in two different lists minima..values minima._.indices
library(gelxx) s6.5k.sub1 <-read.delim("~/s6-5k sub1.txt", header=FALSE) #View(s6.5k.sub1) #Change the data set name data <-s6.5k.sub1 # Extract first row as wavelengths and remove first row from data wavelengths <-data[1.] data <-data[-1,] nr = now(data) DE=D.Cl(data) #Store the minimum values in a list of arrays (list size = nr) # Store the minimum indices in a list of arrays (list size = nr) minima..values <- minima..indices <- # Loop through the rows of the array for (i in 1:nr) { # Find second derivative of the data second.derivative <- data[i, 1:nc-2] - 2*data[i, 2:nc-1] + data[i,3:nc] # Find ALL local minima of the second derivative for the given row # Local min means the entry is less than the one before and the one aft # the entry should also be negative min._index <-which.min(second.derivative) minima_indices[i]<- min.index # be careful that the index is not offset minima_values[i]<-second.derivative[min.index] } #Store the minimum values and their indices in two different lists minima..values minima._.indices
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
PLEASE DO IN RSTUDIO (R
Data Set:
890.776 | 890.519 | 890.263 | 890.006 | 889.749 | 889.493 | 889.236 | 888.979 | ||
-4.25909 | -6.9024 | 9845 | 9608 | 9782 | 9708 | 9661 | 9609 | 9832 | 9753 |
-4.25909 | -6.4544 | 9507 | 9340 | 9337 | 9325 | 9441 | 9300 | 9470 | 9143 |
-4.25909 | -6.0064 | 9576 | 9201 | 9252 | 9238 | 9217 | 9298 | 9217 | 9224 |
-4.25909 | -5.5584 | 9604 | 9301 | 9467 | 9279 | 9457 | 9438 | 9395 | 9310 |
Expert Solution
Step 1
The given code is for finding the local minima of the second derivative of the data.
Algorithm:
- Start
- Read the data from a file into a data frame
- Extract the first row of the data frame as wavelengths and remove it from the data frame
- Store the number of rows and columns of the data frame in variables 'nr' and 'nc'
- Initialize two lists 'minima. values' and 'minima. indices' to store the minimum values and their indices respectively
- Loop through each row of the data frame
- Calculate the second derivative of the data using the formula: second.derivative <- data[i,1:nc-2]-2*data[i, 2:nc-1]+data[i,3:nc]
- Find the index of the minimum value of the second derivative using the function 'which. min(second. derivative)'
- Store the minimum index in the 'minima. indices' list
- Store the minimum value in the 'minima. values' list
- Return the 'minima. values' and 'minima. indices' lists as a result.
- Stop
Step by step
Solved in 4 steps with 1 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY