R Programming I need to this Loop through columns (i) Identify values in minimal_2dr[[i]] that are less than -0.1 [using logical indexing] Select only those values (e.g. 2 values) Select corresponding values of minimal_indices[[i]] (corresponding 2 values) How would i do this?
R Programming I need to this Loop through columns (i) Identify values in minimal_2dr[[i]] that are less than -0.1 [using logical indexing] Select only those values (e.g. 2 values) Select corresponding values of minimal_indices[[i]] (corresponding 2 values) How would i do this?
R Programming I need to this Loop through columns (i) Identify values in minimal_2dr[[i]] that are less than -0.1 [using logical indexing] Select only those values (e.g. 2 values) Select corresponding values of minimal_indices[[i]] (corresponding 2 values) How would i do this?
Loop through columns (i) Identify values in minimal_2dr[[i]] that are less than -0.1 [using logical indexing] Select only those values (e.g. 2 values) Select corresponding values of minimal_indices[[i]] (corresponding 2 values)
How would i do this?
Transcribed Image Text:File Edit Code View Plots Session Build Debug Profile Tools Help
Go to file/function
lool Addins
Sec_Deri_experiments.R* *
103 # }
104
110
111
105 # Store the minimum values in a list of arrays (list size = nr)
106 # store the minimum indices in a list of arrays (list size = nr)
107 minima_values <- list()
108 minima indices <- list ()
109 #minima_1der <- list() #@@@ may need this later
minima_2der <- list()
115
116
a minimal 2 x
112 # Loop through the columns of the array
113 for (i in 1:nc) {
114
117
118
Source on Save
119
120
# Find second derivative of the data
Run
second_derivative <- smoothData [1: (nc-2),i] - 2*smoothData [2: (nc-1),i] + smoothData [3:nc,i]
sec_der <- as. vector (second_derivative)
locMin = localMinima(sec_der)
minima_indices [[i]]<- 1oCMin+1
minima_values [[i]] <- smoothData [locMin+1]
minima_2der [[i]] <- sec_der [locMin]
121. }
122
# Next step: use the results to obtain an initial guess
123
124 #Loop through columns (i)
125 #Identify values in minimal_2der [[i]] that are less than -0.1
126
# Select only those values (e. g. 2 values)
127
# Select corresponding values of minimal_indices [[i]] (corresponding 2 values)
Soure
Process by which instructions are given to a computer, software program, or application using code.
Expert Solution
Step 1
Algorithm that describes the steps in the code:
1. Initialize minimal_2dr and minimal_indices data structures with appropriate data 2. Loop through each column of minimal_2dr using a for loop: a. Identify the values in the current column that are less than -0.1 using logical indexing b. Select only those values using the identified indices from step a c. Select corresponding values of minimal_indices for the selected values from step b d. Print the selected values and corresponding indices for the current column using cat() function.