Ch. 2 02_rebuild_nasdaq_order_book KeyError: 'No object named R in the file'

Hi. I am experiencing issue where my interpreter does not recognize some of the required variables. Here is the code I am attempting to run:

def get_messages(date, stock=stock):
    """Collect trading messages for given stock"""
    with pd.HDFStore(itch_store) as store:
        stock_locate = store.select('R', where='stock = stock').stock_locate.iloc[0]
        target = 'stock_locate = stock_locate'

        data = {}
        # trading message types
        messages = ['A', 'F', 'E', 'C', 'X', 'D', 'U', 'P', 'Q']
        for m in messages:
            data[m] = store.select(m, where=target).drop('stock_locate', axis=1).assign(type=m)

    order_cols = ['order_reference_number', 'buy_sell_indicator', 'shares', 'price']
    orders = pd.concat([data['A'], data['F']], sort=False, ignore_index=True).loc[:, order_cols]

    for m in messages[2: -3]:
        data[m] = data[m].merge(orders, how='left')

    data['U'] = data['U'].merge(orders, how='left',
                                right_on='order_reference_number',
                                left_on='original_order_reference_number',
                                suffixes=['', '_replaced'])

    data['Q'].rename(columns={'cross_price': 'price'}, inplace=True)
    data['X']['shares'] = data['X']['cancelled_shares']
    data['X'] = data['X'].dropna(subset=['price'])

    data = pd.concat([data[m] for m in messages], ignore_index=True, sort=False)
    data['date'] = pd.to_datetime(date, format='%m%d%Y')
    data.timestamp = data['date'].add(data.timestamp)
    data = data[data.printable != 0]

    drop_cols = ['tracking_number', 'order_reference_number', 'original_order_reference_number',
                 'cross_type', 'new_order_reference_number', 'attribution', 'match_number',
                 'printable', 'date', 'cancelled_shares']
    return data.drop(drop_cols, axis=1).sort_values('timestamp').reset_index(drop=True)

messages = get_messages(date=date)
messages.info(null_counts=True)

The full error code reads:

KeyError                                  Traceback (most recent call last)
Cell In[12], line 1
----> 1 messages = get_messages(date=date)
      2 messages.info(null_counts=True)

Cell In[10], line 4
      2 """Collect trading messages for given stock"""
      3 with pd.HDFStore(itch_store) as store:
----> 4     stock_locate = store.select('R', where='stock = stock').stock_locate.iloc[0]
      5     target = 'stock_locate = stock_locate'
      7     data = {}

File c:\PATH\Lib\site-packages\pandas\io\pytables.py:881, in HDFStore.select(self, key, where, start, stop, columns, iterator, chunksize, auto_close)
    879 group = self.get_node(key)
    880 if group is None:
--> 881     raise KeyError(f"No object named {key} in the file")
    883 # create the storer and axes
    884 where = _ensure_term(where, scope_level=1)

KeyError: 'No object named R in the file'