Any experts with R programming can help me with this combining vector question?
R code shown below:
> maxTemps<-0
> for(i in printfilenames) {
+ file2 <- read.csv(i, row.names=1)
+ tempMax <-max(file2[1:145,1], na.rm=TRUE)
+ zero<-vector("numeric", 9)
+ for(i in tempMax) {
+ maxTemps<-tempMax+zero
+ print(tempMax)
+ }
+ }
[1] 24.3
[1] 24.1
[1] 19.4
[1] 21.2
[1] 25.4
[1] 28.7
[1] 22.7
[1] 23.2
[1] 24.2
> maxTemps
[1] 24.2 24.2 24.2 24.2 24.2 24.2 24.2 24.2 24.2
This is basically what I am getting.
The question require that my "maxTemps" output should be something like:
[1] 24.3 24.1 19.4 21.2 25.4 28.7 22.7 23.2 24.2
but I am getting:
[1] 24.2 24.2 24.2 24.2 24.2 24.2 24.2 24.2 24.2
Anyone can please help me where I got wrong here? Your helps are much appreciated.
Thanks!