Populate array with for loop

You may be right, I posted a schematic, but I think the hardware is working properly. I am ok with the current accuracy of +-20ohm. As mentioned my real goal is to figure out how to make this calculation populate an array. Thanks again.

Why do you think that this code is not populating an array of 20 values.

for (int i = 0; i < 20; i = i + 1) {
      raw = analogRead(analogPin);
      float buffer = raw * Vin;
      Vout = (buffer) / 1024.0;
      buffer = (Vin / Vout) - 1;
      R2 = R1 * buffer;
      R2array[i] = R2;
    }

Hi, cattledog. My apology, I am getting used to the forum and missed your above suggestion. See my updated code below. I am not sure if you are suggesting putting my code in the void setup? If so, what do I put in my void loop?

The code below may very well be populating an array of 20, I am just unsure how I would be able to verify that with confidence. The serial monitor just spits out measurements, the same as it did when I was only reading the measurement. BTW, Thank you for all your assistance and for your patience. I appreciated it!

float R2array[20];
int analogPin = 1;
int Vin = 5;
float Vout;
float R1 = 5500; //Fixed value
float R2;

void setup() {
  Serial.begin(9600);
  pinMode(8, OUTPUT);
}

void loop() {
    digitalWrite(8, HIGH);
    int raw = analogRead(analogPin);
    if (raw) {
    for (int i = 0; i < 20; i = i + 1) {
      raw = analogRead(analogPin);
      float buffer = raw * Vin;
      Vout = (buffer) / 1024.0;
      buffer = (Vin / Vout) - 1;
      R2 = R1 * buffer;
      R2array[i] = R2;
    }
  }

  for (int i = 0; i < 20; i = i + 1)
  {
    Serial.println(R2array[i]);
  }
}

It depends on why you are taking the 20 measurements. Sometimes people are calibrating something and they only want one average measurement taken in setup to use in the rest of the program.
If you are trying to read a voltage divider, I do not think that 20 measurements are required. I would think that if you discard the first reading and then take another two you will be good enough.

You may not need the array, and could just take an average without storing the individual values.

The code below may very well be populating an array of 20, I am just unsure how I would be able to verify that with confidence

You ran into a nasty bug with your i = i++. Indeed it even made #8 in Nick Gammon's list of common "traps" when coding for Arduino.

One skill to learn is to think like a computer and read your way line by line through code and work out what is happening. With more experience this will become easier to do and you will be able to see whether a for loop() is doing what you expect it to do. Adding serial prints to debug code is a good practice.

I you need convincing that the for loop is working properly, you can try this as a last line in the code, and when you print out the results you will see the numbers change and grow. You will convince yourself you are not saving the same number every time.

R2array[i] = R2*i

But in order to take readings, you still only need to set the output once. So that is not a valid reason. How did you make the resistor selection (since you identified a possible problem there)? What is the voltage at the analog input? How much do you expect it to vary? Because, it has been suggested that the kind of circuit you have there may not work very well:

https://forum.arduino.cc/t/k-type-thermocouple/118746/13

In some circumstances, the first analog reading is inaccurate. Some people take two readings and only use the second one for this reason - technically it should only happen when changing analog ports, but it may happen on the very first. It's kind of complicated, but you could try taking one analog reading before you sample the next 20, and just throw the results away.

When you are troubleshooting, it would be better to print the raw reading, than the processed numbers.