Hello, here are the results from using dput() on the objects in question.
>dput(blaah) structure(list("Insert single selection box title here", "Insert slider bar title here", "SingleSelect", "Slider", 1, 50, list("Option a", "Option b", "Option c"), list(0, 100)), .Dim = c(2L, 4L), .Dimnames = list( c("exampleSingleSelect", "exampleSlider"), NULL)) >dput(parameterList[aCounter, 3]) list(structure(list("Insert single selection box title here", "Insert slider bar title here", "SingleSelect", "Slider", 1, 0, list("Option a", "Option b", "Option c"), list(0, 100)), .Dim = c(2L, 4L), .Dimnames = list(c("exampleSingleSelect", "exampleSlider" ), NULL))) The matrix parameterList was constructed as followed: <R script> exampleSlider = list("Insert slider bar title here", "Slider", 0, list(0,100)) exampleSingleSelect = list("Insert single selection box title here", "SingleSelect", 1, list("Option a", "Option b", "Option c")) parameterList = rbind(list("more advanced options", "Button", rbind(exampleSingleSelect,exampleSlider ), " ") ... aParameterValue <- as.matrix(parameterList[[aCounter,3]]) ... blaah <<- aParameterValue ... parameterList[aCounter, 3] <<- blaah </R script> As a side note: The ... represents various other lines. The construction parameterList <<- blaah <<- aParameterValue is an ad-hoc solution to using global and local variables that I will try to smooth over once it works as it is now. To be more specific, the value aParameterValue is a local variable that is created in a subfunction which is called upon once for each row in parameterList, each time the user presses a button in the created tcltk window. The blaah variable is a global variable that solves the problem of tlctk buttons not being able to receive the returned values from the function it calls and parameterList somehow not being able to be updated correctly within this function. I hope anyone can make sense of this story :S Mipam Bruining 2010/11/1 Ivan Calandra <ivan.calan...@uni-hamburg.de> > 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@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.calan...@uni-hamburg.de > > ********** > http://www.for771.uni-bonn.de > http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php > > ______________________________________________ > 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. > [[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.