R-grid.pot の和訳とチェックのページ
の編集
http://www.okadajp.org/RWiki/?R-grid.pot+%E3%81%AE%E5%92%8C%E8%A8%B3%E3%81%A8%E3%83%81%E3%82%A7%E3%83%83%E3%82%AF%E3%81%AE%E3%83%9A%E3%83%BC%E3%82%B8
[
トップ
] [
編集
|
差分
|
バックアップ
|
添付
|
リロード
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
-- 雛形とするページ --
(no template pages)
COLOR(blue){SIZE(18){R-grid.pot の和訳とチェックのページ}} 以下は R-grid.pot の素(粗)訳です.元ファイルと各メッセージのソース部分 を取り出したファイルを添付します.~ 舟尾 (第一稿 2005.03.27) #contents -implemented, unimplimented の訳が推奨となっている箇所が複数ありますが、「実装」もしくは「未実装」です。 -- &new{2005-03-27 (日) 17:05:37}; -「特定」も「指定」でしょうね -- &new{2005-03-27 (日) 17:09:50}; -間瀬先生,ソースの添付をありがとうございます.ソースと照合して訳を見直していきます.~ また,多数ご指摘いただきましてありがとうございます.ある程度時間がたった後に,訳に反映します. -- [[舟尾]] &new{2005-03-27 (日) 23:27:54}; -多数の貴重なご意見、本当にありがとうございました。私自身、かなり勉強させてもらいました!3/30付けで修正致しましたので、よろしくお願い致します。 -- [[舟尾]] &new{2005-03-30 (水) 23:09:23}; #comment msgid "" msgstr "" "Project-Id-Version: R 2.1.0\n" "Report-Msgid-Bugs-To: bugs@r-project.org\n" "POT-Creation-Date: 2005-03-08 07:39\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" * 1-20 msgid "Invalid 'at' location in 'axis'" msgstr "'axis'中の 'at' のロケーション(location)が不正です" msgid "Invalid to specify axis labels when 'at' is NULL" msgstr "'at' が NULL である場合,axis ラベルを特定するのは無効です" msgid "'labels' and 'at' locations must have same length" msgstr "'labels' と 'at' のロケーション(location)は同じ長さでなければなりません" msgid "Invalid 'edit' information" msgstr "不正な 'edit' 情報です" msgid "'gEditList' can only contain 'gEdit' objects" msgstr "'gEditList' には 'gEdit' オブジェクトしか含めることが出来ません" msgid "Invalid 'frame'" msgstr "不正な 'frame' です" msgid "Invalid 'grob'" msgstr "不正な 'grob' です" msgid "Invalid 'row' and/or 'col' (no such cell in frame layout)" msgstr "不正な 'row' かつ/または 'col' です(frame layout の中にそのようなセルは存在しません)" msgid "'col' can only be a range of existing columns" msgstr "'col' は存在する列の範囲しかとり得ません" msgid "Invalid 'col' specification" msgstr "不正な 'col' の指定です" msgid "'row' can only be a range of existing rows" msgstr "'row' は存在する行の範囲しかとり得ません" msgid "Invalid 'row' specification" msgstr "不正な 'row' の指定です" msgid "Cannot specify more than one of 'side=[\"left\", \"right\"]', 'col', 'col.before', or 'col.after'" msgstr "'side=[\"left\", \"right\"]', 'col', 'col.before', 'col.after' のうち 1 つ以上を特定することが出来ません" msgid "Must specify exactly one of 'side=[\"top\", \"bottom\"]', 'row', 'row.before', or 'row.after'" msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうち 1 つを正確に特定しなければいけません" msgid "gpar element '%s' must not be length 0" msgstr "gpar の要素 '%s' は長さ 0 にしてはいけません" msgid "'gamma' gpar is deprecated" msgstr "'gamma' gpar は廃止予定です" msgid "Invalid 'linemitre' value" msgstr "不正な 'linemitre' 値です" msgid "Invalid 'alpha' value" msgstr "不正な 'alpha' 値です" msgid "Must specify only one of 'font' and 'fontface'" msgstr "'font' または 'fontface' の 1 つのみを特定しなければいけません" msgid "Invalid font face" msgstr "不正なフォントの書体です" -"'labels' と 'at' のロケーション(location)は同じ長さでなければなりません" => "'labels' と、位置 'at' は同じ長さでなければなりません" -- &new{2005-03-27 (日) 20:53:27}; -msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうち 1 つを正確に特定しなければいけません" => msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうちちょうど一つを指定しなければいけません" -- &new{2005-03-27 (日) 20:55:12}; #comment * 21-40 msgid "Argument must be a 'gpar' object" msgstr "引数は 'gpar' オブジェクトでなければなりません" msgid "Must specify only valid 'gpar' names" msgstr "有効な 'gpar' の名前のみを特定しなければいけません" msgid "Invalid display list element" msgstr "不正なディスプレイリストの要素です" msgid "grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE')" msgstr "grob(s) が上書きされました(おそらく grab は信用できるものではありません; 'wrap=TRUE' を試してください)" msgid "viewport overwritten (grab MAY not be faithful)" msgstr "viewport が上書きされました(おそらく grab は信用できるものではありません)" msgid "grob pushed viewports and did not pop/up them (grab MAY not be faithful)" msgstr "grob が viewports に push され,viewports は pop/up されませんでした (おそらく grab は信用できるものではありません)" msgid "Only valid to push viewports" msgstr "viewports を push することだけが有効です" msgid "Must specify at least one viewport" msgstr "少なくとも 1 つの viewport を特定しなければいけません" msgid "Viewport '%s' was not found" msgstr "Viewport '%s' が見つかりません" msgid "Must pop at least one viewport" msgstr "少なくとも 1 つの viewport を pop しなければいけません" msgid "Must navigate up at least one viewport" msgstr "少なくとも 1 つの viewport を navigate up しなければいけません" msgid "The vp argument is deprecated" msgstr "引数 vp は廃止予定です" msgid "Invalid 'ask' value" msgstr "不正な 'ask' 値です" msgid "Invalid object inserted on the display list" msgstr "ディスプレイリスト上に不正なオブジェクトが挿入されました" msgid "Invalid 'vp' slot" msgstr "不正な 'vp' スロットです" msgid "Invalid 'gp' slot" msgstr "不正な 'gp' スロットです" msgid "Invalid 'grob' class" msgstr "不正な 'grob' クラスです" msgid "grid.grob() is deprecated; please use grob() instead" msgstr "grid.grob() は廃止予定です; 代わりに grob() を使って下さい" msgid "A 'grob' path must contain at least one 'grob' name" msgstr "'grob' のパスは少なくとも 1 つの 'grob' の名前を含んでいなければなりません" msgid "Invalid 'grob' name(s)" msgstr "不正な 'grob' の名前です" #comment * 41-60 msgid "Only 'grobs' allowed in 'gList'" msgstr "'grobs' は 'gList' 中でのみ許されます" msgid "Invalid element to add to 'gList'" msgstr "'gList' に不正な要素が加えられました" msgid "Can only set 'children' for a 'gTree'" msgstr "'gTree' には 'children' しかセットできません" msgid "'children' must be a 'gList'" msgstr "'children' は 'gList' でなければなりません" msgid "It is only valid to get 'children' from a 'gTree'" msgstr "'children' は 'gTree' からしか得ることが出来ません" msgid "Invalid 'gTree' class" msgstr "不正な 'gTree' クラスです" msgid "'allDevices' not yet implemented" msgstr "'allDevices' はまだ推奨されていません" msgid "Invalid 'gPath'" msgstr "不正な 'gPath' です" msgid "Invalid 'grep' value" msgstr "不正な 'grep' 値です" msgid "It is only valid to get a child from a 'gTree'" msgstr "child は 'gTree' からしか得ることが出来ません" msgid "'gPath' does not specify a valid child" msgstr "'gPath' は有効な child を特定することが出来ません" msgid "It is only valid to set a child of a 'gTree'" msgstr "'gTree' の child をセットすることだけが有効です" msgid "It is only valid to set a 'grob' as child of a 'gTree'" msgstr "'grob' を 'gTree' の child としてセットすることだけが有効です" msgid "New 'grob' name (%s) does not match 'gPath' (%s)" msgstr "新しい 'grob' 名(%s)は 'gPath'(%s) に合致しません" msgid "It is only valid to add a 'grob' to a 'gTree'" msgstr "'grob' を 'gTree' に加えることだけが有効です" msgid "It is only valid to add a child to a 'gTree'" msgstr "child を 'gTree' に加えることだけが有効です" msgid "It is only valid to remove a child from a 'gTree'" msgstr "child を 'gTree' から取り払うことだけが有効です" msgid "It is only valid to edit a child of a 'gTree'" msgstr "'gTree' の child を編集することだけが有効です" msgid "It is invalid to directly edit the 'children' or 'childrenOrder' slot" msgstr "'children' または 'childrenOrder' のスロットを直接編集することだけが有効です" msgid "Invalid 'result'" msgstr "不正な 'result' です" -"'children' または 'childrenOrder' のスロットを直接編集することだけが有効です" => "'children' または 'childrenOrder' スロットを直接編集してはいけません" -- &new{2005-03-27 (日) 16:54:21}; -"'gPath' は有効な child を特定することが出来ません" => "'gPath' は有効な child を指定していません" -- &new{2005-03-27 (日) 17:07:07}; -"'grobs' は 'gList' 中でのみ許されます" => "''gList' 中には 'grobs' のみが許されます" -- &new{2005-03-27 (日) 20:50:47}; #comment * 61-80 msgid "The new 'grob' must have the same name as the old 'grob'" msgstr "新しい 'grob' は古い 'grob' と同じ名前でなければなりません" msgid "Slot '%s' not found" msgstr "スロット '%s' が見つかりません" msgid "'gPath' (%s) not found" msgstr "'gPath'(%s) が見つかりません" msgid "gPath (%s) not found" msgstr "gPath(%s) が見つかりません" msgid "Grob '%s' not found" msgstr "Grob '%s' が見つかりません" msgid "Invalid element in the display list" msgstr "ディスプレイリストの中に不正な要素があります" msgid "This function is redundant and will disappear in future versions." msgstr "この関数は余分で,将来のバージョンの中で消えるでしょう" msgid "'l' must be a layout" msgstr "'l' は layout でなければなりません" msgid "'pch' and 'labels' not the same length" msgstr "'pch' と 'labels' は同じ長さでなければなりません" msgid "'hgap' must be single unit" msgstr "'hgap' は一つの単位(unit)でなければなりません" msgid "'vgap' must be single unit" msgstr "'vgap' は一つの単位(unit)でなければなりません" msgid "Invalid justification" msgstr "不正な正当化(justification)です ???????????" msgid "Invalid horizontal justification" msgstr "不正な水平の正当化(horizontal justification)です ???????????" msgid "Invalid vertical justification" msgstr "不正な垂直の正当化(horizontal justification)です ???????????" msgid "'respect' must be logical or an 'nrow' by 'ncol' matrix" msgstr "'respect' は論理値か 'ncol' 行列による 'nrow' でなければなりません" msgid "Invalid 'origin'" msgstr "不正な 'origin' です" msgid "'x' and 'y' must be units" msgstr "'x' と 'y' は単位(units)でなければなりません" msgid "'x' and 'y' must have length 1" msgstr "'x' と 'y' は長さ 1 でなければならない" msgid "'x0', 'y0', 'x1', and 'y1' must be units" msgstr "'x0', 'y0', 'x1', 'y1' は単位(units)でなければなりません" msgid "'x' and 'y' must be units or NULL" msgstr "'x' と 'y' は単位(units)または NULL でなければなりません" -justification とはテキスト(行)を見栄えのよい表示のために左右、上下に整列させる清書法のことです。空白の挿入も含むかも知れません。訳は「ジャスティフィケーション」もしくは「ジャスティファイする」でしょうか。 -- &new{2005-03-27 (日) 17:01:38}; -"'respect' は論理値か 'ncol' 行列による 'nrow' でなければなりません" => "'respect' は論理値か、 'ncol' x'nrow' 行列でなければなりません" -- &new{2005-03-27 (日) 17:03:47}; -ソースを見ると justification とは (何の?) right,left,top,bottom, および上下左右の center 指定のことのようですね。そうすると「位置決め指定が不正です」、「水平方向の位置決め指定が不正です」、「垂直方向の位置決め指定が不正です」とでも訳す? -- &new{2005-03-27 (日) 20:42:15}; -"この関数は余分で,将来のバージョンの中で消えるでしょう" => "この関数は余分で,将来無くなるでしょう" -- &new{2005-03-27 (日) 20:56:46}; -"'pch' と 'labels' は同じ長さでなければなりません" => "'pch' と 'labels' は同じ長さでありません" -- &new{2005-03-28 (月) 21:01:23}; -"'pch' と 'labels' は同じ長さでなければなりません" => "'pch' と 'labels' は同じ長さでありません" ですが,何回か書きましたが「が」と「は」は意味がまるっきり違うと思うのですが,それのように思うのは私だけでしょうか。繰り返しますが「は」は単なる事実の陳述,「が」も事実の陳述ではあるけれども,エラーメッセージのコンテクストから言えば,それは暗に間違いですよと言っているように思うんですけど。前にも書きましたけど,エラーメッセージとして「sqrt の引数は負です」と書かれると,確かに,sqrt(-4.321)なんて書いたならあ,負だな,間違えちゃったと思うけど,sqrt(x)って書いてあって,エラーメッセージで「引数は負です」といわれたら,あ,x が正だったかと思うのでは(例では平方根 sqrt だから誤解する方が悪いのだが,あまりよく知らない関数だと,事実として言われたのか,それが悪いと言われているのか区別が付かないのでは?)。それに対して,「引数が負です」と言われたら,あ,間違って負の値を渡しちゃったのかな??と,そういう反応になるのではないでしょうか。ま,丁寧に書けば,「指定された引数が負でした。引数は正でなければなりません。」ということでしょうね。エラーメッセージは,単に誤りの事実を知らせるのではなく,その間違いを正すにはどのように対処しなくてはならないかを明示する方がよい(そのようなエラーメッセージが優れたエラーメッセージ)ということは,よく知られた法則です。元のエラーメッセージに忠実に訳す必要はない(もとのエラーメッセージが優れたエラーメッセージである保証・証拠は何もない)ので,意訳でも良いから,ユーザの役に立つメッセージになれば良いのではないかと思います。 -- &new{2005-03-28 (月) 21:56:31}; -ご意見は基本的に賛成ですが、意訳が誤訳になっていないという確証がどれだけ持てるかということも考える必要があります。そうした自信が持てない場合は、できるだけ原文に忠実に訳すことも必要ではないでしょうか。実際のところ、一定程度の確度(ここの基準が微妙です)がない限り、むしろ原文のままにしておく方が良いのではとも感じています。ただし、現在はどういう訳が可能なのかを検討する場と思いますから、思いつきでも色んな意見が出る方が良いと思います。これは、R マニュアルの翻訳で散々意訳を行なった(そして後で赤面した)経験からの感想です。 -- [[間瀬茂]] &new{2005-03-28 (月) 23:00:06}; -意訳は某出版社のような「超訳」ではないですから,意訳=いい加減な訳ということではないでしょう。エラーメッセージの内容がちゃんとわかっているものについてはより分かりやすいエラーメッセージを付けましょうというようなことだと思います。本来は,英語版のエラーメッセージの改善を提案できるくらいの英語力があれば良いのですが。 -- &new{2005-03-28 (月) 23:24:55}; -"'pch' と 'labels' は同じ長さでなければなりません" => 指定された "'pch' と 'labels' の長さが違います." -- &new{2005-03-28 (月) 23:29:56}; #comment * 81-100 msgid "'length' must be a unit object" msgstr "'length' は単位(units)オブジェクトでなければなりません" msgid "Invalid 'ends' or 'type' argument" msgstr "不正な 'ends' 引数か 'type' 引数です" msgid "Corrupt 'arrows' object" msgstr "誤った 'arrows' オブジェクトです" msgid "The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob" msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のうち,いずれかの grob でなければなりません" msgid "It is invalid to specify both 'id' and 'id.lengths" msgstr "'id' と 'id.lengths' の両方を特定することは出来ません" msgid "'x' and 'y' must be same length" msgstr "'x' と 'y' は同じ長さでなければなりません" msgid "'x' and 'y' and 'id' must all be same length" msgstr "'x', 'y', 'id' は全て同じ長さでなければなりません" msgid "'x' and 'y' and 'id.lengths' must specify same overall length" msgstr "'x', 'y', 'id.lengths' は全て同じ長さを特定しなければなりません" msgid "'x', 'y', and 'r' must be units" msgstr "'x', 'y', 'r' は全て単位(units)でなければなりません" msgid "'x', 'y', 'width', and 'height' must be units" msgstr "'x', 'y', 'width', 'height' は全て単位(units)でなければなりません" msgid "Invalid 'rot' value" msgstr "不正な 'rot' 値でなければなりません" msgid "zero-length 'pch'" msgstr "長さ 0 の 'pch' です" msgid "'x', 'y' and 'size' must be units" msgstr "'x', 'y', 'size' は全て単位(units)でなければなりません" msgid "'x' and 'y' must be unit objects and have the same length" msgstr "'x' と 'y' は単位(units)でなければならず,同じ長さでなければなりません" msgid "'x' must be numeric" msgstr "'x' は数値でなければなりません" msgid "'x' and 'units' must have length > 0" msgstr "'x' と 'units' は 0 より大きい長さでなければなりません" msgid "'x' argument must be a unit object" msgstr "引数 'x' は単位(units)オブジェクトでなければなりません" msgid "Invalid 'axis' or 'type'" msgstr "不正な 'axis' か 'type' です" msgid "No string supplied for 'strwidth' unit" msgstr "'strwidth' 単位(units)を与える文字列がありません" msgid "No string supplied for 'strheight' unit" msgstr "'strheight' 単位(units)を与える文字列がありません" -"誤った 'arrows' オブジェクトです" => "混乱した 'arrows' オブジェクトです" corrupt は「腐敗した」という意味で、単なる間違いよりも強い、内容が支離滅裂というニュアンスではないでしょうか? -- &new{2005-03-28 (月) 19:38:53}; -msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のうち,いずれかの grob でなければなりません" => msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のいずれかの grob でなければなりません" -- &new{2005-03-28 (月) 20:57:48}; -corrupt は,コンピュータ用語では〈プログラム・データが〉エラーのあるということで,端的な苺で言えば「壊れた」と言うような意味。壊れる原因は,コピーの誤りや,ダウンロード時の雑音など。したがって,確かに誤っているのではあるが,その原因は,指定ミスなどのようなものではない。しかし,そのようなことに目くじらを立てて訳してもしょうがない気はする。"Corrupt 'arrows' object" ということであるが,arrow object は壊れるけど,ほかのobject は壊れないのかのかどうか。たぶん,ないのだろうけど。複数人が書くプログラムのエラーメッセージの用語の統一などはあまり期待できない。自分一人で作っているプログラムでも(プログラムでなくても変数名の命名規則でも,ファイル名の命名規則でも)ずいぶん変異が多いというのは,経験済み。 -- &new{2005-03-28 (月) 23:41:43}; -"不正な 'rot' 値でなければなりません" → "不正な 'rot' 値です" -- &new{2005-03-28 (月) 23:46:58}; #comment * 101-120 msgid "No 'grob' supplied for 'grobwidth' unit" msgstr "'grobwidth' 単位(units)を与える 'grob' がありません" msgid "'gPath' must have depth 1 in 'grobwidth/height' units" msgstr "'gPath' は 'grobwidth/height' 単位(units)中では深さ 1 でなければなりません" msgid "No 'grob' supplied for 'grobheight' unit" msgstr "'grobheight' 単位(units)を与える 'grob' がありません" msgid "Operator '%s' not meaningful for units" msgstr "演算子 '%s' は単位(units)として意味をなしません" msgid "Only one operand may be a unit" msgstr "1 つのオペランド(operand)のみが単位(units)となります" msgid "Non-unit operand must be numeric" msgstr "単位ではないオペランド(operand)は数値でなければなりません" msgid "Both operands must be units" msgstr "オペランド(operand)は両方とも単位(units)でなければなりません" msgid "'Summary' function '%s' not meaningful for units" msgstr "'Summary' 関数 '%s' は単位(units)として意味をなしません" msgid "Zero arguments where at least one expected" msgstr "引数が 0 個ですが,少なくとも 1 つの引数が必要です" msgid "Index out of bounds (unit subsetting)" msgstr "添え字が範囲を超えています(単位(unit)の部分集合です??????????)" msgid "Index out of bounds (unit arithmetic subsetting)" msgstr "添え字が範囲を超えています(単位(unit)計算の部分集合です??????????)" msgid "Index out of bounds (unit list subsetting)" msgstr "添え字が範囲を超えています(単位(unit)リストの部分集合です??????????)" msgid "It is invalid to combine unit objects with other types" msgstr "単位(unit)オブジェクトとそれ以外の型のオブジェクトを結合することは出来ません" msgid "'range' must be numeric" msgstr "'range' は数値でなければなりません" msgid "'x', 'y', 'width', and 'height' must all be units of length 1" msgstr "'x', 'y', 'width', 'height' は全て長さ 1 の単位(units)でなければなりません" msgid "Invalid graphics parameters" msgstr "不正なグラフィックスパラメータです" msgid "Invalid 'clip' value" msgstr "viewport 中の 'clip' が不正です" msgid "Invalid 'xscale' in viewport" msgstr "viewport 中の 'xscale' が不正です" msgid "Invalid 'yscale' in viewport" msgstr "viewport 中の 'yscale' が不正です" msgid "Invalid 'angle' in viewport" msgstr "viewport 中の 'angle' が不正です" -"不正な 'rot' 値でなければなりません" => "不正な 'rot' 値です" -- &new{2005-03-27 (日) 20:02:58}; -"1 つのオペランド(operand)のみが単位(units)となります" => "一つのオペランド(operand)のみが単位(units)となれます"。operand は訳せば「被演算項」でしょうか。二項演算子等の引数のことだと思います。 -- &new{2005-03-27 (日) 20:08:43}; #comment * 121-140 msgid "Invalid 'layout' in viewport" msgstr "viewport 中の 'layout' が不正です" msgid "Invalid 'layout.pos.row' in viewport" msgstr "viewport 中の 'layout.pos.row' が不正です" msgid "Invalid 'layout.pos.col' in viewport" msgstr "viewport 中の 'layout.pos.col' が不正です" msgid "Only viewports allowed in 'vpList'" msgstr "viewports は 'vpList' 中でのみ許されます" msgid "Only viewports allowed in 'vpStack'" msgstr "viewports は 'vpStack' 中でのみ許されます" msgid "'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree'" msgstr "'parent' は viewport でなければならず,'children' は 'vpTree' 中の 'vpList' でなければなりません" msgid "A viewport path must contain at least one viewport name" msgstr "viewport のパスは少なくとも一つの viewport 名を含んでいる必要があります" msgid "Invalid viewport name(s)" msgstr "不正な viewport 名です" msgid "Must specify at least one of 'x' or 'xscale'" msgstr "'x' or 'xscale' のうち少なくとも一つを特定しなければなりません" msgid "Must specify at least one of 'y' or 'yscale'" msgstr "'y' か 'yscale' のうち少なくとも一つを特定しなければなりません" #comment * ソース Invalid 'at' location in 'axis' components.R- x$at <- as.numeric(x$at) components.R- if (length(x$at) < 1 || components.R- !is.finite(x$at)) components.R: stop("Invalid 'at' location in 'axis'") components.R- } components.R- if (!is.logical(x$label)) { components.R- # labels specified Invalid to specify axis labels when 'at' is NULL components.R- # labels specified components.R- # Can only spec labels if at is not NULL components.R- if (is.null(x$at)) components.R: stop("Invalid to specify axis labels when 'at' is NULL") components.R- # Must be either language object or string components.R- if (!is.language(x$label)) components.R- x$label <- as.character(x$label) 'labels' and 'at' locations must have same length components.R- x$label <- as.character(x$label) components.R- # Must be same number of labels as "at" locations components.R- if (length(x$label) != length(x$at)) components.R: stop("'labels' and 'at' locations must have same length") components.R- } components.R- x$main <- as.logical(x$main) components.R- x Invalid 'edit' information edit.R- x edit.R- } else { edit.R- if (!is.gEdit(edit)) edit.R: stop("Invalid 'edit' information") edit.R- # Intended to handle whether edit has gPath spec or not edit.R- newx <- do.call("editGrob", c(list(x), edit)) edit.R- # If edit was specified for non-existent child, newx will be NULL -- edit.R- applyEdit(x, edits) edit.R- else { edit.R- if (!inherits(edits, "gEditList")) edit.R: stop("Invalid 'edit' information") edit.R- for (i in edits) edit.R- x <- applyEdits(x, i) edit.R- x 'gEditList' can only contain 'gEdit' objects edit.R-gEditList <- function(...) { edit.R- edits <- list(...) edit.R- if (!all(sapply(edits, is.gEdit))) edit.R: stop("'gEditList' can only contain 'gEdit' objects") edit.R- class(edits) <- "gEditList" edit.R- edits edit.R-} Invalid 'frame' frames.R-placeGrob <- function(frame, grob, frames.R- row=NULL, col=NULL) { frames.R- if (!inherits(frame, "frame")) frames.R: stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R- stop("Invalid 'grob'") frames.R- dim <- frameDim(frame) -- frames.R- force.width=FALSE, force.height=FALSE, frames.R- border=NULL, dynamic=FALSE) { frames.R- if (!inherits(frame, "frame")) frames.R: stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R- stop("Invalid 'grob'") frames.R- # col/row can be given as a range, but I only want to know Invalid 'grob' frames.R- if (!inherits(frame, "frame")) frames.R- stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R: stop("Invalid 'grob'") frames.R- dim <- frameDim(frame) frames.R- if (is.null(row)) frames.R- row <- c(1, dim[1]) -- frames.R- if (!inherits(frame, "frame")) frames.R- stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R: stop("Invalid 'grob'") frames.R- # col/row can be given as a range, but I only want to know frames.R- # about the min and max frames.R- if (!is.null(col) & length(col) > 1) { -- grob.R- g <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'grob' class") grob.R- class(g) <- c(cl, "grob", "gDesc") grob.R- validGrob(g) grob.R-} -- grob.R- if (n < 1) grob.R- stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R: stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else grob.R- paste(names[1:(n-1)], collapse=.grid.pathSep), grob.R- name=names[n], Invalid 'row' and/or 'col' (no such cell in frame layout) frames.R- col <- rep(col, 2) frames.R- if (min(row) < 1 || max(row) > dim[1] || frames.R- min(col) < 1 || max(col) > dim[2]) frames.R: stop("Invalid 'row' and/or 'col' (no such cell in frame layout)") frames.R- cgrob <- cellGrob(col, row, NULL, grob, FALSE, frames.R- cellViewport(col, row, NULL)) frames.R- addGrob(frame, cgrob) 'col' can only be a range of existing columns frames.R- # It is an error to specify a range for col which is outside 1..ncol frames.R- if (length(col) == 2) frames.R- if (col[1] < 1 || col[2] > ncol) frames.R: stop("'col' can only be a range of existing columns") frames.R- else frames.R- result <- FALSE frames.R- # It is also an error to specify a single col outside 1..ncol+1 Invalid 'col' specification frames.R- # It is also an error to specify a single col outside 1..ncol+1 frames.R- else frames.R- if (col < 1 || col > ncol + 1) frames.R: stop("Invalid 'col' specification") frames.R- else frames.R- result <- col == ncol+1 frames.R- } 'row' can only be a range of existing rows frames.R- # It is an error to specify a range for row which is outside 1..nrow frames.R- if (length(row) == 2) frames.R- if (row[1] < 1 || row[2] > nrow) frames.R: stop("'row' can only be a range of existing rows") frames.R- else frames.R- result <- FALSE frames.R- # It is also an error to specify a single row outside 1..nrow+1 Invalid 'row' specification frames.R- # It is also an error to specify a single row outside 1..nrow+1 frames.R- else frames.R- if (row < 1 || row > nrow + 1) frames.R: stop("Invalid 'row' specification") frames.R- else frames.R- result <- row == nrow+1 frames.R- } Cannot specify more than one of 'side=["left", "right"]', 'col', 'col.before', or 'col.after' Must specify exactly one of 'side=["top", "bottom"]', 'row', 'row.before', or 'row.after' gpar element '%s' must not be length 0 gpar.R- # Check a (non-NULL) gpar is not of length 0 gpar.R- check.length <- function(gparname) { gpar.R- if (length(gpars[[gparname]]) == 0) gpar.R: stop(gettextf("gpar element '%s' must not be length 0", gparname), gpar.R- domain = NA) gpar.R- } gpar.R- # Check a gpar is numeric and not NULL 'gamma' gpar is deprecated gpar.R- numnotnull("lex") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gpars)) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- numnotnull("gamma") gpar.R- numnotnull("alpha") gpar.R- # col and fill are converted in C code -- gpar.R- temp <- grid.Call("L_getGPar") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gp)) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- # Special case "cex" (make it cumulative) gpar.R- if (match("cex", names(gp), nomatch=0)) gpar.R- tempcex <- temp$cex * gp$cex -- gpar.R- stop("Must specify only valid 'gpar' names") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- result <- grid.Call("L_getGPar")[names] gpar.R- } gpar.R- class(result) <- "gpar" Invalid 'linemitre' value gpar.R- numnotnull("linemitre") gpar.R- if (!is.na(match("linemitre", names(gpars)))) { gpar.R- if (any(gpars$linemitre < 1)) gpar.R: stop("Invalid 'linemitre' value") gpar.R- } gpar.R- # alpha should be 0 to 1 gpar.R- if (!is.na(match("alpha", names(gpars)))) { Invalid 'alpha' value gpar.R- # alpha should be 0 to 1 gpar.R- if (!is.na(match("alpha", names(gpars)))) { gpar.R- if (any(gpars$alpha < 0 || gpars$alpha > 1)) gpar.R: stop("Invalid 'alpha' value") gpar.R- } gpar.R- # font should be integer and not NULL gpar.R- if (!is.na(match("font", names(gpars)))) { Must specify only one of 'font' and 'fontface' gpar.R- # Illegal to specify both font and fontface gpar.R- if (!is.na(match("fontface", names(gpars)))) { gpar.R- if (!is.na(match("font", names(gpars)))) gpar.R: stop("Must specify only one of 'font' and 'fontface'") gpar.R- if (is.null(gpars$fontface)) gpar.R- gpars$font <- NULL gpar.R- else { Invalid font face gpar.R- cyrillic=5, gpar.R- cyrillic.oblique=6, gpar.R- EUC=7, gpar.R: stop("Invalid font face")) gpar.R- gpars$font <- as.integer(temp.num) gpar.R- } gpar.R- } Argument must be a 'gpar' object gpar.R- gpar.R-set.gpar <- function(gp) { gpar.R- if (!is.gpar(gp)) gpar.R: stop("Argument must be a 'gpar' object") gpar.R- temp <- grid.Call("L_getGPar") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gp)) Must specify only valid 'gpar' names gpar.R- else { gpar.R- if (!is.character(names) || gpar.R- !all(names %in% .grid.gpar.names)) gpar.R: stop("Must specify only valid 'gpar' names") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names) gpar.R- warning("'gamma' gpar is deprecated") Invalid display list element grab.R- grab.R-wrap.default <- function(x) { grab.R- if (!is.null(x)) grab.R: stop("Invalid display list element") grab.R- NULL grab.R-} grab.R- grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE') grab.R- names <- getNames() grab.R- # Check for overwriting existing grob grab.R- if (length(unique(names)) != length(names)) grab.R: warning("grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE')") grab.R- } grab.R- grid.newpage(recording=FALSE) grab.R- # Start at 2 because first element is viewport[ROOT] viewport overwritten (grab MAY not be faithful) grab.R- # with existing viewport name grab.R- if (inherits(tempvp, "viewport") && grab.R- vpExists(tempvp)) grab.R: warning("viewport overwritten (grab MAY not be faithful)") grab.R- } grab.R- if (!is.null(tempvp)) grab.R- tempdepth <- depth(tempvp) -- grab.R- # Check to see if about to push a viewport grab.R- # with existing viewport name grab.R- if (vpExists(elt)) grab.R: warning("viewport overwritten (grab MAY not be faithful)") grab.R- grid.draw(elt, recording=FALSE) grab.R- ########### grab.R- # grabPop grob pushed viewports and did not pop/up them (grab MAY not be faithful) grab.R- pathSame = FALSE grab.R- } grab.R- if (!pathSame) grab.R: warning("grob pushed viewports and did not pop/up them (grab MAY not be faithful)") grab.R- } grab.R- elt$vp <- drawPath grab.R- if (!is.null(tempvp)) Only valid to push viewports grid.R-} grid.R- grid.R-push.vp.default <- function(vp, recording) { grid.R: stop("Only valid to push viewports") grid.R-} grid.R- grid.R-push.vp.viewport <- function(vp, recording) { Must specify at least one viewport grid.R- grid.R-pushViewport <- function(..., recording=TRUE) { grid.R- if (missing(...)) grid.R: stop("Must specify at least one viewport") grid.R- else { grid.R- vps <- list(...) grid.R- lapply(vps, push.vp, recording) Viewport '%s' was not found grid.R- record(name) grid.R- } grid.R- } else { grid.R: stop(gettextf("Viewport '%s' was not found", as.character(name)), grid.R- domain = NA) grid.R- } grid.R- invisible(result) Must pop at least one viewport grid.R- grid.R-popViewport <- function(n=1, recording=TRUE) { grid.R- if (n < 0) grid.R: stop("Must pop at least one viewport") grid.R- if (n == 0) grid.R- n <- vpDepth() grid.R- if (n > 0) { Must navigate up at least one viewport grid.R-# simply navigate up, leaving pushed viewports in place. grid.R-upViewport <- function(n=1, recording=TRUE) { grid.R- if (n < 0) grid.R: stop("Must navigate up at least one viewport") grid.R- if (n == 0) { grid.R- n <- vpDepth() grid.R- upPath <- current.vpPath() The vp argument is deprecated grid.R- # ever see normal viewports, so convert. grid.R- vpFromPushedvp(grid.Call("L_currentViewport")) grid.R- else { grid.R: warning("The vp argument is deprecated") grid.R- vp grid.R- } grid.R-} Invalid 'ask' value grid.R- old.prompt <- .Call("L_getAsk") grid.R- if (!missing(ask)) { grid.R- if (!is.logical(ask)) grid.R: stop("Invalid 'ask' value") grid.R- .Call("L_setAsk", ask) grid.R- } grid.R- old.prompt Invalid object inserted on the display list grid.R-# gets put on the display list grid.R-record.default <- function(x) { grid.R- if (!is.numeric(x)) grid.R: stop("Invalid object inserted on the display list") grid.R- grid.Call("L_setDLelt", x) grid.R- inc.display.list() grid.R-} Invalid 'vp' slot grob.R- if (!inherits(vp, "viewport") && grob.R- !inherits(vp, "vpPath") && grob.R- !is.character(vp)) grob.R: stop("Invalid 'vp' slot") grob.R- # For interactive use, allow user to specify grob.R- # vpPath directly (i.e., w/o calling vpPath) grob.R- if (is.character(vp)) Invalid 'gp' slot grob.R- # gp must be a gpar grob.R- if (!is.null(gp)) grob.R- if (!inherits(gp, "gpar")) grob.R: stop("Invalid 'gp' slot") grob.R-} grob.R- grob.R-validDetails <- function(x) { Invalid 'grob' class grob.R- g <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'grob' class") grob.R- class(g) <- c(cl, "grob", "gDesc") grob.R- validGrob(g) grob.R-} grid.grob() is deprecated; please use grob() instead grob.R-} grob.R- grob.R-grid.grob <- function(list.struct, cl=NULL, draw=TRUE) { grob.R: warning("grid.grob() is deprecated; please use grob() instead") grob.R- g <- do.call("grob", c(list.struct, cl=cl)) grob.R- if (draw) grob.R- grid.draw(g) A 'grob' path must contain at least one 'grob' name grob.R-gPathFromVector <- function(names) { grob.R- n <- length(names) grob.R- if (n < 1) grob.R: stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R- stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else Invalid 'grob' name(s) grob.R- if (n < 1) grob.R- stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R: stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else grob.R- paste(names[1:(n-1)], collapse=.grid.pathSep), grob.R- name=names[n], Only 'grobs' allowed in 'gList' grob.R- class(gl) <- c("gList") grob.R- return(gl) grob.R- } else { grob.R: stop("Only 'grobs' allowed in 'gList'") grob.R- } grob.R-} grob.R- Invalid element to add to 'gList' grob.R- if (is.null(x)) grob.R- gList grob.R- else grob.R: stop("Invalid element to add to 'gList'") grob.R-} grob.R- grob.R-addToGList.grob <- function(x, gList) { Can only set 'children' for a 'gTree' grob.R- grob.R-setChildren <- function(x, children) { grob.R- if (!inherits(x, "gTree")) grob.R: stop("Can only set 'children' for a 'gTree'") grob.R- if (!is.null(children) && grob.R- !inherits(children, "gList")) grob.R- stop("'children' must be a 'gList'") 'children' must be a 'gList' grob.R- stop("Can only set 'children' for a 'gTree'") grob.R- if (!is.null(children) && grob.R- !inherits(children, "gList")) grob.R: stop("'children' must be a 'gList'") grob.R- # Thin out NULL children grob.R- if (!is.null(children)) { grob.R- cl <- class(children) It is only valid to get 'children' from a 'gTree' grob.R- grob.R-childNames <- function(gTree) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to get 'children' from a 'gTree'") grob.R- gTree$childrenOrder grob.R-} grob.R- Invalid 'gTree' class grob.R- gt <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'gTree' class") grob.R- class(gt) <- c(cl, "gTree", "grob", "gDesc") grob.R- gt <- validGrob(gt, childrenvp) grob.R- gt <- setChildren(gt, children) 'allDevices' not yet implemented grob.R-grid.get <- function(gPath, strict=FALSE, grep=FALSE, global=FALSE, grob.R- allDevices=FALSE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) Invalid 'gPath' grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (depth(gPath) == 1 && strict) { grob.R- gTree$children[[gPath$name]] grob.R- } else { -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) Invalid 'grep' value grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- getDLfromGPath(gPath, strict, grep, global) grob.R-} -- grob.R- gTree$children[[gPath$name]] grob.R- } else { grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- getGTree(gTree, NULL, gPath, strict, grep, global) grob.R- } -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- result <- setDLfromGPath(gPath, newGrob, strict, grep) grob.R- # result$index will be non-zero if matched the gPath -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1 && strict) { grob.R- # gPath must specify an existing child -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- addDLfromGPath(gPath, child, strict, grep, global, redraw) grob.R-} -- grob.R- if (!inherits(gTree, "gTree")) grob.R- stop("It is only valid to add a child to a 'gTree'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- addGTree(gTree, child, NULL, gPath, strict, grep, global) grob.R- } -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1) { grob.R- removeNameFromDL(gPath$name, strict, grep, global, warn, redraw) -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1) { grob.R- # result will be NULL if no match -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- specs <- list(...) grob.R- editDLfromGPath(gPath, specs, strict, grep, global, redraw) -- grob.R- if (!inherits(grob, "gTree")) grob.R- stop("It is only valid to edit a child of a 'gTree'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- editGTree(grob, specs, NULL, gPath, strict, grep, global) grob.R- } It is only valid to get a child from a 'gTree' grob.R-getGrob <- function(gTree, gPath, strict=FALSE, grob.R- grep=FALSE, global=FALSE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to get a child from a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) 'gPath' does not specify a valid child grob.R- if (redraw) grob.R- draw.all() grob.R- } else { grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R-} grob.R- -- grob.R- newGrob$name, gPath), domain = NA) grob.R- } grob.R- } else { grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R- } else { grob.R- gTree <- setGTree(gTree, NULL, gPath, newGrob, strict, grep) grob.R- if (is.null(gTree)) grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R- gTree grob.R-} It is only valid to set a child of a 'gTree' grob.R-# nor is it valid to specify a global destination (i.e., no global arg) grob.R-setGrob <- function(gTree, gPath, newGrob, strict=FALSE, grep=FALSE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to set a child of a 'gTree'") grob.R- if (!inherits(newGrob, "grob")) grob.R- stop("It is only valid to set a 'grob' as child of a 'gTree'") grob.R- if (is.character(gPath)) It is only valid to set a 'grob' as child of a 'gTree' grob.R- if (!inherits(gTree, "gTree")) grob.R- stop("It is only valid to set a child of a 'gTree'") grob.R- if (!inherits(newGrob, "grob")) grob.R: stop("It is only valid to set a 'grob' as child of a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) New 'grob' name (%s) does not match 'gPath' (%s) grob.R- if (match(gTree$childrenOrder[old.pos], newGrob$name, nomatch=FALSE)) { grob.R- gTree$children[[newGrob$name]] <- newGrob grob.R- } else { grob.R: stop(gettextf("New 'grob' name (%s) does not match 'gPath' (%s)", grob.R- newGrob$name, gPath), domain = NA) grob.R- } grob.R- } else { It is only valid to add a 'grob' to a 'gTree' grob.R-addGrob <- function(gTree, child, gPath=NULL, strict=FALSE, grob.R- grep=FALSE, global=FALSE) { grob.R- if (!inherits(child, "grob")) grob.R: stop("It is only valid to add a 'grob' to a 'gTree'") grob.R- if (is.null(gPath)) { grob.R- addToGTree(gTree, child) grob.R- } else { It is only valid to add a child to a 'gTree' grob.R- gPath <- gPathDirect(gPath) grob.R- # Only makes sense to specify a gPath for a gTree grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R-# Assume that child is a grob grob.R-addToGTree <- function(gTree, child) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- gTree$children[[child$name]] <- child grob.R- # Handle case where child name already exists (so will be overwritten) grob.R- if (old.pos <- match(child$name, gTree$childrenOrder, nomatch=0)) -- grob.R- NULL grob.R- else { grob.R- if (nameMatch(gPath$name, grob$name, grep)) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- else grob.R- NULL grob.R- } It is only valid to remove a child from a 'gTree' grob.R-removeGrob <- function(gTree, gPath, strict=FALSE, grob.R- grep=FALSE, global=FALSE, warn=TRUE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to remove a child from a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grob.R-removeFromGTree <- function(gTree, name, grep) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to remove a child from a 'gTree'") grob.R- if (grep) { grob.R- old.pos <- grep(name, gTree$childrenOrder) grob.R- if (length(old.pos) == 0) It is only valid to edit a child of a 'gTree' grob.R- gPath <- gPathDirect(gPath) grob.R- # Only makes sense to specify a gPath for a gTree grob.R- if (!inherits(grob, "gTree")) grob.R: stop("It is only valid to edit a child of a 'gTree'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) It is invalid to directly edit the 'children' or 'childrenOrder' slot grob.R-editDetails.gTree <- function(x, specs) { grob.R- # Disallow editing children or childrenOrder slots directly grob.R- if (any(match(specs, c("children", "childrenOrder"), nomatch=FALSE))) grob.R: stop("It is invalid to directly edit the 'children' or 'childrenOrder' slot") grob.R- x grob.R-} grob.R- Invalid 'result' grob.R-# Should only be when result is NULL grob.R-growResult.default <- function(result, x) { grob.R- if (!is.null(result)) grob.R: stop("Invalid 'result'") grob.R- x grob.R-} grob.R- The new 'grob' must have the same name as the old 'grob' grob.R- gTree$children[[newGrob$name]] <- newGrob grob.R- found <- TRUE grob.R- } else { grob.R: stop("The new 'grob' must have the same name as the old 'grob'") grob.R- } grob.R- } else { grob.R- if (is.null(pathsofar)) -- grob.R- if (match(grob$name, newGrob$name, nomatch=FALSE)) grob.R- newGrob grob.R- else grob.R: stop("The new 'grob' must have the same name as the old 'grob'") grob.R- else grob.R- if (strict) grob.R- NULL Slot '%s' not found grob.R- else grob.R- grob[[i]] <- specs[[i]] grob.R- else grob.R: warning(gettextf("Slot '%s' not found", i), domain = NA) grob.R- # Check grob slots are ok before trying to do anything with them grob.R- # in editDetails grob.R- # grob$childrenvp may be non-NULL for a gTree 'gPath' (%s) not found grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("'gPath' (%s) not found", as.character(gPath)), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} gPath (%s) not found grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} -- grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} -- grob.R- } grob.R- if (!found) { grob.R- if (warn) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- } else if (redraw) grob.R- draw.all() grob.R-} Grob '%s' not found grob.R- index <- index + 1 grob.R- } grob.R- if (is.null(result)) grob.R: stop(gettextf("Grob '%s' not found", name), domain = NA) grob.R- result grob.R-} grob.R- -- grob.R- index <- index + 1 grob.R- } grob.R- if (is.null(result)) grob.R: stop(gettextf("Grob '%s' not found", name), domain = NA) grob.R- result grob.R-} grob.R- Invalid element in the display list grob.R-grid.draw.default <- function(x, recording) { grob.R- # Allow for "holes" in the DL if a grob has been removed grob.R- if (!is.null(x)) grob.R: stop("Invalid element in the display list") grob.R-} grob.R- grob.R-grid.draw.viewport <- function(x, recording) { This function is redundant and will disappear in future versions. grob.R-} grob.R- grob.R-grid.copy <- function(grob) { grob.R: warning("This function is redundant and will disappear in future versions.") grob.R- grob grob.R-} grob.R- 'l' must be a layout highlevel.R- cell.label=TRUE, label.col="blue", highlevel.R- unit.col="red", vp=NULL) { highlevel.R- if (!is.layout(l)) highlevel.R: stop("'l' must be a layout") highlevel.R- if (newpage) highlevel.R- grid.newpage() highlevel.R- if (!is.null(vp)) 'pch' and 'labels' not the same length highlevel.R- labels <- as.character(labels) highlevel.R- nkeys <- length(labels) highlevel.R- if (length(pch) != nkeys) highlevel.R: stop("'pch' and 'labels' not the same length") highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) -- highlevel.R- labels <- as.character(labels) highlevel.R- nkeys <- length(labels) highlevel.R- if (length(pch) != nkeys) highlevel.R: stop("'pch' and 'labels' not the same length") highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) 'hgap' must be single unit highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) highlevel.R: stop("'hgap' must be single unit") highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) -- highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) highlevel.R: stop("'hgap' must be single unit") highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) 'vgap' must be single unit highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) highlevel.R: stop("'vgap' must be single unit") highlevel.R- gf <- grid.frame(layout=grid.layout(nkeys, 2), vp=vp, gp=gp, draw=FALSE) highlevel.R- for (i in 1:nkeys) { highlevel.R- if (i==1) { -- highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) highlevel.R: stop("'vgap' must be single unit") highlevel.R- legend.layout <- highlevel.R- grid.layout(nkeys, 3, highlevel.R- widths=unit.c(unit(2, "lines"), Invalid justification just.R- just <- as.integer(match(just[1], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (any(is.na(just))) just.R: stop("Invalid justification") just.R- } else if (length(just) > 1) { just.R- # first value must be one of "left", "right", "centre", or "center" just.R- just[1] <- as.integer(match(just[1], c("left", "right", "bottom", "top", -- just.R- switch(just[2] + 1, NA, NA, 0, 1, 0.5, 0.5)) just.R- # Final paranoid check just.R- if (any(is.na(just))) just.R: stop("Invalid justification") just.R- just just.R-} just.R- Invalid horizontal justification just.R- just[1] <- as.integer(match(just[1], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (!(just[1] %in% c(0, 1, 4, 5))) just.R: stop("Invalid horizontal justification") just.R- # second value must be one of "bottom", "top", "centre", or "center" just.R- just[2] <- as.integer(match(just[2], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) Invalid vertical justification just.R- just[2] <- as.integer(match(just[2], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (!(just[2] %in% c(2, 3, 4, 5))) just.R: stop("Invalid vertical justification") just.R- just <- as.integer(just) just.R- } just.R- # Extend to length 2 if necessary 'respect' must be logical or an 'nrow' by 'ncol' matrix layout.R- if (!is.logical(respect)) { layout.R- respect <- as.matrix(respect) layout.R- if (!is.matrix(respect) || any(dim(respect) != c(nrow, ncol))) layout.R: stop("'respect' must be logical or an 'nrow' by 'ncol' matrix") layout.R- } layout.R- if (is.matrix(respect)) { layout.R- respect.mat <- matrix(as.integer(respect), Invalid 'origin' origin.R- c("bottom.left", "top.left", origin.R- "bottom.right", "top.right")) - 1) origin.R- if (any(is.na(origin))) origin.R: stop("Invalid 'origin'") origin.R- origin origin.R-} origin.R- 'x' and 'y' must be units primitives.R-validDetails.move.to <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R- stop("'x' and 'y' must have length 1") -- primitives.R-validDetails.line.to <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R- stop("'x' and 'y' must have length 1") -- primitives.R-validDetails.lines <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- x primitives.R-} primitives.R- -- primitives.R-validDetails.arrows <- function(x) { primitives.R- if ((!is.null(x$x) && !is.unit(x$x)) || primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R: stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R- stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) -- primitives.R-validDetails.polygon <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R- stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) -- primitives.R- x$label <- as.character(x$label) primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- x$rot <- as.numeric(x$rot) primitives.R- if (!all(is.finite(x$rot)) || length(x$rot) == 0) primitives.R- stop("Invalid 'rot' value") 'x' and 'y' must have length 1 primitives.R- stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R: stop("'x' and 'y' must have length 1") primitives.R- x primitives.R-} primitives.R- -- primitives.R- stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R: stop("'x' and 'y' must have length 1") primitives.R- x primitives.R-} primitives.R- 'x0', 'y0', 'x1', and 'y1' must be units primitives.R-validDetails.segments <- function(x) { primitives.R- if (!is.unit(x$x0) || !is.unit(x$x1) || primitives.R- !is.unit(x$y0) || !is.unit(x$y1)) primitives.R: stop("'x0', 'y0', 'x1', and 'y1' must be units") primitives.R- x primitives.R-} primitives.R- 'x' and 'y' must be units or NULL primitives.R-validDetails.arrows <- function(x) { primitives.R- if ((!is.null(x$x) && !is.unit(x$x)) || primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R: stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R- stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) 'length' must be a unit object primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R- stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R: stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) primitives.R- x$type <- as.integer(match(x$type, c("open", "closed"))) primitives.R- if (any(is.na(x$ends)) || any(is.na(x$type))) Invalid 'ends' or 'type' argument primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) primitives.R- x$type <- as.integer(match(x$type, c("open", "closed"))) primitives.R- if (any(is.na(x$ends)) || any(is.na(x$type))) primitives.R: stop("Invalid 'ends' or 'type' argument") primitives.R- x primitives.R-} primitives.R- Corrupt 'arrows' object primitives.R-drawDetails.arrows <- function(x, recording=TRUE) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- # This could be done via method dispatch, but that really primitives.R- # seemed like overkill -- primitives.R-widthDetails.arrows <- function(x) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- widthDetails(lineThing) primitives.R- } else { -- primitives.R-heightDetails.arrows <- function(x) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- heightDetails(lineThing) primitives.R- } else { The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob primitives.R- if (!(inherits(grob, "lines") || primitives.R- inherits(grob, "segments") || primitives.R- inherits(grob, "line.to"))) primitives.R: stop("The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob") primitives.R- x <- y <- NULL primitives.R- } primitives.R- gTree(x=x, y=y, children=if (is.null(grob)) NULL else gList(grob), It is invalid to specify both 'id' and 'id.lengths primitives.R- !is.unit(x$y)) primitives.R- stop("'x' and 'y' must be units") primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R: stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) 'x' and 'y' must be same length primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R- stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R: stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) primitives.R- stop("'x' and 'y' and 'id' must all be same length") primitives.R- if (!is.null(x$id)) 'x' and 'y' and 'id' must all be same length primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) primitives.R: stop("'x' and 'y' and 'id' must all be same length") primitives.R- if (!is.null(x$id)) primitives.R- x$id <- as.integer(x$id) primitives.R- if (!is.null(x$id.lengths) && (sum(x$id.lengths) != unit.length(x$x))) 'x' and 'y' and 'id.lengths' must specify same overall length primitives.R- if (!is.null(x$id)) primitives.R- x$id <- as.integer(x$id) primitives.R- if (!is.null(x$id.lengths) && (sum(x$id.lengths) != unit.length(x$x))) primitives.R: stop("'x' and 'y' and 'id.lengths' must specify same overall length") primitives.R- if (!is.null(x$id.lengths)) primitives.R- x$id.lengths <- as.integer(x$id.lengths) primitives.R- x 'x', 'y', and 'r' must be units primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$r)) primitives.R: stop("'x', 'y', and 'r' must be units") primitives.R- x primitives.R-} primitives.R- 'x', 'y', 'width', and 'height' must be units primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$width) || primitives.R- !is.unit(x$height)) primitives.R: stop("'x', 'y', 'width', and 'height' must be units") primitives.R- valid.just(x$just) primitives.R- if (!is.null(x$hjust)) primitives.R- x$hjust <- as.numeric(x$hjust) Invalid 'rot' value primitives.R- stop("'x' and 'y' must be units") primitives.R- x$rot <- as.numeric(x$rot) primitives.R- if (!all(is.finite(x$rot)) || length(x$rot) == 0) primitives.R: stop("Invalid 'rot' value") primitives.R- valid.just(x$just) primitives.R- if (!is.null(x$hjust)) primitives.R- x$hjust <- as.numeric(x$hjust) zero-length 'pch' primitives.R-###################################### primitives.R-valid.pch <- function(pch) { primitives.R- if (length(pch) == 0) primitives.R: stop("zero-length 'pch'") primitives.R- if (is.null(pch)) primitives.R- pch <- as.integer(1) primitives.R- else if (!is.character(pch)) 'x', 'y' and 'size' must be units primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$size)) primitives.R: stop("'x', 'y' and 'size' must be units") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be unit objects and have the same length") primitives.R- x$pch <- valid.pch(x$pch) 'x' and 'y' must be unit objects and have the same length primitives.R- !is.unit(x$size)) primitives.R- stop("'x', 'y' and 'size' must be units") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R: stop("'x' and 'y' must be unit objects and have the same length") primitives.R- x$pch <- valid.pch(x$pch) primitives.R- x primitives.R-} 'x' must be numeric unit.R-# or 'unit(1, "grob", a.grob)' unit.R-unit <- function(x, units, data=NULL) { unit.R- if (!is.numeric(x)) unit.R: stop("'x' must be numeric") unit.R- units <- as.character(units) unit.R- if (length(x) == 0 || length(units) == 0) unit.R- stop("'x' and 'units' must have length > 0") 'x' and 'units' must have length > 0 unit.R- stop("'x' must be numeric") unit.R- units <- as.character(units) unit.R- if (length(x) == 0 || length(units) == 0) unit.R: stop("'x' and 'units' must have length > 0") unit.R- valid.unit(x, units, recycle.data(data, FALSE, length(x))) unit.R-} unit.R- 'x' argument must be a unit object unit.R- whatto <- match(axisTo, c("x", "y")) - 1 + unit.R- 2*(match(typeTo, c("location", "dimension")) - 1) unit.R- if (!is.unit(x)) unit.R: stop("'x' argument must be a unit object") unit.R- if (is.na(whatfrom) || is.na(whatto)) unit.R- stop("Invalid 'axis' or 'type'") unit.R- value <- grid.Call("L_convert", x, as.integer(whatfrom), Invalid 'axis' or 'type' unit.R- if (!is.unit(x)) unit.R- stop("'x' argument must be a unit object") unit.R- if (is.na(whatfrom) || is.na(whatto)) unit.R: stop("Invalid 'axis' or 'type'") unit.R- value <- grid.Call("L_convert", x, as.integer(whatfrom), unit.R- as.integer(whatto), valid.units(unitTo)) unit.R- if (!valueOnly) No string supplied for 'strwidth' unit unit.R- for (i in (1:n)[str.units]) unit.R- if (!(length(data) >= i && unit.R- (is.character(data[[i]]) || is.expression(data[[i]])))) unit.R: stop("No string supplied for 'strwidth' unit") unit.R- str.units <- (units == "strheight" | units == "mystrheight") unit.R- if (any(str.units != 0)) unit.R- for (i in (1:n)[str.units]) No string supplied for 'strheight' unit unit.R- for (i in (1:n)[str.units]) unit.R- if (!(length(data) >= i && unit.R- (is.character(data[[i]]) || is.expression(data[[i]])))) unit.R: stop("No string supplied for 'strheight' unit") unit.R- # Make sure that a grob has been specified unit.R- grob.units <- units == "grobwidth" unit.R- if (any(grob.units != 0)) No 'grob' supplied for 'grobwidth' unit unit.R- if (!(length(data) >= i && unit.R- (is.grob(data[[i]]) || inherits(data[[i]], "gPath") || unit.R- is.character(data[[i]])))) unit.R: stop("No 'grob' supplied for 'grobwidth' unit") unit.R- if (is.character(data[[i]])) unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) 'gPath' must have depth 1 in 'grobwidth/height' units unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) unit.R- if (depth(data[[i]]) > 1) unit.R: stop("'gPath' must have depth 1 in 'grobwidth/height' units") unit.R- } unit.R- grob.units <- units == "grobheight" unit.R- if (any(grob.units != 0)) -- unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) unit.R- if (depth(data[[i]]) > 1) unit.R: stop("'gPath' must have depth 1 in 'grobwidth/height' units") unit.R- } unit.R- data unit.R-} No 'grob' supplied for 'grobheight' unit unit.R- if (!(length(data) >= i && unit.R- (is.grob(data[[i]]) || inherits(data[[i]], "gPath") || unit.R- is.character(data[[i]])))) unit.R: stop("No 'grob' supplied for 'grobheight' unit") unit.R- if (is.character(data[[i]])) unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) Operator '%s' not meaningful for units unit.R-Ops.unit <- function(e1, e2) { unit.R- ok <- switch(.Generic, "+"=TRUE, "-"=TRUE, "*"=TRUE, FALSE) unit.R- if (!ok) unit.R: stop(gettextf("Operator '%s' not meaningful for units", .Generic), unit.R- domain = NA) unit.R- if (.Generic == "*") unit.R- # can only multiply a unit by a scalar Only one operand may be a unit unit.R- # can only multiply a unit by a scalar unit.R- if (nchar(.Method[1])) { unit.R- if (nchar(.Method[2])) unit.R: stop("Only one operand may be a unit") unit.R- else if (is.numeric(e2)) unit.R- # NOTE that we always put the scalar first unit.R- # Use as.numeric to force e2 to be REAL Non-unit operand must be numeric unit.R- # Use as.numeric to force e2 to be REAL unit.R- unit.arithmetic(.Generic, as.numeric(e2), e1) unit.R- else unit.R: stop("Non-unit operand must be numeric") unit.R- } else { unit.R- if (is.numeric(e1)) unit.R- # Use as.numeric to force e1 to be REAL unit.R- unit.arithmetic(.Generic, as.numeric(e1), e2) unit.R- else unit.R: stop("Non-unit operand must be numeric") unit.R- } unit.R- else unit.R- # Check that both arguments are units Both operands must be units unit.R- if (nchar(.Method[1]) && nchar(.Method[2])) unit.R- unit.arithmetic(.Generic, e1, e2) unit.R- else unit.R: stop("Both operands must be units") unit.R-} unit.R- unit.R-## <FIXME> 'Summary' function '%s' not meaningful for units unit.R- x <- unit.c(...) unit.R- ok <- switch(.Generic, "max"=TRUE, "min"=TRUE, "sum"=TRUE, FALSE) unit.R- if (!ok) unit.R: stop(gettextf("'Summary' function '%s' not meaningful for units", unit.R- .Generic), domain = NA) unit.R- unit.arithmetic(.Generic, x) unit.R-} Zero arguments where at least one expected unit.R- x <- list(...) unit.R- numargs <- length(x) unit.R- if (numargs == 0) unit.R: stop("Zero arguments where at least one expected") unit.R- # how long will the result be? unit.R- maxlength <- 0 unit.R- for (i in 1:numargs) -- unit.R- x <- list(...) unit.R- numargs <- length(x) unit.R- if (numargs == 0) unit.R: stop("Zero arguments where at least one expected") unit.R- # how long will the result be? unit.R- maxlength <- 0 unit.R- for (i in 1:numargs) Index out of bounds (unit subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit subsetting)") unit.R- cl <- class(x); unit.R- units <- attr(x, "unit") unit.R- valid.units <- attr(x, "valid.unit") Index out of bounds (unit arithmetic subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit arithmetic subsetting)") unit.R- switch(x$fname, unit.R- "+"="["(x$arg1, (index - 1) %% this.length + 1, top=FALSE) + unit.R- "["(x$arg2, (index - 1) %% this.length + 1, top=FALSE), Index out of bounds (unit list subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit list subsetting)") unit.R- cl <- class(x) unit.R- result <- unclass(x)[(index - 1) %% this.length + 1] unit.R- class(result) <- cl It is invalid to combine unit objects with other types unit.R- length(x[[i]]))) unit.R- } unit.R- else unit.R: stop("It is invalid to combine unit objects with other types") unit.R- unit(values, units, data=data) unit.R- } unit.R-} 'range' must be numeric util.R- util.R-grid.pretty <- function(range) { util.R- if (!is.numeric(range)) util.R: stop("'range' must be numeric") util.R- .Call("L_pretty", range, PACKAGE="grid") util.R-} util.R- 'x', 'y', 'width', and 'height' must all be units of length 1 viewport.R- name) { viewport.R- if (unit.length(x) > 1 || unit.length(y) > 1 || viewport.R- unit.length(width) > 1 || unit.length(height) > 1) viewport.R: stop("'x', 'y', 'width', and 'height' must all be units of length 1") viewport.R- if (!is.gpar(gp)) viewport.R- stop("Invalid graphics parameters") viewport.R- if (!is.logical(clip)) Invalid graphics parameters viewport.R- unit.length(width) > 1 || unit.length(height) > 1) viewport.R- stop("'x', 'y', 'width', and 'height' must all be units of length 1") viewport.R- if (!is.gpar(gp)) viewport.R: stop("Invalid graphics parameters") viewport.R- if (!is.logical(clip)) viewport.R- clip <- switch(as.character(clip), viewport.R- on=TRUE, Invalid 'clip' value viewport.R- on=TRUE, viewport.R- off=NA, viewport.R- inherit=FALSE, viewport.R: stop("Invalid 'clip' value")) viewport.R- if (!is.numeric(xscale) || length(xscale) != 2 || viewport.R- any(!is.finite(xscale))) viewport.R- stop("Invalid 'xscale' in viewport") Invalid 'xscale' in viewport viewport.R- stop("Invalid 'clip' value")) viewport.R- if (!is.numeric(xscale) || length(xscale) != 2 || viewport.R- any(!is.finite(xscale))) viewport.R: stop("Invalid 'xscale' in viewport") viewport.R- if (!is.numeric(yscale) || length(yscale) != 2 || viewport.R- any(!is.finite(yscale))) viewport.R- stop("Invalid 'yscale' in viewport") Invalid 'yscale' in viewport viewport.R- stop("Invalid 'xscale' in viewport") viewport.R- if (!is.numeric(yscale) || length(yscale) != 2 || viewport.R- any(!is.finite(yscale))) viewport.R: stop("Invalid 'yscale' in viewport") viewport.R- if (!is.numeric(angle) || length(angle) != 1 || viewport.R- !is.finite(angle)) viewport.R- stop("Invalid 'angle' in viewport") Invalid 'angle' in viewport viewport.R- stop("Invalid 'yscale' in viewport") viewport.R- if (!is.numeric(angle) || length(angle) != 1 || viewport.R- !is.finite(angle)) viewport.R: stop("Invalid 'angle' in viewport") viewport.R- if (!(is.null(layout) || is.layout(layout))) viewport.R- stop("Invalid 'layout' in viewport") viewport.R- if (!is.null(layout.pos.row)) { Invalid 'layout' in viewport viewport.R- !is.finite(angle)) viewport.R- stop("Invalid 'angle' in viewport") viewport.R- if (!(is.null(layout) || is.layout(layout))) viewport.R: stop("Invalid 'layout' in viewport") viewport.R- if (!is.null(layout.pos.row)) { viewport.R- layout.pos.row <- as.integer(range(layout.pos.row)) viewport.R- if (any(!is.finite(layout.pos.row))) Invalid 'layout.pos.row' in viewport viewport.R- if (!is.null(layout.pos.row)) { viewport.R- layout.pos.row <- as.integer(range(layout.pos.row)) viewport.R- if (any(!is.finite(layout.pos.row))) viewport.R: stop("Invalid 'layout.pos.row' in viewport") viewport.R- } viewport.R- if (!is.null(layout.pos.col)) { viewport.R- layout.pos.col <- as.integer(range(layout.pos.col)) Invalid 'layout.pos.col' in viewport viewport.R- if (!is.null(layout.pos.col)) { viewport.R- layout.pos.col <- as.integer(range(layout.pos.col)) viewport.R- if (any(!is.finite(layout.pos.col))) viewport.R: stop("Invalid 'layout.pos.col' in viewport") viewport.R- } viewport.R- # If name is NULL then we give it a default viewport.R- # Otherwise it should be a valid R name Only viewports allowed in 'vpList' viewport.R- class(vps) <- c("vpList", "viewport") viewport.R- vps viewport.R- } else { viewport.R: stop("Only viewports allowed in 'vpList'") viewport.R- } viewport.R-} viewport.R- Only viewports allowed in 'vpStack' viewport.R- class(vps) <- c("vpStack", "viewport") viewport.R- vps viewport.R- } else { viewport.R: stop("Only viewports allowed in 'vpStack'") viewport.R- } viewport.R-} viewport.R- 'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree' viewport.R- class(tree) <- c("vpTree", "viewport") viewport.R- tree viewport.R- } else { viewport.R: stop("'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree'") viewport.R- } viewport.R-} viewport.R- A viewport path must contain at least one viewport name viewport.R-vpPathFromVector <- function(names) { viewport.R- n <- length(names) viewport.R- if (n < 1) viewport.R: stop("A viewport path must contain at least one viewport name") viewport.R- if (!all(is.character(names))) viewport.R- stop("Invalid viewport name(s)") viewport.R- path <- list(path=if (n==1) NULL else Invalid viewport name(s) viewport.R- if (n < 1) viewport.R- stop("A viewport path must contain at least one viewport name") viewport.R- if (!all(is.character(names))) viewport.R: stop("Invalid viewport name(s)") viewport.R- path <- list(path=if (n==1) NULL else viewport.R- paste(names[1:(n-1)], collapse=.grid.pathSep), viewport.R- name=names[n], Must specify at least one of 'x' or 'xscale' viewport.R- extension <- rep(extension, length.out=2) viewport.R- if (is.null(xscale)) { viewport.R- if (is.null(xData)) viewport.R: stop("Must specify at least one of 'x' or 'xscale'") viewport.R- xscale <- range(xData) + c(-1, 1)*diff(range(xData))*extension[1] viewport.R- } viewport.R- if (is.null(yscale)) { Must specify at least one of 'y' or 'yscale' viewport.R- } viewport.R- if (is.null(yscale)) { viewport.R- if (is.null(yData)) viewport.R: stop("Must specify at least one of 'y' or 'yscale'") viewport.R- yscale <- range(yData) + c(-1, 1)*diff(range(yData))*extension[2] viewport.R- } viewport.R- viewport(xscale=xscale, yscale=yscale, ...)
タイムスタンプを変更しない
COLOR(blue){SIZE(18){R-grid.pot の和訳とチェックのページ}} 以下は R-grid.pot の素(粗)訳です.元ファイルと各メッセージのソース部分 を取り出したファイルを添付します.~ 舟尾 (第一稿 2005.03.27) #contents -implemented, unimplimented の訳が推奨となっている箇所が複数ありますが、「実装」もしくは「未実装」です。 -- &new{2005-03-27 (日) 17:05:37}; -「特定」も「指定」でしょうね -- &new{2005-03-27 (日) 17:09:50}; -間瀬先生,ソースの添付をありがとうございます.ソースと照合して訳を見直していきます.~ また,多数ご指摘いただきましてありがとうございます.ある程度時間がたった後に,訳に反映します. -- [[舟尾]] &new{2005-03-27 (日) 23:27:54}; -多数の貴重なご意見、本当にありがとうございました。私自身、かなり勉強させてもらいました!3/30付けで修正致しましたので、よろしくお願い致します。 -- [[舟尾]] &new{2005-03-30 (水) 23:09:23}; #comment msgid "" msgstr "" "Project-Id-Version: R 2.1.0\n" "Report-Msgid-Bugs-To: bugs@r-project.org\n" "POT-Creation-Date: 2005-03-08 07:39\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" * 1-20 msgid "Invalid 'at' location in 'axis'" msgstr "'axis'中の 'at' のロケーション(location)が不正です" msgid "Invalid to specify axis labels when 'at' is NULL" msgstr "'at' が NULL である場合,axis ラベルを特定するのは無効です" msgid "'labels' and 'at' locations must have same length" msgstr "'labels' と 'at' のロケーション(location)は同じ長さでなければなりません" msgid "Invalid 'edit' information" msgstr "不正な 'edit' 情報です" msgid "'gEditList' can only contain 'gEdit' objects" msgstr "'gEditList' には 'gEdit' オブジェクトしか含めることが出来ません" msgid "Invalid 'frame'" msgstr "不正な 'frame' です" msgid "Invalid 'grob'" msgstr "不正な 'grob' です" msgid "Invalid 'row' and/or 'col' (no such cell in frame layout)" msgstr "不正な 'row' かつ/または 'col' です(frame layout の中にそのようなセルは存在しません)" msgid "'col' can only be a range of existing columns" msgstr "'col' は存在する列の範囲しかとり得ません" msgid "Invalid 'col' specification" msgstr "不正な 'col' の指定です" msgid "'row' can only be a range of existing rows" msgstr "'row' は存在する行の範囲しかとり得ません" msgid "Invalid 'row' specification" msgstr "不正な 'row' の指定です" msgid "Cannot specify more than one of 'side=[\"left\", \"right\"]', 'col', 'col.before', or 'col.after'" msgstr "'side=[\"left\", \"right\"]', 'col', 'col.before', 'col.after' のうち 1 つ以上を特定することが出来ません" msgid "Must specify exactly one of 'side=[\"top\", \"bottom\"]', 'row', 'row.before', or 'row.after'" msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうち 1 つを正確に特定しなければいけません" msgid "gpar element '%s' must not be length 0" msgstr "gpar の要素 '%s' は長さ 0 にしてはいけません" msgid "'gamma' gpar is deprecated" msgstr "'gamma' gpar は廃止予定です" msgid "Invalid 'linemitre' value" msgstr "不正な 'linemitre' 値です" msgid "Invalid 'alpha' value" msgstr "不正な 'alpha' 値です" msgid "Must specify only one of 'font' and 'fontface'" msgstr "'font' または 'fontface' の 1 つのみを特定しなければいけません" msgid "Invalid font face" msgstr "不正なフォントの書体です" -"'labels' と 'at' のロケーション(location)は同じ長さでなければなりません" => "'labels' と、位置 'at' は同じ長さでなければなりません" -- &new{2005-03-27 (日) 20:53:27}; -msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうち 1 つを正確に特定しなければいけません" => msgstr "'side=[\"top\", \"bottom\"]', 'row', 'row.before', 'row.after' のうちちょうど一つを指定しなければいけません" -- &new{2005-03-27 (日) 20:55:12}; #comment * 21-40 msgid "Argument must be a 'gpar' object" msgstr "引数は 'gpar' オブジェクトでなければなりません" msgid "Must specify only valid 'gpar' names" msgstr "有効な 'gpar' の名前のみを特定しなければいけません" msgid "Invalid display list element" msgstr "不正なディスプレイリストの要素です" msgid "grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE')" msgstr "grob(s) が上書きされました(おそらく grab は信用できるものではありません; 'wrap=TRUE' を試してください)" msgid "viewport overwritten (grab MAY not be faithful)" msgstr "viewport が上書きされました(おそらく grab は信用できるものではありません)" msgid "grob pushed viewports and did not pop/up them (grab MAY not be faithful)" msgstr "grob が viewports に push され,viewports は pop/up されませんでした (おそらく grab は信用できるものではありません)" msgid "Only valid to push viewports" msgstr "viewports を push することだけが有効です" msgid "Must specify at least one viewport" msgstr "少なくとも 1 つの viewport を特定しなければいけません" msgid "Viewport '%s' was not found" msgstr "Viewport '%s' が見つかりません" msgid "Must pop at least one viewport" msgstr "少なくとも 1 つの viewport を pop しなければいけません" msgid "Must navigate up at least one viewport" msgstr "少なくとも 1 つの viewport を navigate up しなければいけません" msgid "The vp argument is deprecated" msgstr "引数 vp は廃止予定です" msgid "Invalid 'ask' value" msgstr "不正な 'ask' 値です" msgid "Invalid object inserted on the display list" msgstr "ディスプレイリスト上に不正なオブジェクトが挿入されました" msgid "Invalid 'vp' slot" msgstr "不正な 'vp' スロットです" msgid "Invalid 'gp' slot" msgstr "不正な 'gp' スロットです" msgid "Invalid 'grob' class" msgstr "不正な 'grob' クラスです" msgid "grid.grob() is deprecated; please use grob() instead" msgstr "grid.grob() は廃止予定です; 代わりに grob() を使って下さい" msgid "A 'grob' path must contain at least one 'grob' name" msgstr "'grob' のパスは少なくとも 1 つの 'grob' の名前を含んでいなければなりません" msgid "Invalid 'grob' name(s)" msgstr "不正な 'grob' の名前です" #comment * 41-60 msgid "Only 'grobs' allowed in 'gList'" msgstr "'grobs' は 'gList' 中でのみ許されます" msgid "Invalid element to add to 'gList'" msgstr "'gList' に不正な要素が加えられました" msgid "Can only set 'children' for a 'gTree'" msgstr "'gTree' には 'children' しかセットできません" msgid "'children' must be a 'gList'" msgstr "'children' は 'gList' でなければなりません" msgid "It is only valid to get 'children' from a 'gTree'" msgstr "'children' は 'gTree' からしか得ることが出来ません" msgid "Invalid 'gTree' class" msgstr "不正な 'gTree' クラスです" msgid "'allDevices' not yet implemented" msgstr "'allDevices' はまだ推奨されていません" msgid "Invalid 'gPath'" msgstr "不正な 'gPath' です" msgid "Invalid 'grep' value" msgstr "不正な 'grep' 値です" msgid "It is only valid to get a child from a 'gTree'" msgstr "child は 'gTree' からしか得ることが出来ません" msgid "'gPath' does not specify a valid child" msgstr "'gPath' は有効な child を特定することが出来ません" msgid "It is only valid to set a child of a 'gTree'" msgstr "'gTree' の child をセットすることだけが有効です" msgid "It is only valid to set a 'grob' as child of a 'gTree'" msgstr "'grob' を 'gTree' の child としてセットすることだけが有効です" msgid "New 'grob' name (%s) does not match 'gPath' (%s)" msgstr "新しい 'grob' 名(%s)は 'gPath'(%s) に合致しません" msgid "It is only valid to add a 'grob' to a 'gTree'" msgstr "'grob' を 'gTree' に加えることだけが有効です" msgid "It is only valid to add a child to a 'gTree'" msgstr "child を 'gTree' に加えることだけが有効です" msgid "It is only valid to remove a child from a 'gTree'" msgstr "child を 'gTree' から取り払うことだけが有効です" msgid "It is only valid to edit a child of a 'gTree'" msgstr "'gTree' の child を編集することだけが有効です" msgid "It is invalid to directly edit the 'children' or 'childrenOrder' slot" msgstr "'children' または 'childrenOrder' のスロットを直接編集することだけが有効です" msgid "Invalid 'result'" msgstr "不正な 'result' です" -"'children' または 'childrenOrder' のスロットを直接編集することだけが有効です" => "'children' または 'childrenOrder' スロットを直接編集してはいけません" -- &new{2005-03-27 (日) 16:54:21}; -"'gPath' は有効な child を特定することが出来ません" => "'gPath' は有効な child を指定していません" -- &new{2005-03-27 (日) 17:07:07}; -"'grobs' は 'gList' 中でのみ許されます" => "''gList' 中には 'grobs' のみが許されます" -- &new{2005-03-27 (日) 20:50:47}; #comment * 61-80 msgid "The new 'grob' must have the same name as the old 'grob'" msgstr "新しい 'grob' は古い 'grob' と同じ名前でなければなりません" msgid "Slot '%s' not found" msgstr "スロット '%s' が見つかりません" msgid "'gPath' (%s) not found" msgstr "'gPath'(%s) が見つかりません" msgid "gPath (%s) not found" msgstr "gPath(%s) が見つかりません" msgid "Grob '%s' not found" msgstr "Grob '%s' が見つかりません" msgid "Invalid element in the display list" msgstr "ディスプレイリストの中に不正な要素があります" msgid "This function is redundant and will disappear in future versions." msgstr "この関数は余分で,将来のバージョンの中で消えるでしょう" msgid "'l' must be a layout" msgstr "'l' は layout でなければなりません" msgid "'pch' and 'labels' not the same length" msgstr "'pch' と 'labels' は同じ長さでなければなりません" msgid "'hgap' must be single unit" msgstr "'hgap' は一つの単位(unit)でなければなりません" msgid "'vgap' must be single unit" msgstr "'vgap' は一つの単位(unit)でなければなりません" msgid "Invalid justification" msgstr "不正な正当化(justification)です ???????????" msgid "Invalid horizontal justification" msgstr "不正な水平の正当化(horizontal justification)です ???????????" msgid "Invalid vertical justification" msgstr "不正な垂直の正当化(horizontal justification)です ???????????" msgid "'respect' must be logical or an 'nrow' by 'ncol' matrix" msgstr "'respect' は論理値か 'ncol' 行列による 'nrow' でなければなりません" msgid "Invalid 'origin'" msgstr "不正な 'origin' です" msgid "'x' and 'y' must be units" msgstr "'x' と 'y' は単位(units)でなければなりません" msgid "'x' and 'y' must have length 1" msgstr "'x' と 'y' は長さ 1 でなければならない" msgid "'x0', 'y0', 'x1', and 'y1' must be units" msgstr "'x0', 'y0', 'x1', 'y1' は単位(units)でなければなりません" msgid "'x' and 'y' must be units or NULL" msgstr "'x' と 'y' は単位(units)または NULL でなければなりません" -justification とはテキスト(行)を見栄えのよい表示のために左右、上下に整列させる清書法のことです。空白の挿入も含むかも知れません。訳は「ジャスティフィケーション」もしくは「ジャスティファイする」でしょうか。 -- &new{2005-03-27 (日) 17:01:38}; -"'respect' は論理値か 'ncol' 行列による 'nrow' でなければなりません" => "'respect' は論理値か、 'ncol' x'nrow' 行列でなければなりません" -- &new{2005-03-27 (日) 17:03:47}; -ソースを見ると justification とは (何の?) right,left,top,bottom, および上下左右の center 指定のことのようですね。そうすると「位置決め指定が不正です」、「水平方向の位置決め指定が不正です」、「垂直方向の位置決め指定が不正です」とでも訳す? -- &new{2005-03-27 (日) 20:42:15}; -"この関数は余分で,将来のバージョンの中で消えるでしょう" => "この関数は余分で,将来無くなるでしょう" -- &new{2005-03-27 (日) 20:56:46}; -"'pch' と 'labels' は同じ長さでなければなりません" => "'pch' と 'labels' は同じ長さでありません" -- &new{2005-03-28 (月) 21:01:23}; -"'pch' と 'labels' は同じ長さでなければなりません" => "'pch' と 'labels' は同じ長さでありません" ですが,何回か書きましたが「が」と「は」は意味がまるっきり違うと思うのですが,それのように思うのは私だけでしょうか。繰り返しますが「は」は単なる事実の陳述,「が」も事実の陳述ではあるけれども,エラーメッセージのコンテクストから言えば,それは暗に間違いですよと言っているように思うんですけど。前にも書きましたけど,エラーメッセージとして「sqrt の引数は負です」と書かれると,確かに,sqrt(-4.321)なんて書いたならあ,負だな,間違えちゃったと思うけど,sqrt(x)って書いてあって,エラーメッセージで「引数は負です」といわれたら,あ,x が正だったかと思うのでは(例では平方根 sqrt だから誤解する方が悪いのだが,あまりよく知らない関数だと,事実として言われたのか,それが悪いと言われているのか区別が付かないのでは?)。それに対して,「引数が負です」と言われたら,あ,間違って負の値を渡しちゃったのかな??と,そういう反応になるのではないでしょうか。ま,丁寧に書けば,「指定された引数が負でした。引数は正でなければなりません。」ということでしょうね。エラーメッセージは,単に誤りの事実を知らせるのではなく,その間違いを正すにはどのように対処しなくてはならないかを明示する方がよい(そのようなエラーメッセージが優れたエラーメッセージ)ということは,よく知られた法則です。元のエラーメッセージに忠実に訳す必要はない(もとのエラーメッセージが優れたエラーメッセージである保証・証拠は何もない)ので,意訳でも良いから,ユーザの役に立つメッセージになれば良いのではないかと思います。 -- &new{2005-03-28 (月) 21:56:31}; -ご意見は基本的に賛成ですが、意訳が誤訳になっていないという確証がどれだけ持てるかということも考える必要があります。そうした自信が持てない場合は、できるだけ原文に忠実に訳すことも必要ではないでしょうか。実際のところ、一定程度の確度(ここの基準が微妙です)がない限り、むしろ原文のままにしておく方が良いのではとも感じています。ただし、現在はどういう訳が可能なのかを検討する場と思いますから、思いつきでも色んな意見が出る方が良いと思います。これは、R マニュアルの翻訳で散々意訳を行なった(そして後で赤面した)経験からの感想です。 -- [[間瀬茂]] &new{2005-03-28 (月) 23:00:06}; -意訳は某出版社のような「超訳」ではないですから,意訳=いい加減な訳ということではないでしょう。エラーメッセージの内容がちゃんとわかっているものについてはより分かりやすいエラーメッセージを付けましょうというようなことだと思います。本来は,英語版のエラーメッセージの改善を提案できるくらいの英語力があれば良いのですが。 -- &new{2005-03-28 (月) 23:24:55}; -"'pch' と 'labels' は同じ長さでなければなりません" => 指定された "'pch' と 'labels' の長さが違います." -- &new{2005-03-28 (月) 23:29:56}; #comment * 81-100 msgid "'length' must be a unit object" msgstr "'length' は単位(units)オブジェクトでなければなりません" msgid "Invalid 'ends' or 'type' argument" msgstr "不正な 'ends' 引数か 'type' 引数です" msgid "Corrupt 'arrows' object" msgstr "誤った 'arrows' オブジェクトです" msgid "The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob" msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のうち,いずれかの grob でなければなりません" msgid "It is invalid to specify both 'id' and 'id.lengths" msgstr "'id' と 'id.lengths' の両方を特定することは出来ません" msgid "'x' and 'y' must be same length" msgstr "'x' と 'y' は同じ長さでなければなりません" msgid "'x' and 'y' and 'id' must all be same length" msgstr "'x', 'y', 'id' は全て同じ長さでなければなりません" msgid "'x' and 'y' and 'id.lengths' must specify same overall length" msgstr "'x', 'y', 'id.lengths' は全て同じ長さを特定しなければなりません" msgid "'x', 'y', and 'r' must be units" msgstr "'x', 'y', 'r' は全て単位(units)でなければなりません" msgid "'x', 'y', 'width', and 'height' must be units" msgstr "'x', 'y', 'width', 'height' は全て単位(units)でなければなりません" msgid "Invalid 'rot' value" msgstr "不正な 'rot' 値でなければなりません" msgid "zero-length 'pch'" msgstr "長さ 0 の 'pch' です" msgid "'x', 'y' and 'size' must be units" msgstr "'x', 'y', 'size' は全て単位(units)でなければなりません" msgid "'x' and 'y' must be unit objects and have the same length" msgstr "'x' と 'y' は単位(units)でなければならず,同じ長さでなければなりません" msgid "'x' must be numeric" msgstr "'x' は数値でなければなりません" msgid "'x' and 'units' must have length > 0" msgstr "'x' と 'units' は 0 より大きい長さでなければなりません" msgid "'x' argument must be a unit object" msgstr "引数 'x' は単位(units)オブジェクトでなければなりません" msgid "Invalid 'axis' or 'type'" msgstr "不正な 'axis' か 'type' です" msgid "No string supplied for 'strwidth' unit" msgstr "'strwidth' 単位(units)を与える文字列がありません" msgid "No string supplied for 'strheight' unit" msgstr "'strheight' 単位(units)を与える文字列がありません" -"誤った 'arrows' オブジェクトです" => "混乱した 'arrows' オブジェクトです" corrupt は「腐敗した」という意味で、単なる間違いよりも強い、内容が支離滅裂というニュアンスではないでしょうか? -- &new{2005-03-28 (月) 19:38:53}; -msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のうち,いずれかの grob でなければなりません" => msgstr "'grob' 引数は 'line.to', 'lines', 'segments' のいずれかの grob でなければなりません" -- &new{2005-03-28 (月) 20:57:48}; -corrupt は,コンピュータ用語では〈プログラム・データが〉エラーのあるということで,端的な苺で言えば「壊れた」と言うような意味。壊れる原因は,コピーの誤りや,ダウンロード時の雑音など。したがって,確かに誤っているのではあるが,その原因は,指定ミスなどのようなものではない。しかし,そのようなことに目くじらを立てて訳してもしょうがない気はする。"Corrupt 'arrows' object" ということであるが,arrow object は壊れるけど,ほかのobject は壊れないのかのかどうか。たぶん,ないのだろうけど。複数人が書くプログラムのエラーメッセージの用語の統一などはあまり期待できない。自分一人で作っているプログラムでも(プログラムでなくても変数名の命名規則でも,ファイル名の命名規則でも)ずいぶん変異が多いというのは,経験済み。 -- &new{2005-03-28 (月) 23:41:43}; -"不正な 'rot' 値でなければなりません" → "不正な 'rot' 値です" -- &new{2005-03-28 (月) 23:46:58}; #comment * 101-120 msgid "No 'grob' supplied for 'grobwidth' unit" msgstr "'grobwidth' 単位(units)を与える 'grob' がありません" msgid "'gPath' must have depth 1 in 'grobwidth/height' units" msgstr "'gPath' は 'grobwidth/height' 単位(units)中では深さ 1 でなければなりません" msgid "No 'grob' supplied for 'grobheight' unit" msgstr "'grobheight' 単位(units)を与える 'grob' がありません" msgid "Operator '%s' not meaningful for units" msgstr "演算子 '%s' は単位(units)として意味をなしません" msgid "Only one operand may be a unit" msgstr "1 つのオペランド(operand)のみが単位(units)となります" msgid "Non-unit operand must be numeric" msgstr "単位ではないオペランド(operand)は数値でなければなりません" msgid "Both operands must be units" msgstr "オペランド(operand)は両方とも単位(units)でなければなりません" msgid "'Summary' function '%s' not meaningful for units" msgstr "'Summary' 関数 '%s' は単位(units)として意味をなしません" msgid "Zero arguments where at least one expected" msgstr "引数が 0 個ですが,少なくとも 1 つの引数が必要です" msgid "Index out of bounds (unit subsetting)" msgstr "添え字が範囲を超えています(単位(unit)の部分集合です??????????)" msgid "Index out of bounds (unit arithmetic subsetting)" msgstr "添え字が範囲を超えています(単位(unit)計算の部分集合です??????????)" msgid "Index out of bounds (unit list subsetting)" msgstr "添え字が範囲を超えています(単位(unit)リストの部分集合です??????????)" msgid "It is invalid to combine unit objects with other types" msgstr "単位(unit)オブジェクトとそれ以外の型のオブジェクトを結合することは出来ません" msgid "'range' must be numeric" msgstr "'range' は数値でなければなりません" msgid "'x', 'y', 'width', and 'height' must all be units of length 1" msgstr "'x', 'y', 'width', 'height' は全て長さ 1 の単位(units)でなければなりません" msgid "Invalid graphics parameters" msgstr "不正なグラフィックスパラメータです" msgid "Invalid 'clip' value" msgstr "viewport 中の 'clip' が不正です" msgid "Invalid 'xscale' in viewport" msgstr "viewport 中の 'xscale' が不正です" msgid "Invalid 'yscale' in viewport" msgstr "viewport 中の 'yscale' が不正です" msgid "Invalid 'angle' in viewport" msgstr "viewport 中の 'angle' が不正です" -"不正な 'rot' 値でなければなりません" => "不正な 'rot' 値です" -- &new{2005-03-27 (日) 20:02:58}; -"1 つのオペランド(operand)のみが単位(units)となります" => "一つのオペランド(operand)のみが単位(units)となれます"。operand は訳せば「被演算項」でしょうか。二項演算子等の引数のことだと思います。 -- &new{2005-03-27 (日) 20:08:43}; #comment * 121-140 msgid "Invalid 'layout' in viewport" msgstr "viewport 中の 'layout' が不正です" msgid "Invalid 'layout.pos.row' in viewport" msgstr "viewport 中の 'layout.pos.row' が不正です" msgid "Invalid 'layout.pos.col' in viewport" msgstr "viewport 中の 'layout.pos.col' が不正です" msgid "Only viewports allowed in 'vpList'" msgstr "viewports は 'vpList' 中でのみ許されます" msgid "Only viewports allowed in 'vpStack'" msgstr "viewports は 'vpStack' 中でのみ許されます" msgid "'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree'" msgstr "'parent' は viewport でなければならず,'children' は 'vpTree' 中の 'vpList' でなければなりません" msgid "A viewport path must contain at least one viewport name" msgstr "viewport のパスは少なくとも一つの viewport 名を含んでいる必要があります" msgid "Invalid viewport name(s)" msgstr "不正な viewport 名です" msgid "Must specify at least one of 'x' or 'xscale'" msgstr "'x' or 'xscale' のうち少なくとも一つを特定しなければなりません" msgid "Must specify at least one of 'y' or 'yscale'" msgstr "'y' か 'yscale' のうち少なくとも一つを特定しなければなりません" #comment * ソース Invalid 'at' location in 'axis' components.R- x$at <- as.numeric(x$at) components.R- if (length(x$at) < 1 || components.R- !is.finite(x$at)) components.R: stop("Invalid 'at' location in 'axis'") components.R- } components.R- if (!is.logical(x$label)) { components.R- # labels specified Invalid to specify axis labels when 'at' is NULL components.R- # labels specified components.R- # Can only spec labels if at is not NULL components.R- if (is.null(x$at)) components.R: stop("Invalid to specify axis labels when 'at' is NULL") components.R- # Must be either language object or string components.R- if (!is.language(x$label)) components.R- x$label <- as.character(x$label) 'labels' and 'at' locations must have same length components.R- x$label <- as.character(x$label) components.R- # Must be same number of labels as "at" locations components.R- if (length(x$label) != length(x$at)) components.R: stop("'labels' and 'at' locations must have same length") components.R- } components.R- x$main <- as.logical(x$main) components.R- x Invalid 'edit' information edit.R- x edit.R- } else { edit.R- if (!is.gEdit(edit)) edit.R: stop("Invalid 'edit' information") edit.R- # Intended to handle whether edit has gPath spec or not edit.R- newx <- do.call("editGrob", c(list(x), edit)) edit.R- # If edit was specified for non-existent child, newx will be NULL -- edit.R- applyEdit(x, edits) edit.R- else { edit.R- if (!inherits(edits, "gEditList")) edit.R: stop("Invalid 'edit' information") edit.R- for (i in edits) edit.R- x <- applyEdits(x, i) edit.R- x 'gEditList' can only contain 'gEdit' objects edit.R-gEditList <- function(...) { edit.R- edits <- list(...) edit.R- if (!all(sapply(edits, is.gEdit))) edit.R: stop("'gEditList' can only contain 'gEdit' objects") edit.R- class(edits) <- "gEditList" edit.R- edits edit.R-} Invalid 'frame' frames.R-placeGrob <- function(frame, grob, frames.R- row=NULL, col=NULL) { frames.R- if (!inherits(frame, "frame")) frames.R: stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R- stop("Invalid 'grob'") frames.R- dim <- frameDim(frame) -- frames.R- force.width=FALSE, force.height=FALSE, frames.R- border=NULL, dynamic=FALSE) { frames.R- if (!inherits(frame, "frame")) frames.R: stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R- stop("Invalid 'grob'") frames.R- # col/row can be given as a range, but I only want to know Invalid 'grob' frames.R- if (!inherits(frame, "frame")) frames.R- stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R: stop("Invalid 'grob'") frames.R- dim <- frameDim(frame) frames.R- if (is.null(row)) frames.R- row <- c(1, dim[1]) -- frames.R- if (!inherits(frame, "frame")) frames.R- stop("Invalid 'frame'") frames.R- if (!is.grob(grob)) frames.R: stop("Invalid 'grob'") frames.R- # col/row can be given as a range, but I only want to know frames.R- # about the min and max frames.R- if (!is.null(col) & length(col) > 1) { -- grob.R- g <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'grob' class") grob.R- class(g) <- c(cl, "grob", "gDesc") grob.R- validGrob(g) grob.R-} -- grob.R- if (n < 1) grob.R- stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R: stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else grob.R- paste(names[1:(n-1)], collapse=.grid.pathSep), grob.R- name=names[n], Invalid 'row' and/or 'col' (no such cell in frame layout) frames.R- col <- rep(col, 2) frames.R- if (min(row) < 1 || max(row) > dim[1] || frames.R- min(col) < 1 || max(col) > dim[2]) frames.R: stop("Invalid 'row' and/or 'col' (no such cell in frame layout)") frames.R- cgrob <- cellGrob(col, row, NULL, grob, FALSE, frames.R- cellViewport(col, row, NULL)) frames.R- addGrob(frame, cgrob) 'col' can only be a range of existing columns frames.R- # It is an error to specify a range for col which is outside 1..ncol frames.R- if (length(col) == 2) frames.R- if (col[1] < 1 || col[2] > ncol) frames.R: stop("'col' can only be a range of existing columns") frames.R- else frames.R- result <- FALSE frames.R- # It is also an error to specify a single col outside 1..ncol+1 Invalid 'col' specification frames.R- # It is also an error to specify a single col outside 1..ncol+1 frames.R- else frames.R- if (col < 1 || col > ncol + 1) frames.R: stop("Invalid 'col' specification") frames.R- else frames.R- result <- col == ncol+1 frames.R- } 'row' can only be a range of existing rows frames.R- # It is an error to specify a range for row which is outside 1..nrow frames.R- if (length(row) == 2) frames.R- if (row[1] < 1 || row[2] > nrow) frames.R: stop("'row' can only be a range of existing rows") frames.R- else frames.R- result <- FALSE frames.R- # It is also an error to specify a single row outside 1..nrow+1 Invalid 'row' specification frames.R- # It is also an error to specify a single row outside 1..nrow+1 frames.R- else frames.R- if (row < 1 || row > nrow + 1) frames.R: stop("Invalid 'row' specification") frames.R- else frames.R- result <- row == nrow+1 frames.R- } Cannot specify more than one of 'side=["left", "right"]', 'col', 'col.before', or 'col.after' Must specify exactly one of 'side=["top", "bottom"]', 'row', 'row.before', or 'row.after' gpar element '%s' must not be length 0 gpar.R- # Check a (non-NULL) gpar is not of length 0 gpar.R- check.length <- function(gparname) { gpar.R- if (length(gpars[[gparname]]) == 0) gpar.R: stop(gettextf("gpar element '%s' must not be length 0", gparname), gpar.R- domain = NA) gpar.R- } gpar.R- # Check a gpar is numeric and not NULL 'gamma' gpar is deprecated gpar.R- numnotnull("lex") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gpars)) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- numnotnull("gamma") gpar.R- numnotnull("alpha") gpar.R- # col and fill are converted in C code -- gpar.R- temp <- grid.Call("L_getGPar") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gp)) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- # Special case "cex" (make it cumulative) gpar.R- if (match("cex", names(gp), nomatch=0)) gpar.R- tempcex <- temp$cex * gp$cex -- gpar.R- stop("Must specify only valid 'gpar' names") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names) gpar.R: warning("'gamma' gpar is deprecated") gpar.R- result <- grid.Call("L_getGPar")[names] gpar.R- } gpar.R- class(result) <- "gpar" Invalid 'linemitre' value gpar.R- numnotnull("linemitre") gpar.R- if (!is.na(match("linemitre", names(gpars)))) { gpar.R- if (any(gpars$linemitre < 1)) gpar.R: stop("Invalid 'linemitre' value") gpar.R- } gpar.R- # alpha should be 0 to 1 gpar.R- if (!is.na(match("alpha", names(gpars)))) { Invalid 'alpha' value gpar.R- # alpha should be 0 to 1 gpar.R- if (!is.na(match("alpha", names(gpars)))) { gpar.R- if (any(gpars$alpha < 0 || gpars$alpha > 1)) gpar.R: stop("Invalid 'alpha' value") gpar.R- } gpar.R- # font should be integer and not NULL gpar.R- if (!is.na(match("font", names(gpars)))) { Must specify only one of 'font' and 'fontface' gpar.R- # Illegal to specify both font and fontface gpar.R- if (!is.na(match("fontface", names(gpars)))) { gpar.R- if (!is.na(match("font", names(gpars)))) gpar.R: stop("Must specify only one of 'font' and 'fontface'") gpar.R- if (is.null(gpars$fontface)) gpar.R- gpars$font <- NULL gpar.R- else { Invalid font face gpar.R- cyrillic=5, gpar.R- cyrillic.oblique=6, gpar.R- EUC=7, gpar.R: stop("Invalid font face")) gpar.R- gpars$font <- as.integer(temp.num) gpar.R- } gpar.R- } Argument must be a 'gpar' object gpar.R- gpar.R-set.gpar <- function(gp) { gpar.R- if (!is.gpar(gp)) gpar.R: stop("Argument must be a 'gpar' object") gpar.R- temp <- grid.Call("L_getGPar") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names(gp)) Must specify only valid 'gpar' names gpar.R- else { gpar.R- if (!is.character(names) || gpar.R- !all(names %in% .grid.gpar.names)) gpar.R: stop("Must specify only valid 'gpar' names") gpar.R- # gamma deprecated gpar.R- if ("gamma" %in% names) gpar.R- warning("'gamma' gpar is deprecated") Invalid display list element grab.R- grab.R-wrap.default <- function(x) { grab.R- if (!is.null(x)) grab.R: stop("Invalid display list element") grab.R- NULL grab.R-} grab.R- grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE') grab.R- names <- getNames() grab.R- # Check for overwriting existing grob grab.R- if (length(unique(names)) != length(names)) grab.R: warning("grob(s) overwritten (grab WILL not be faithful; try 'wrap=TRUE')") grab.R- } grab.R- grid.newpage(recording=FALSE) grab.R- # Start at 2 because first element is viewport[ROOT] viewport overwritten (grab MAY not be faithful) grab.R- # with existing viewport name grab.R- if (inherits(tempvp, "viewport") && grab.R- vpExists(tempvp)) grab.R: warning("viewport overwritten (grab MAY not be faithful)") grab.R- } grab.R- if (!is.null(tempvp)) grab.R- tempdepth <- depth(tempvp) -- grab.R- # Check to see if about to push a viewport grab.R- # with existing viewport name grab.R- if (vpExists(elt)) grab.R: warning("viewport overwritten (grab MAY not be faithful)") grab.R- grid.draw(elt, recording=FALSE) grab.R- ########### grab.R- # grabPop grob pushed viewports and did not pop/up them (grab MAY not be faithful) grab.R- pathSame = FALSE grab.R- } grab.R- if (!pathSame) grab.R: warning("grob pushed viewports and did not pop/up them (grab MAY not be faithful)") grab.R- } grab.R- elt$vp <- drawPath grab.R- if (!is.null(tempvp)) Only valid to push viewports grid.R-} grid.R- grid.R-push.vp.default <- function(vp, recording) { grid.R: stop("Only valid to push viewports") grid.R-} grid.R- grid.R-push.vp.viewport <- function(vp, recording) { Must specify at least one viewport grid.R- grid.R-pushViewport <- function(..., recording=TRUE) { grid.R- if (missing(...)) grid.R: stop("Must specify at least one viewport") grid.R- else { grid.R- vps <- list(...) grid.R- lapply(vps, push.vp, recording) Viewport '%s' was not found grid.R- record(name) grid.R- } grid.R- } else { grid.R: stop(gettextf("Viewport '%s' was not found", as.character(name)), grid.R- domain = NA) grid.R- } grid.R- invisible(result) Must pop at least one viewport grid.R- grid.R-popViewport <- function(n=1, recording=TRUE) { grid.R- if (n < 0) grid.R: stop("Must pop at least one viewport") grid.R- if (n == 0) grid.R- n <- vpDepth() grid.R- if (n > 0) { Must navigate up at least one viewport grid.R-# simply navigate up, leaving pushed viewports in place. grid.R-upViewport <- function(n=1, recording=TRUE) { grid.R- if (n < 0) grid.R: stop("Must navigate up at least one viewport") grid.R- if (n == 0) { grid.R- n <- vpDepth() grid.R- upPath <- current.vpPath() The vp argument is deprecated grid.R- # ever see normal viewports, so convert. grid.R- vpFromPushedvp(grid.Call("L_currentViewport")) grid.R- else { grid.R: warning("The vp argument is deprecated") grid.R- vp grid.R- } grid.R-} Invalid 'ask' value grid.R- old.prompt <- .Call("L_getAsk") grid.R- if (!missing(ask)) { grid.R- if (!is.logical(ask)) grid.R: stop("Invalid 'ask' value") grid.R- .Call("L_setAsk", ask) grid.R- } grid.R- old.prompt Invalid object inserted on the display list grid.R-# gets put on the display list grid.R-record.default <- function(x) { grid.R- if (!is.numeric(x)) grid.R: stop("Invalid object inserted on the display list") grid.R- grid.Call("L_setDLelt", x) grid.R- inc.display.list() grid.R-} Invalid 'vp' slot grob.R- if (!inherits(vp, "viewport") && grob.R- !inherits(vp, "vpPath") && grob.R- !is.character(vp)) grob.R: stop("Invalid 'vp' slot") grob.R- # For interactive use, allow user to specify grob.R- # vpPath directly (i.e., w/o calling vpPath) grob.R- if (is.character(vp)) Invalid 'gp' slot grob.R- # gp must be a gpar grob.R- if (!is.null(gp)) grob.R- if (!inherits(gp, "gpar")) grob.R: stop("Invalid 'gp' slot") grob.R-} grob.R- grob.R-validDetails <- function(x) { Invalid 'grob' class grob.R- g <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'grob' class") grob.R- class(g) <- c(cl, "grob", "gDesc") grob.R- validGrob(g) grob.R-} grid.grob() is deprecated; please use grob() instead grob.R-} grob.R- grob.R-grid.grob <- function(list.struct, cl=NULL, draw=TRUE) { grob.R: warning("grid.grob() is deprecated; please use grob() instead") grob.R- g <- do.call("grob", c(list.struct, cl=cl)) grob.R- if (draw) grob.R- grid.draw(g) A 'grob' path must contain at least one 'grob' name grob.R-gPathFromVector <- function(names) { grob.R- n <- length(names) grob.R- if (n < 1) grob.R: stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R- stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else Invalid 'grob' name(s) grob.R- if (n < 1) grob.R- stop("A 'grob' path must contain at least one 'grob' name") grob.R- if (!all(is.character(names))) grob.R: stop("Invalid 'grob' name(s)") grob.R- path <- list(path=if (n==1) NULL else grob.R- paste(names[1:(n-1)], collapse=.grid.pathSep), grob.R- name=names[n], Only 'grobs' allowed in 'gList' grob.R- class(gl) <- c("gList") grob.R- return(gl) grob.R- } else { grob.R: stop("Only 'grobs' allowed in 'gList'") grob.R- } grob.R-} grob.R- Invalid element to add to 'gList' grob.R- if (is.null(x)) grob.R- gList grob.R- else grob.R: stop("Invalid element to add to 'gList'") grob.R-} grob.R- grob.R-addToGList.grob <- function(x, gList) { Can only set 'children' for a 'gTree' grob.R- grob.R-setChildren <- function(x, children) { grob.R- if (!inherits(x, "gTree")) grob.R: stop("Can only set 'children' for a 'gTree'") grob.R- if (!is.null(children) && grob.R- !inherits(children, "gList")) grob.R- stop("'children' must be a 'gList'") 'children' must be a 'gList' grob.R- stop("Can only set 'children' for a 'gTree'") grob.R- if (!is.null(children) && grob.R- !inherits(children, "gList")) grob.R: stop("'children' must be a 'gList'") grob.R- # Thin out NULL children grob.R- if (!is.null(children)) { grob.R- cl <- class(children) It is only valid to get 'children' from a 'gTree' grob.R- grob.R-childNames <- function(gTree) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to get 'children' from a 'gTree'") grob.R- gTree$childrenOrder grob.R-} grob.R- Invalid 'gTree' class grob.R- gt <- list(..., name=name, gp=gp, vp=vp) grob.R- if (!is.null(cl) && grob.R- !is.character(cl)) grob.R: stop("Invalid 'gTree' class") grob.R- class(gt) <- c(cl, "gTree", "grob", "gDesc") grob.R- gt <- validGrob(gt, childrenvp) grob.R- gt <- setChildren(gt, children) 'allDevices' not yet implemented grob.R-grid.get <- function(gPath, strict=FALSE, grep=FALSE, global=FALSE, grob.R- allDevices=FALSE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grep=FALSE, global=FALSE, allDevices=FALSE, grob.R- redraw=TRUE) { grob.R- if (allDevices) grob.R: stop("'allDevices' not yet implemented") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) Invalid 'gPath' grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (depth(gPath) == 1 && strict) { grob.R- gTree$children[[gPath$name]] grob.R- } else { -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) grob.R: stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) Invalid 'grep' value grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- getDLfromGPath(gPath, strict, grep, global) grob.R-} -- grob.R- gTree$children[[gPath$name]] grob.R- } else { grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- getGTree(gTree, NULL, gPath, strict, grep, global) grob.R- } -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- result <- setDLfromGPath(gPath, newGrob, strict, grep) grob.R- # result$index will be non-zero if matched the gPath -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1 && strict) { grob.R- # gPath must specify an existing child -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- addDLfromGPath(gPath, child, strict, grep, global, redraw) grob.R-} -- grob.R- if (!inherits(gTree, "gTree")) grob.R- stop("It is only valid to add a child to a 'gTree'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- addGTree(gTree, child, NULL, gPath, strict, grep, global) grob.R- } -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1) { grob.R- removeNameFromDL(gPath$name, strict, grep, global, warn, redraw) -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- if (depth(gPath) == 1) { grob.R- # result will be NULL if no match -- grob.R- if (!inherits(gPath, "gPath")) grob.R- stop("Invalid 'gPath'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- specs <- list(...) grob.R- editDLfromGPath(gPath, specs, strict, grep, global, redraw) -- grob.R- if (!inherits(grob, "gTree")) grob.R- stop("It is only valid to edit a child of a 'gTree'") grob.R- if (!is.logical(grep)) grob.R: stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) grob.R- editGTree(grob, specs, NULL, gPath, strict, grep, global) grob.R- } It is only valid to get a child from a 'gTree' grob.R-getGrob <- function(gTree, gPath, strict=FALSE, grob.R- grep=FALSE, global=FALSE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to get a child from a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) 'gPath' does not specify a valid child grob.R- if (redraw) grob.R- draw.all() grob.R- } else { grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R-} grob.R- -- grob.R- newGrob$name, gPath), domain = NA) grob.R- } grob.R- } else { grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R- } else { grob.R- gTree <- setGTree(gTree, NULL, gPath, newGrob, strict, grep) grob.R- if (is.null(gTree)) grob.R: stop("'gPath' does not specify a valid child") grob.R- } grob.R- gTree grob.R-} It is only valid to set a child of a 'gTree' grob.R-# nor is it valid to specify a global destination (i.e., no global arg) grob.R-setGrob <- function(gTree, gPath, newGrob, strict=FALSE, grep=FALSE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to set a child of a 'gTree'") grob.R- if (!inherits(newGrob, "grob")) grob.R- stop("It is only valid to set a 'grob' as child of a 'gTree'") grob.R- if (is.character(gPath)) It is only valid to set a 'grob' as child of a 'gTree' grob.R- if (!inherits(gTree, "gTree")) grob.R- stop("It is only valid to set a child of a 'gTree'") grob.R- if (!inherits(newGrob, "grob")) grob.R: stop("It is only valid to set a 'grob' as child of a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) New 'grob' name (%s) does not match 'gPath' (%s) grob.R- if (match(gTree$childrenOrder[old.pos], newGrob$name, nomatch=FALSE)) { grob.R- gTree$children[[newGrob$name]] <- newGrob grob.R- } else { grob.R: stop(gettextf("New 'grob' name (%s) does not match 'gPath' (%s)", grob.R- newGrob$name, gPath), domain = NA) grob.R- } grob.R- } else { It is only valid to add a 'grob' to a 'gTree' grob.R-addGrob <- function(gTree, child, gPath=NULL, strict=FALSE, grob.R- grep=FALSE, global=FALSE) { grob.R- if (!inherits(child, "grob")) grob.R: stop("It is only valid to add a 'grob' to a 'gTree'") grob.R- if (is.null(gPath)) { grob.R- addToGTree(gTree, child) grob.R- } else { It is only valid to add a child to a 'gTree' grob.R- gPath <- gPathDirect(gPath) grob.R- # Only makes sense to specify a gPath for a gTree grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) -- grob.R-# Assume that child is a grob grob.R-addToGTree <- function(gTree, child) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- gTree$children[[child$name]] <- child grob.R- # Handle case where child name already exists (so will be overwritten) grob.R- if (old.pos <- match(child$name, gTree$childrenOrder, nomatch=0)) -- grob.R- NULL grob.R- else { grob.R- if (nameMatch(gPath$name, grob$name, grep)) grob.R: stop("It is only valid to add a child to a 'gTree'") grob.R- else grob.R- NULL grob.R- } It is only valid to remove a child from a 'gTree' grob.R-removeGrob <- function(gTree, gPath, strict=FALSE, grob.R- grep=FALSE, global=FALSE, warn=TRUE) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to remove a child from a 'gTree'") grob.R- if (is.character(gPath)) grob.R- gPath <- gPathDirect(gPath) grob.R- if (!inherits(gPath, "gPath")) -- grob.R- grob.R-removeFromGTree <- function(gTree, name, grep) { grob.R- if (!inherits(gTree, "gTree")) grob.R: stop("It is only valid to remove a child from a 'gTree'") grob.R- if (grep) { grob.R- old.pos <- grep(name, gTree$childrenOrder) grob.R- if (length(old.pos) == 0) It is only valid to edit a child of a 'gTree' grob.R- gPath <- gPathDirect(gPath) grob.R- # Only makes sense to specify a gPath for a gTree grob.R- if (!inherits(grob, "gTree")) grob.R: stop("It is only valid to edit a child of a 'gTree'") grob.R- if (!is.logical(grep)) grob.R- stop("Invalid 'grep' value") grob.R- grep <- rep(grep, length=depth(gPath)) It is invalid to directly edit the 'children' or 'childrenOrder' slot grob.R-editDetails.gTree <- function(x, specs) { grob.R- # Disallow editing children or childrenOrder slots directly grob.R- if (any(match(specs, c("children", "childrenOrder"), nomatch=FALSE))) grob.R: stop("It is invalid to directly edit the 'children' or 'childrenOrder' slot") grob.R- x grob.R-} grob.R- Invalid 'result' grob.R-# Should only be when result is NULL grob.R-growResult.default <- function(result, x) { grob.R- if (!is.null(result)) grob.R: stop("Invalid 'result'") grob.R- x grob.R-} grob.R- The new 'grob' must have the same name as the old 'grob' grob.R- gTree$children[[newGrob$name]] <- newGrob grob.R- found <- TRUE grob.R- } else { grob.R: stop("The new 'grob' must have the same name as the old 'grob'") grob.R- } grob.R- } else { grob.R- if (is.null(pathsofar)) -- grob.R- if (match(grob$name, newGrob$name, nomatch=FALSE)) grob.R- newGrob grob.R- else grob.R: stop("The new 'grob' must have the same name as the old 'grob'") grob.R- else grob.R- if (strict) grob.R- NULL Slot '%s' not found grob.R- else grob.R- grob[[i]] <- specs[[i]] grob.R- else grob.R: warning(gettextf("Slot '%s' not found", i), domain = NA) grob.R- # Check grob slots are ok before trying to do anything with them grob.R- # in editDetails grob.R- # grob$childrenvp may be non-NULL for a gTree 'gPath' (%s) not found grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("'gPath' (%s) not found", as.character(gPath)), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} gPath (%s) not found grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} -- grob.R- index <- index + 1 grob.R- } grob.R- if (!found) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- else if (redraw) grob.R- draw.all() grob.R-} -- grob.R- } grob.R- if (!found) { grob.R- if (warn) grob.R: stop(gettextf("gPath (%s) not found", gPath), domain = NA) grob.R- } else if (redraw) grob.R- draw.all() grob.R-} Grob '%s' not found grob.R- index <- index + 1 grob.R- } grob.R- if (is.null(result)) grob.R: stop(gettextf("Grob '%s' not found", name), domain = NA) grob.R- result grob.R-} grob.R- -- grob.R- index <- index + 1 grob.R- } grob.R- if (is.null(result)) grob.R: stop(gettextf("Grob '%s' not found", name), domain = NA) grob.R- result grob.R-} grob.R- Invalid element in the display list grob.R-grid.draw.default <- function(x, recording) { grob.R- # Allow for "holes" in the DL if a grob has been removed grob.R- if (!is.null(x)) grob.R: stop("Invalid element in the display list") grob.R-} grob.R- grob.R-grid.draw.viewport <- function(x, recording) { This function is redundant and will disappear in future versions. grob.R-} grob.R- grob.R-grid.copy <- function(grob) { grob.R: warning("This function is redundant and will disappear in future versions.") grob.R- grob grob.R-} grob.R- 'l' must be a layout highlevel.R- cell.label=TRUE, label.col="blue", highlevel.R- unit.col="red", vp=NULL) { highlevel.R- if (!is.layout(l)) highlevel.R: stop("'l' must be a layout") highlevel.R- if (newpage) highlevel.R- grid.newpage() highlevel.R- if (!is.null(vp)) 'pch' and 'labels' not the same length highlevel.R- labels <- as.character(labels) highlevel.R- nkeys <- length(labels) highlevel.R- if (length(pch) != nkeys) highlevel.R: stop("'pch' and 'labels' not the same length") highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) -- highlevel.R- labels <- as.character(labels) highlevel.R- nkeys <- length(labels) highlevel.R- if (length(pch) != nkeys) highlevel.R: stop("'pch' and 'labels' not the same length") highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) 'hgap' must be single unit highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) highlevel.R: stop("'hgap' must be single unit") highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) -- highlevel.R- if (!is.unit(hgap)) highlevel.R- hgap <- unit(hgap, default.units) highlevel.R- if (length(hgap) != 1) highlevel.R: stop("'hgap' must be single unit") highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) 'vgap' must be single unit highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) highlevel.R: stop("'vgap' must be single unit") highlevel.R- gf <- grid.frame(layout=grid.layout(nkeys, 2), vp=vp, gp=gp, draw=FALSE) highlevel.R- for (i in 1:nkeys) { highlevel.R- if (i==1) { -- highlevel.R- if (!is.unit(vgap)) highlevel.R- vgap <- unit(vgap, default.units) highlevel.R- if (length(vgap) != 1) highlevel.R: stop("'vgap' must be single unit") highlevel.R- legend.layout <- highlevel.R- grid.layout(nkeys, 3, highlevel.R- widths=unit.c(unit(2, "lines"), Invalid justification just.R- just <- as.integer(match(just[1], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (any(is.na(just))) just.R: stop("Invalid justification") just.R- } else if (length(just) > 1) { just.R- # first value must be one of "left", "right", "centre", or "center" just.R- just[1] <- as.integer(match(just[1], c("left", "right", "bottom", "top", -- just.R- switch(just[2] + 1, NA, NA, 0, 1, 0.5, 0.5)) just.R- # Final paranoid check just.R- if (any(is.na(just))) just.R: stop("Invalid justification") just.R- just just.R-} just.R- Invalid horizontal justification just.R- just[1] <- as.integer(match(just[1], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (!(just[1] %in% c(0, 1, 4, 5))) just.R: stop("Invalid horizontal justification") just.R- # second value must be one of "bottom", "top", "centre", or "center" just.R- just[2] <- as.integer(match(just[2], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) Invalid vertical justification just.R- just[2] <- as.integer(match(just[2], c("left", "right", "bottom", "top", just.R- "centre", "center")) - 1) just.R- if (!(just[2] %in% c(2, 3, 4, 5))) just.R: stop("Invalid vertical justification") just.R- just <- as.integer(just) just.R- } just.R- # Extend to length 2 if necessary 'respect' must be logical or an 'nrow' by 'ncol' matrix layout.R- if (!is.logical(respect)) { layout.R- respect <- as.matrix(respect) layout.R- if (!is.matrix(respect) || any(dim(respect) != c(nrow, ncol))) layout.R: stop("'respect' must be logical or an 'nrow' by 'ncol' matrix") layout.R- } layout.R- if (is.matrix(respect)) { layout.R- respect.mat <- matrix(as.integer(respect), Invalid 'origin' origin.R- c("bottom.left", "top.left", origin.R- "bottom.right", "top.right")) - 1) origin.R- if (any(is.na(origin))) origin.R: stop("Invalid 'origin'") origin.R- origin origin.R-} origin.R- 'x' and 'y' must be units primitives.R-validDetails.move.to <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R- stop("'x' and 'y' must have length 1") -- primitives.R-validDetails.line.to <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R- stop("'x' and 'y' must have length 1") -- primitives.R-validDetails.lines <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- x primitives.R-} primitives.R- -- primitives.R-validDetails.arrows <- function(x) { primitives.R- if ((!is.null(x$x) && !is.unit(x$x)) || primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R: stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R- stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) -- primitives.R-validDetails.polygon <- function(x) { primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R- stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) -- primitives.R- x$label <- as.character(x$label) primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y)) primitives.R: stop("'x' and 'y' must be units") primitives.R- x$rot <- as.numeric(x$rot) primitives.R- if (!all(is.finite(x$rot)) || length(x$rot) == 0) primitives.R- stop("Invalid 'rot' value") 'x' and 'y' must have length 1 primitives.R- stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R: stop("'x' and 'y' must have length 1") primitives.R- x primitives.R-} primitives.R- -- primitives.R- stop("'x' and 'y' must be units") primitives.R- # Make sure that x and y are of length 1 primitives.R- if (unit.length(x$x) > 1 | unit.length(x$y) > 1) primitives.R: stop("'x' and 'y' must have length 1") primitives.R- x primitives.R-} primitives.R- 'x0', 'y0', 'x1', and 'y1' must be units primitives.R-validDetails.segments <- function(x) { primitives.R- if (!is.unit(x$x0) || !is.unit(x$x1) || primitives.R- !is.unit(x$y0) || !is.unit(x$y1)) primitives.R: stop("'x0', 'y0', 'x1', and 'y1' must be units") primitives.R- x primitives.R-} primitives.R- 'x' and 'y' must be units or NULL primitives.R-validDetails.arrows <- function(x) { primitives.R- if ((!is.null(x$x) && !is.unit(x$x)) || primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R: stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R- stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) 'length' must be a unit object primitives.R- (!is.null(x$y) && !is.unit(x$y))) primitives.R- stop("'x' and 'y' must be units or NULL") primitives.R- if (!is.unit(x$length)) primitives.R: stop("'length' must be a unit object") primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) primitives.R- x$type <- as.integer(match(x$type, c("open", "closed"))) primitives.R- if (any(is.na(x$ends)) || any(is.na(x$type))) Invalid 'ends' or 'type' argument primitives.R- x$ends <- as.integer(match(x$ends, c("first", "last", "both"))) primitives.R- x$type <- as.integer(match(x$type, c("open", "closed"))) primitives.R- if (any(is.na(x$ends)) || any(is.na(x$type))) primitives.R: stop("Invalid 'ends' or 'type' argument") primitives.R- x primitives.R-} primitives.R- Corrupt 'arrows' object primitives.R-drawDetails.arrows <- function(x, recording=TRUE) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- # This could be done via method dispatch, but that really primitives.R- # seemed like overkill -- primitives.R-widthDetails.arrows <- function(x) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- widthDetails(lineThing) primitives.R- } else { -- primitives.R-heightDetails.arrows <- function(x) { primitives.R- if (is.null(x$x)) { # y should be null too primitives.R- if (!is.null(x$y)) primitives.R: stop("Corrupt 'arrows' object") primitives.R- lineThing <- getGrob(x, childNames(x)) primitives.R- heightDetails(lineThing) primitives.R- } else { The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob primitives.R- if (!(inherits(grob, "lines") || primitives.R- inherits(grob, "segments") || primitives.R- inherits(grob, "line.to"))) primitives.R: stop("The 'grob' argument must be a 'line.to', 'lines', or 'segments' grob") primitives.R- x <- y <- NULL primitives.R- } primitives.R- gTree(x=x, y=y, children=if (is.null(grob)) NULL else gList(grob), It is invalid to specify both 'id' and 'id.lengths primitives.R- !is.unit(x$y)) primitives.R- stop("'x' and 'y' must be units") primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R: stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) 'x' and 'y' must be same length primitives.R- if (!is.null(x$id) && !is.null(x$id.lengths)) primitives.R- stop("It is invalid to specify both 'id' and 'id.lengths") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R: stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) primitives.R- stop("'x' and 'y' and 'id' must all be same length") primitives.R- if (!is.null(x$id)) 'x' and 'y' and 'id' must all be same length primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be same length") primitives.R- if (!is.null(x$id) && (length(x$id) != unit.length(x$x))) primitives.R: stop("'x' and 'y' and 'id' must all be same length") primitives.R- if (!is.null(x$id)) primitives.R- x$id <- as.integer(x$id) primitives.R- if (!is.null(x$id.lengths) && (sum(x$id.lengths) != unit.length(x$x))) 'x' and 'y' and 'id.lengths' must specify same overall length primitives.R- if (!is.null(x$id)) primitives.R- x$id <- as.integer(x$id) primitives.R- if (!is.null(x$id.lengths) && (sum(x$id.lengths) != unit.length(x$x))) primitives.R: stop("'x' and 'y' and 'id.lengths' must specify same overall length") primitives.R- if (!is.null(x$id.lengths)) primitives.R- x$id.lengths <- as.integer(x$id.lengths) primitives.R- x 'x', 'y', and 'r' must be units primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$r)) primitives.R: stop("'x', 'y', and 'r' must be units") primitives.R- x primitives.R-} primitives.R- 'x', 'y', 'width', and 'height' must be units primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$width) || primitives.R- !is.unit(x$height)) primitives.R: stop("'x', 'y', 'width', and 'height' must be units") primitives.R- valid.just(x$just) primitives.R- if (!is.null(x$hjust)) primitives.R- x$hjust <- as.numeric(x$hjust) Invalid 'rot' value primitives.R- stop("'x' and 'y' must be units") primitives.R- x$rot <- as.numeric(x$rot) primitives.R- if (!all(is.finite(x$rot)) || length(x$rot) == 0) primitives.R: stop("Invalid 'rot' value") primitives.R- valid.just(x$just) primitives.R- if (!is.null(x$hjust)) primitives.R- x$hjust <- as.numeric(x$hjust) zero-length 'pch' primitives.R-###################################### primitives.R-valid.pch <- function(pch) { primitives.R- if (length(pch) == 0) primitives.R: stop("zero-length 'pch'") primitives.R- if (is.null(pch)) primitives.R- pch <- as.integer(1) primitives.R- else if (!is.character(pch)) 'x', 'y' and 'size' must be units primitives.R- if (!is.unit(x$x) || primitives.R- !is.unit(x$y) || primitives.R- !is.unit(x$size)) primitives.R: stop("'x', 'y' and 'size' must be units") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R- stop("'x' and 'y' must be unit objects and have the same length") primitives.R- x$pch <- valid.pch(x$pch) 'x' and 'y' must be unit objects and have the same length primitives.R- !is.unit(x$size)) primitives.R- stop("'x', 'y' and 'size' must be units") primitives.R- if (unit.length(x$x) != unit.length(x$y)) primitives.R: stop("'x' and 'y' must be unit objects and have the same length") primitives.R- x$pch <- valid.pch(x$pch) primitives.R- x primitives.R-} 'x' must be numeric unit.R-# or 'unit(1, "grob", a.grob)' unit.R-unit <- function(x, units, data=NULL) { unit.R- if (!is.numeric(x)) unit.R: stop("'x' must be numeric") unit.R- units <- as.character(units) unit.R- if (length(x) == 0 || length(units) == 0) unit.R- stop("'x' and 'units' must have length > 0") 'x' and 'units' must have length > 0 unit.R- stop("'x' must be numeric") unit.R- units <- as.character(units) unit.R- if (length(x) == 0 || length(units) == 0) unit.R: stop("'x' and 'units' must have length > 0") unit.R- valid.unit(x, units, recycle.data(data, FALSE, length(x))) unit.R-} unit.R- 'x' argument must be a unit object unit.R- whatto <- match(axisTo, c("x", "y")) - 1 + unit.R- 2*(match(typeTo, c("location", "dimension")) - 1) unit.R- if (!is.unit(x)) unit.R: stop("'x' argument must be a unit object") unit.R- if (is.na(whatfrom) || is.na(whatto)) unit.R- stop("Invalid 'axis' or 'type'") unit.R- value <- grid.Call("L_convert", x, as.integer(whatfrom), Invalid 'axis' or 'type' unit.R- if (!is.unit(x)) unit.R- stop("'x' argument must be a unit object") unit.R- if (is.na(whatfrom) || is.na(whatto)) unit.R: stop("Invalid 'axis' or 'type'") unit.R- value <- grid.Call("L_convert", x, as.integer(whatfrom), unit.R- as.integer(whatto), valid.units(unitTo)) unit.R- if (!valueOnly) No string supplied for 'strwidth' unit unit.R- for (i in (1:n)[str.units]) unit.R- if (!(length(data) >= i && unit.R- (is.character(data[[i]]) || is.expression(data[[i]])))) unit.R: stop("No string supplied for 'strwidth' unit") unit.R- str.units <- (units == "strheight" | units == "mystrheight") unit.R- if (any(str.units != 0)) unit.R- for (i in (1:n)[str.units]) No string supplied for 'strheight' unit unit.R- for (i in (1:n)[str.units]) unit.R- if (!(length(data) >= i && unit.R- (is.character(data[[i]]) || is.expression(data[[i]])))) unit.R: stop("No string supplied for 'strheight' unit") unit.R- # Make sure that a grob has been specified unit.R- grob.units <- units == "grobwidth" unit.R- if (any(grob.units != 0)) No 'grob' supplied for 'grobwidth' unit unit.R- if (!(length(data) >= i && unit.R- (is.grob(data[[i]]) || inherits(data[[i]], "gPath") || unit.R- is.character(data[[i]])))) unit.R: stop("No 'grob' supplied for 'grobwidth' unit") unit.R- if (is.character(data[[i]])) unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) 'gPath' must have depth 1 in 'grobwidth/height' units unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) unit.R- if (depth(data[[i]]) > 1) unit.R: stop("'gPath' must have depth 1 in 'grobwidth/height' units") unit.R- } unit.R- grob.units <- units == "grobheight" unit.R- if (any(grob.units != 0)) -- unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) unit.R- if (depth(data[[i]]) > 1) unit.R: stop("'gPath' must have depth 1 in 'grobwidth/height' units") unit.R- } unit.R- data unit.R-} No 'grob' supplied for 'grobheight' unit unit.R- if (!(length(data) >= i && unit.R- (is.grob(data[[i]]) || inherits(data[[i]], "gPath") || unit.R- is.character(data[[i]])))) unit.R: stop("No 'grob' supplied for 'grobheight' unit") unit.R- if (is.character(data[[i]])) unit.R- data[[i]] <- gPathDirect(data[[i]]) unit.R- if (inherits(data[[i]], "gPath")) Operator '%s' not meaningful for units unit.R-Ops.unit <- function(e1, e2) { unit.R- ok <- switch(.Generic, "+"=TRUE, "-"=TRUE, "*"=TRUE, FALSE) unit.R- if (!ok) unit.R: stop(gettextf("Operator '%s' not meaningful for units", .Generic), unit.R- domain = NA) unit.R- if (.Generic == "*") unit.R- # can only multiply a unit by a scalar Only one operand may be a unit unit.R- # can only multiply a unit by a scalar unit.R- if (nchar(.Method[1])) { unit.R- if (nchar(.Method[2])) unit.R: stop("Only one operand may be a unit") unit.R- else if (is.numeric(e2)) unit.R- # NOTE that we always put the scalar first unit.R- # Use as.numeric to force e2 to be REAL Non-unit operand must be numeric unit.R- # Use as.numeric to force e2 to be REAL unit.R- unit.arithmetic(.Generic, as.numeric(e2), e1) unit.R- else unit.R: stop("Non-unit operand must be numeric") unit.R- } else { unit.R- if (is.numeric(e1)) unit.R- # Use as.numeric to force e1 to be REAL unit.R- unit.arithmetic(.Generic, as.numeric(e1), e2) unit.R- else unit.R: stop("Non-unit operand must be numeric") unit.R- } unit.R- else unit.R- # Check that both arguments are units Both operands must be units unit.R- if (nchar(.Method[1]) && nchar(.Method[2])) unit.R- unit.arithmetic(.Generic, e1, e2) unit.R- else unit.R: stop("Both operands must be units") unit.R-} unit.R- unit.R-## <FIXME> 'Summary' function '%s' not meaningful for units unit.R- x <- unit.c(...) unit.R- ok <- switch(.Generic, "max"=TRUE, "min"=TRUE, "sum"=TRUE, FALSE) unit.R- if (!ok) unit.R: stop(gettextf("'Summary' function '%s' not meaningful for units", unit.R- .Generic), domain = NA) unit.R- unit.arithmetic(.Generic, x) unit.R-} Zero arguments where at least one expected unit.R- x <- list(...) unit.R- numargs <- length(x) unit.R- if (numargs == 0) unit.R: stop("Zero arguments where at least one expected") unit.R- # how long will the result be? unit.R- maxlength <- 0 unit.R- for (i in 1:numargs) -- unit.R- x <- list(...) unit.R- numargs <- length(x) unit.R- if (numargs == 0) unit.R: stop("Zero arguments where at least one expected") unit.R- # how long will the result be? unit.R- maxlength <- 0 unit.R- for (i in 1:numargs) Index out of bounds (unit subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit subsetting)") unit.R- cl <- class(x); unit.R- units <- attr(x, "unit") unit.R- valid.units <- attr(x, "valid.unit") Index out of bounds (unit arithmetic subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit arithmetic subsetting)") unit.R- switch(x$fname, unit.R- "+"="["(x$arg1, (index - 1) %% this.length + 1, top=FALSE) + unit.R- "["(x$arg2, (index - 1) %% this.length + 1, top=FALSE), Index out of bounds (unit list subsetting) unit.R- if (is.logical(index)) unit.R- index <- (1:this.length)[index] unit.R- if (top && index > this.length) unit.R: stop("Index out of bounds (unit list subsetting)") unit.R- cl <- class(x) unit.R- result <- unclass(x)[(index - 1) %% this.length + 1] unit.R- class(result) <- cl It is invalid to combine unit objects with other types unit.R- length(x[[i]]))) unit.R- } unit.R- else unit.R: stop("It is invalid to combine unit objects with other types") unit.R- unit(values, units, data=data) unit.R- } unit.R-} 'range' must be numeric util.R- util.R-grid.pretty <- function(range) { util.R- if (!is.numeric(range)) util.R: stop("'range' must be numeric") util.R- .Call("L_pretty", range, PACKAGE="grid") util.R-} util.R- 'x', 'y', 'width', and 'height' must all be units of length 1 viewport.R- name) { viewport.R- if (unit.length(x) > 1 || unit.length(y) > 1 || viewport.R- unit.length(width) > 1 || unit.length(height) > 1) viewport.R: stop("'x', 'y', 'width', and 'height' must all be units of length 1") viewport.R- if (!is.gpar(gp)) viewport.R- stop("Invalid graphics parameters") viewport.R- if (!is.logical(clip)) Invalid graphics parameters viewport.R- unit.length(width) > 1 || unit.length(height) > 1) viewport.R- stop("'x', 'y', 'width', and 'height' must all be units of length 1") viewport.R- if (!is.gpar(gp)) viewport.R: stop("Invalid graphics parameters") viewport.R- if (!is.logical(clip)) viewport.R- clip <- switch(as.character(clip), viewport.R- on=TRUE, Invalid 'clip' value viewport.R- on=TRUE, viewport.R- off=NA, viewport.R- inherit=FALSE, viewport.R: stop("Invalid 'clip' value")) viewport.R- if (!is.numeric(xscale) || length(xscale) != 2 || viewport.R- any(!is.finite(xscale))) viewport.R- stop("Invalid 'xscale' in viewport") Invalid 'xscale' in viewport viewport.R- stop("Invalid 'clip' value")) viewport.R- if (!is.numeric(xscale) || length(xscale) != 2 || viewport.R- any(!is.finite(xscale))) viewport.R: stop("Invalid 'xscale' in viewport") viewport.R- if (!is.numeric(yscale) || length(yscale) != 2 || viewport.R- any(!is.finite(yscale))) viewport.R- stop("Invalid 'yscale' in viewport") Invalid 'yscale' in viewport viewport.R- stop("Invalid 'xscale' in viewport") viewport.R- if (!is.numeric(yscale) || length(yscale) != 2 || viewport.R- any(!is.finite(yscale))) viewport.R: stop("Invalid 'yscale' in viewport") viewport.R- if (!is.numeric(angle) || length(angle) != 1 || viewport.R- !is.finite(angle)) viewport.R- stop("Invalid 'angle' in viewport") Invalid 'angle' in viewport viewport.R- stop("Invalid 'yscale' in viewport") viewport.R- if (!is.numeric(angle) || length(angle) != 1 || viewport.R- !is.finite(angle)) viewport.R: stop("Invalid 'angle' in viewport") viewport.R- if (!(is.null(layout) || is.layout(layout))) viewport.R- stop("Invalid 'layout' in viewport") viewport.R- if (!is.null(layout.pos.row)) { Invalid 'layout' in viewport viewport.R- !is.finite(angle)) viewport.R- stop("Invalid 'angle' in viewport") viewport.R- if (!(is.null(layout) || is.layout(layout))) viewport.R: stop("Invalid 'layout' in viewport") viewport.R- if (!is.null(layout.pos.row)) { viewport.R- layout.pos.row <- as.integer(range(layout.pos.row)) viewport.R- if (any(!is.finite(layout.pos.row))) Invalid 'layout.pos.row' in viewport viewport.R- if (!is.null(layout.pos.row)) { viewport.R- layout.pos.row <- as.integer(range(layout.pos.row)) viewport.R- if (any(!is.finite(layout.pos.row))) viewport.R: stop("Invalid 'layout.pos.row' in viewport") viewport.R- } viewport.R- if (!is.null(layout.pos.col)) { viewport.R- layout.pos.col <- as.integer(range(layout.pos.col)) Invalid 'layout.pos.col' in viewport viewport.R- if (!is.null(layout.pos.col)) { viewport.R- layout.pos.col <- as.integer(range(layout.pos.col)) viewport.R- if (any(!is.finite(layout.pos.col))) viewport.R: stop("Invalid 'layout.pos.col' in viewport") viewport.R- } viewport.R- # If name is NULL then we give it a default viewport.R- # Otherwise it should be a valid R name Only viewports allowed in 'vpList' viewport.R- class(vps) <- c("vpList", "viewport") viewport.R- vps viewport.R- } else { viewport.R: stop("Only viewports allowed in 'vpList'") viewport.R- } viewport.R-} viewport.R- Only viewports allowed in 'vpStack' viewport.R- class(vps) <- c("vpStack", "viewport") viewport.R- vps viewport.R- } else { viewport.R: stop("Only viewports allowed in 'vpStack'") viewport.R- } viewport.R-} viewport.R- 'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree' viewport.R- class(tree) <- c("vpTree", "viewport") viewport.R- tree viewport.R- } else { viewport.R: stop("'parent' must be a viewport and 'children' must be a 'vpList' in 'vpTree'") viewport.R- } viewport.R-} viewport.R- A viewport path must contain at least one viewport name viewport.R-vpPathFromVector <- function(names) { viewport.R- n <- length(names) viewport.R- if (n < 1) viewport.R: stop("A viewport path must contain at least one viewport name") viewport.R- if (!all(is.character(names))) viewport.R- stop("Invalid viewport name(s)") viewport.R- path <- list(path=if (n==1) NULL else Invalid viewport name(s) viewport.R- if (n < 1) viewport.R- stop("A viewport path must contain at least one viewport name") viewport.R- if (!all(is.character(names))) viewport.R: stop("Invalid viewport name(s)") viewport.R- path <- list(path=if (n==1) NULL else viewport.R- paste(names[1:(n-1)], collapse=.grid.pathSep), viewport.R- name=names[n], Must specify at least one of 'x' or 'xscale' viewport.R- extension <- rep(extension, length.out=2) viewport.R- if (is.null(xscale)) { viewport.R- if (is.null(xData)) viewport.R: stop("Must specify at least one of 'x' or 'xscale'") viewport.R- xscale <- range(xData) + c(-1, 1)*diff(range(xData))*extension[1] viewport.R- } viewport.R- if (is.null(yscale)) { Must specify at least one of 'y' or 'yscale' viewport.R- } viewport.R- if (is.null(yscale)) { viewport.R- if (is.null(yData)) viewport.R: stop("Must specify at least one of 'y' or 'yscale'") viewport.R- yscale <- range(yData) + c(-1, 1)*diff(range(yData))*extension[2] viewport.R- } viewport.R- viewport(xscale=xscale, yscale=yscale, ...)
テキスト整形のルールを表示する
添付ファイル:
R-grid_050330.pot
1002件
[
詳細
]
R-grid.pot
1129件
[
詳細
]