Re: [R] Concatenation and Evaluation

From: John Erb-Downward <>
Date: Mon, 4 Feb 2008 13:24:19 -0500

Thank you, thank you both! get() is exactly what I needed. I apologize for not putting in reproducible code. I'm not very good at this and was more worried that I would create problems that didn't exist (and the files I'm working with are too big). Again, thank you.


On Feb 4, 2008, at 11:50 AM, Bert Gunter wrote: ?get (maybe)

If this isn't it and you do not receive satisfactory replies, see the Posting Guide for how to post a question with reproducible code so that readers can understand what you mean (as opposed to me being the only one
who doesn't understand you).

On Feb 4, 2008, at 11:53 AM, <> <> wrote:

I think you need get. see ?get. i'm no
expert or i would give more specific info.

get takes something quoted and makes it an object.

Hello all,

   I've run into what I bet is a silly problem; however, I've been trying to get around it now for a couple weeks and every time I think I have the answer it still doesn't work. So I apologize in advance if this is painfully obvious, but I've run out of ideas and would really appreciate any input.

My situation is this, I'm importing a number of tab delimited text files that contain chromatogram data that I am trying to display adjacent to a dendrogram. Since I look at multiple files I import them as file1, file2, file3, etc. To display them in the order that comes from the dendrogram I want to use order.dendrogram, which gives me a vector of numbers that is the order which I want the chomatograms to be displayed.

Here's the problem: I want to be able to set up a loop in which use "file" as the base name then concatenate the number that follows after it as the value at order.dendrogram[i] in a plot function. So something like:

assume there is a dendrogram called peak.dend



I know that this particular plot function won't work, but for the purposes of this assume that it would if I just put in the number as opposed to ord[i]. But when I try this I get an error that "file" does not exist.

So I thought that the problem was concatenation. My solution was to use the paste function:

  [1] 13 14 17 18 7 8 1 2 3 4 15 16 5 6 23 24 19 20 9 10 11 12 21 22
[1] "file13"

But when I try to plot this it won't work. "Ah ha!" I thought, "it's the quotes."

so I try to unquote it:

[1] file13

Yes! But it still won't plot. For some reason the statement file13 is not getting evaluated. If I type in exactly plot(file13) it works. If I explicitly store file13 in z

it works.

But if I I do the following:


it will not plot (specifically it tells me that x and y are lengths differ which tells me that it's not evaluating the result of z, just inputting it as is).

I've naively tried eval(z), but I get the same result.

So I know this is a stupid problem and as soon as somebody tells me the answer I'm going to smack my head and say "Duh!", but right now I don't even know what terms to search for. Thanks in advance for any help.

-John mailing list PLEASE do read the posting guide guide.html
and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 04 Feb 2008 - 18:29:39 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 04 Feb 2008 - 18:30:12 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive