Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7633989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:02:52+00:00 2026-05-31T07:02:52+00:00

I have two Excel sheets of climate data: temperature (dtT) and relative humidity (dtR).

  • 0

I have two Excel sheets of climate data: temperature (dtT) and relative humidity (dtR). Each frame is 39 rows (monitoring sites) by 64 columns (61 days numbered from 121 to 181, “lat”, “lon”, and “county”). Both sheets are in the exact same order. I want to use these two datasets to calculate the “heat index” for each monitoring site on each day, filling up another dataframe of the same dimensions.

PROBLEM: I am attempting to use a nested loop, but all the values come back as zeros. Could it be that because the “county” column contains words, R is reading all the numbers as characters, and so it can’t perform the calculations? (**The columns specified may appear confusing here but i’m looking for general strategy)

dtT <- read.csv("C:/Users/Desktop/Tavg3.csv")
dtR <- read.csv("C:/Users/Desktop/RHavg3.csv")    
# Make a new data frame
hi = cbind(dtT, dtR)
# Add empty columns for heat index
hi[paste("hi",121:181,sep="")] = 0  
# Loop to fill each hi cell using NOAA formula
for(i in 1:length(hi$lat)){
    t <- hi[i, 3:63]
    r <- hi[i, 64:124]
    h <- hi[i, 125:185]
    for(j in 1:length(t)){
        h[i,j] = -42.379 + (2.04901523*t[j]) + (10.14333127*r[j]) - (0.22475541*t[j]*r[j]) - 
                ((6.83783*10^-3)*(t[j]^2)) - ((5.481717*10^-2)*(r[j]^2) ) + ((1.22874*10^3) - (t[j]^2)*r[j]) + ((8.5282*10^-4)*t[j]*(r[j]^2)) - ((1.99*10^-6)*(t[j]^2)*(r[j]^2))
    }
}
hi[1:10, 130:140]
hi = hi[,c(1:2, 125:185]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:02:54+00:00Added an answer on May 31, 2026 at 7:02 am

    In your code you update h[i,j], but afterwards you look at hi… What does h look like after the for-loop?

    Note that modifying h will not modify hi even though conceptually h is a subset of hi…

    You could probably just replace h[i,j] = with hi[i,j+124] =

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Excel document with 10000 rows of data in two sheets, the
I have two rows in two different sheets in Excel. Each row has 20
I have an excel document with multiple sheets. Each sheet contains data of separate
I have one Excel document with two sheets Sheet1 and Sheet2. Sheet1 data is
I have to compare two Excel files having different number of sheets, different number
I have an excel file (that I use as a template) with two rows.
If I have two rows in an Excel (.xls) sheet, like a key-value pair,
i have two excel sheets An example of the two sheets are below sheet1
I have two excel sheets. I have to merge the two such that the
I have a excel workbook with two sheets. One sheet is maxed out and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.