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@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.

Reply via email to