[R] number of items to replace is not a multiple of replacement length

Ivan Calandra ivan.calandra at uni-hamburg.de
Mon Nov 1 13:42:28 CET 2010


Hi,

I think you _*should*_ provide more:
- the objects you have, such as parameterList and blaah: copy the output 
from dput(object) in your next e-mail
- the _*relevant*_ code for how you've built them

I guess you will get more and better answers if you give a clear and 
complete description of your problem.

Ivan

Le 11/1/2010 12:55, Mipam Bruining a écrit :
> Hey all,
>
> I am writing a function in which I will have a matrix of 4 columns and a
> variable amount of rows.
> The first to columns will always contain be of the Character type, the third
> and fourth columns
> can be a variation of data types, usually characters and integers, but
> sometimes lists or matrices.
>
> At one point the code makes, for each row, a copy of that row, then it makes
> some adjustments
> to the values in the third column, and then it overwrites the original
> matrix row with the copy. It is here
> that I get the error from my subject title, "number of items to replace is
> not a multiple of replacement length".
> This is strange because the items to replace in this instance seem to me and
> should be an exact copy of the
> replacement, save that the number 0 in this particular instance is to be
> replaced with the number 58.
>
> If I print the variables in question I get this: (added some tabs to allign
> the columns for readability)
>
>> print(parameterList[aCounter, 3])
> [[1]]
>                                        [,1]
>                   [,2]           [,3]    [,4]
> exampleSingleSelect   "Insert single selection box title here"
> "SingleSelect"  1    List,3
> exampleSlider             "Insert slider bar title here"
> "Slider"        0   List,2
>
>> print(blaah)
>                                       [,1]
>                   [,2]           [,3]   [,4]
> exampleSingleSelect  "Insert single selection box title here" "SingleSelect"
> 1    List,3
> exampleSlider            "Insert slider bar title here"
>   "Slider"       58   List,2
>
>
> The command that caused the error is this:
>
>> parameterList[aCounter, 3]<<- blaah
>
> I hope I've given enough information for someone else to be able to make
> sense of it all. If not I'd be happy to supply additional code
> or info on how the script works, but I think that most of it would be
> irrelevant and complicated.
>
>   Many thanks in advance,
> Mipam Bruining
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list