http_interactions:
- request:
    method: POST
    uri: https://api.anthropic.com/v1/messages
    body:
      string: '{"model":"claude-sonnet-4-5-20250929","system":[{"type":"text","text":"\n  You
        are an expert R programmer who prefers the tidyverse.\n","cache_control":{"type":"ephemeral","ttl":"5m"}}],"messages":[{"role":"user","content":[{"type":"text","text":"\n  How
        can I compute the mean and median of variables a, b, c, and so on,\n  all
        the way up to z, grouped by age and sex.\n","cache_control":{"type":"ephemeral","ttl":"5m"}}]}],"stream":false,"max_tokens":4096}'
  response:
    status: 200
    headers:
      date: Thu, 06 Nov 2025 14:55:07 GMT
      content-type: application/json
      content-encoding: gzip
      anthropic-ratelimit-input-tokens-limit: '2000000'
      anthropic-ratelimit-input-tokens-remaining: '2000000'
      anthropic-ratelimit-input-tokens-reset: '2025-11-06T14:55:01Z'
      anthropic-ratelimit-output-tokens-limit: '400000'
      anthropic-ratelimit-output-tokens-remaining: '400000'
      anthropic-ratelimit-output-tokens-reset: '2025-11-06T14:55:07Z'
      anthropic-ratelimit-requests-limit: '4000'
      anthropic-ratelimit-requests-remaining: '3999'
      anthropic-ratelimit-requests-reset: '2025-11-06T14:54:59Z'
      retry-after: '62'
      anthropic-ratelimit-tokens-limit: '2400000'
      anthropic-ratelimit-tokens-remaining: '2400000'
      anthropic-ratelimit-tokens-reset: '2025-11-06T14:55:01Z'
      request-id: req_011CUrq1JDKV666ywA6JTMtV
      strict-transport-security: max-age=31536000; includeSubDomains; preload
      anthropic-organization-id: bf3687d8-1b59-41eb-9761-a1fd70b24e7e
      x-envoy-upstream-service-time: '7802'
      cf-cache-status: DYNAMIC
      x-robots-tag: none
      server: cloudflare
      cf-ray: 99a56de63d2bc0c0-DFW
    body:
      string: '{"model":"claude-sonnet-4-5-20250929","id":"msg_013nmFcSyuTKjqCKhGVuRbMg","type":"message","role":"assistant","content":[{"type":"text","text":"Here''s
        how to compute the mean and median of variables `a` through `z`, grouped by
        `age` and `sex`:\n\n```r\nlibrary(tidyverse)\n\n# Assuming your data frame
        is called ''df''\ndf %>%\n  group_by(age, sex) %>%\n  summarise(\n    across(\n      a:z,\n      list(mean
        = mean, median = median),\n      .names = \"{.col}_{.fn}\"\n    ),\n    .groups
        = \"drop\"\n  )\n```\n\nThis will create columns like `a_mean`, `a_median`,
        `b_mean`, `b_median`, etc.\n\n**Alternative approach** if you want the results
        in long format:\n\n```r\ndf %>%\n  group_by(age, sex) %>%\n  summarise(\n    across(\n      a:z,\n      list(mean
        = mean, median = median)\n    ),\n    .groups = \"drop\"\n  ) %>%\n  pivot_longer(\n    cols
        = -c(age, sex),\n    names_to = c(\"variable\", \"statistic\"),\n    names_sep
        = \"_\",\n    values_to = \"value\"\n  )\n```\n\n**Notes:**\n- If you have
        missing values, add `na.rm = TRUE`: `list(mean = ~mean(., na.rm = TRUE), median
        = ~median(., na.rm = TRUE))`\n- The `a:z` syntax selects all columns from
        `a` to `z` in order\n- `.groups = \"drop\"` removes the grouping structure
        from the result"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":61,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":370,"service_tier":"standard"}}'
  recorded_at: 2025-11-06 14:55:07
recorded_with: VCR-vcr/2.0.0
