I'm searching for the maximum value within a certain range of rows in a CSV file. I figured out the range, but now that I want to determine the maximum value it just reveals the position of that particular value instead of the actual value.
Initial situation as follows:
First I read the file
A <- read.csv(file=data[1], header=TRUE, sep=";")
Then I determine the range investigating
Duration = as.character (A [16,1])
Duration = as.numeric(strsplit(Duration," ") [[1]][2])
B<- A[which(A==28447)]
so these are the target rows:
[943] 0.0                                                                                     
[944] 1.8771                                                                                  
[945] 1.2928                                                                                  
[946] 1.7946                                                                                  
[947] 2.3201                                                                                  
[948] 1.8459                                                                                  
[949] 1.5889                                                                                  
[950] 1.3549                                                                                  
[951] 1.2376                                                                                  
[952] 1.1296                                                                                  
[953] 1.0619                                                                                  
[954] 1.0132                                                                                  
[955] 0.9684                                                                                  
[956] 0.93                                                                                    
[957] 0.8976
now what I did was:
A[(B+1):(B+Duration),1]
revealing that:
    [1] 0.0    1.8771 1.2928 1.7946 2.3201 1.8459 1.5889 1.3549 1.2376 1.1296 1.0619 1.0132 0.9684 0.93   0.8976
24582 Levels: -0.0 -0.001 -0.0011 -0.0012 -0.0014 -0.0016 -0.0017 -0.0018 -0.0019 -0.0022 -0.0024 -0.0026 -0.0028 -0.003 -0.0033 ... Timesteps: 15
If I now go for the max((B+1):(B+Duration),1) I get:
957
How do I avoid that?
 
     
     
    