[R] extracting rows and columns from a big matrix

Sarah Goslee sarah.goslee at gmail.com
Tue Jul 17 00:27:40 CEST 2012


Put the code in a text file in your working directory.

Within R,

source("mycode.txt")

or whatever you called it. If someone suggests a command you don't
know, reading the help, eg
?source
is always a good idea.

If you are copying and pasting very long commands, you may overflow
the clipboard buffer or R terminal buffer, and your code won't be
pasted correctly. Several of us have suggested that's what might be
happening and offered alternatives.

Sarah

On Mon, Jul 16, 2012 at 6:14 PM, A J <anxusgo at hotmail.com> wrote:
> Hi everybody.
>
>
> I didn't write the code because of it is very long one, but I have decided
> to enclose it in a text file. It is divided in:
>
>
> 1) the whole code that doesn't work
>
>
> 2) Seven parts which code was splited in and working
>
>
> I am using R 64-bits release running on Windows 7. Sure, I was
> copy-and-pasting code and executing all operations using Notepad++. Besides,
> I am newbie using R and I am employing R Studio to develop this tests. I am
> not sure what are you meaning when you recommend me source(). Are you saying
> regarding R or text editor? I have read something about problems with
> encoding and for this reason I have save the file in UTF-8 as well. I gues
> this is a problem related to length of code line because when I have divided
> the whole code into several parts, some of them didn't work till I shortened
> them.
>
>
> Sorry so much for all inconveniences.
>
>
> AJ
>
>
>> Date: Mon, 16 Jul 2012 15:26:27 -0400
>> From: sarah.goslee at gmail.com
>> To: r-help at r-project.org
>> Subject: Re: [R] extracting rows and columns from a big matrix
>>
>> Hi,
>>
>> Did you follow up on Bill's suggestion?
>>
>> >> -----Original Message-----
>> >> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
>> >> project.org] On Behalf Of William Dunlap
>> >> Sent: Monday, July 16, 2012 10:39 AM
>> >> To: A J; smartpink111 at yahoo.com
>> >> Cc: r-help at r-project.org
>> >> Subject: Re: [R] extracting rows and columns from a big matrix
>> >>
>> >> Did you ever show the code that caused the problem?
>> >> In particular, was it one very long line of code? It is possible
>> >> that copying and pasting a long line into R might cause problems,
>> >> but the details would depend on which OS you are using and
>> >> which user interface you are using. The "+" prompt means
>> >> that R did not see the end of an expression, typically because
>> >> of an unmatched quotation mark or left parenthesis.
>> >>
>> >> Of course, the whole line might have been entered and there
>> >> may have been a missing ")" or "'" in it, but no one can tell
>> >> without seeing the code.
>>
>>
>> My guess is he's absolutely right, and you are copy-and-pasting
>> instead of using source(), but you do not ever say, as far as I can
>> tell in the large number of mostly-repetitive messages.
>>
>> Save your very long command into a text file, preferably with an
>> editor that does syntax highlighting and parenthesis matching, use
>> source(), and let us know if it works.
>>
>> Sarah
>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list