<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>chaos_kiyono</author_name>
  <author_url>https://blog.hatena.ne.jp/chaos_kiyono/</author_url>
  <blog_title>ケィオスの時系列解析メモランダム</blog_title>
  <blog_url>https://chaosmemo.com/</blog_url>
  <categories>
    <anon>R言語</anon>
  </categories>
  <description>Rではベクトルに要素を追加する際に、「動的拡張」と「事前領域確保」の2つの方法があります。今回の、教訓は 処理を高速化したければ、事前に領域を確保しろ！ ということです。「動的拡張」と「事前領域確保」について説明し、Rスクリプトで数値実験を行ってパフォーマンスの違いを見てみます。 1. 動的拡張 動的拡張は、ベクトルを空の状態から始め、要素を1つずつ追加していく方法です。しかし、Rではベクトルは固定長のデータ構造であり、サイズ変更が必要になるたびに新しいベクトルが作られ、既存の要素がコピーされます。そのため、サイズが大きくなるにつれて計算コストが増加し、処理速度が低下します。 動作イメージ 1…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fchaosmemo.com%2Fentry%2F2025%2F02%2F27%2F014613&quot; title=&quot;【Rを高速化】大規模データを処理するときは事前にデータ領域を確保しておけ！ - ケィオスの時系列解析メモランダム&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-02-27 01:46:13</published>
  <title>【Rを高速化】大規模データを処理するときは事前にデータ領域を確保しておけ！</title>
  <type>rich</type>
  <url>https://chaosmemo.com/entry/2025/02/27/014613</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
