Rcpp: change a list item in a list of a list










0















Change a list item in a list of a list.



Unfortunately, I could not find an answer to my question in the forum.



Using rcpp, I want to directly change a list item in a list. I have the following approach:



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];
List innerList = polymeraseFlagList[0];

outerList((1)) ) "test"; // correctly changing inner list
CharacterVector innerStr = innerList[1]; // correctly access to inner list element



However, I am only able to change the complete list list [i] and not a single element: list [[i]] or list [i][j].



outerList[i][j] = "new inner list element"; // not working
outerList[[i]] = "new inner list"; // not working


I can extract the inner list, but here I change only the newly created list and not the old list. It is essential for me to change the list in R Workspace directly. I could of course change the newly created list and later assign it to the old one. However, I hope that there is a more elegant solution here.



I also tried to declare the list before assigning it so that I already have a nested list that I can access as usual. Unfortunately, this did not work.



List outerList = List::create(Named("lst")); // not working


In the end, I want the following to be possible (change the variable directly in the R Workspace):



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];

CharacterVector innerStr = outerList[i][j];
CharacterVector innerList = outerList[[i]]
innerList[i][j] = "new String";



It would be great if someone could help me.



Many thanks :)










share|improve this question
























  • "List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

    – Till
    Nov 12 '18 at 9:55












  • What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

    – Matthieu Brucher
    Nov 12 '18 at 9:56











  • Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

    – Matthieu Brucher
    Nov 12 '18 at 9:57











  • "CharacterVector" instead of "Character Vecotr". - sorry.

    – Till
    Nov 12 '18 at 9:59






  • 2





    Can you please edit your question to remove at least the trivial typos?

    – Ralf Stubner
    Nov 12 '18 at 10:16















0















Change a list item in a list of a list.



Unfortunately, I could not find an answer to my question in the forum.



Using rcpp, I want to directly change a list item in a list. I have the following approach:



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];
List innerList = polymeraseFlagList[0];

outerList((1)) ) "test"; // correctly changing inner list
CharacterVector innerStr = innerList[1]; // correctly access to inner list element



However, I am only able to change the complete list list [i] and not a single element: list [[i]] or list [i][j].



outerList[i][j] = "new inner list element"; // not working
outerList[[i]] = "new inner list"; // not working


I can extract the inner list, but here I change only the newly created list and not the old list. It is essential for me to change the list in R Workspace directly. I could of course change the newly created list and later assign it to the old one. However, I hope that there is a more elegant solution here.



I also tried to declare the list before assigning it so that I already have a nested list that I can access as usual. Unfortunately, this did not work.



List outerList = List::create(Named("lst")); // not working


In the end, I want the following to be possible (change the variable directly in the R Workspace):



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];

CharacterVector innerStr = outerList[i][j];
CharacterVector innerList = outerList[[i]]
innerList[i][j] = "new String";



It would be great if someone could help me.



Many thanks :)










share|improve this question
























  • "List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

    – Till
    Nov 12 '18 at 9:55












  • What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

    – Matthieu Brucher
    Nov 12 '18 at 9:56











  • Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

    – Matthieu Brucher
    Nov 12 '18 at 9:57











  • "CharacterVector" instead of "Character Vecotr". - sorry.

    – Till
    Nov 12 '18 at 9:59






  • 2





    Can you please edit your question to remove at least the trivial typos?

    – Ralf Stubner
    Nov 12 '18 at 10:16













0












0








0








Change a list item in a list of a list.



Unfortunately, I could not find an answer to my question in the forum.



Using rcpp, I want to directly change a list item in a list. I have the following approach:



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];
List innerList = polymeraseFlagList[0];

outerList((1)) ) "test"; // correctly changing inner list
CharacterVector innerStr = innerList[1]; // correctly access to inner list element



However, I am only able to change the complete list list [i] and not a single element: list [[i]] or list [i][j].



outerList[i][j] = "new inner list element"; // not working
outerList[[i]] = "new inner list"; // not working


I can extract the inner list, but here I change only the newly created list and not the old list. It is essential for me to change the list in R Workspace directly. I could of course change the newly created list and later assign it to the old one. However, I hope that there is a more elegant solution here.



I also tried to declare the list before assigning it so that I already have a nested list that I can access as usual. Unfortunately, this did not work.



List outerList = List::create(Named("lst")); // not working


In the end, I want the following to be possible (change the variable directly in the R Workspace):



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];

CharacterVector innerStr = outerList[i][j];
CharacterVector innerList = outerList[[i]]
innerList[i][j] = "new String";



It would be great if someone could help me.



Many thanks :)










share|improve this question
















Change a list item in a list of a list.



Unfortunately, I could not find an answer to my question in the forum.



Using rcpp, I want to directly change a list item in a list. I have the following approach:



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];
List innerList = polymeraseFlagList[0];

outerList((1)) ) "test"; // correctly changing inner list
CharacterVector innerStr = innerList[1]; // correctly access to inner list element



However, I am only able to change the complete list list [i] and not a single element: list [[i]] or list [i][j].



outerList[i][j] = "new inner list element"; // not working
outerList[[i]] = "new inner list"; // not working


I can extract the inner list, but here I change only the newly created list and not the old list. It is essential for me to change the list in R Workspace directly. I could of course change the newly created list and later assign it to the old one. However, I hope that there is a more elegant solution here.



I also tried to declare the list before assigning it so that I already have a nested list that I can access as usual. Unfortunately, this did not work.



List outerList = List::create(Named("lst")); // not working


In the end, I want the following to be possible (change the variable directly in the R Workspace):



// [[Rcpp::export]]
void test()
Environment env = Environment::global_env();
List outerList = env["ListR"];

CharacterVector innerStr = outerList[i][j];
CharacterVector innerList = outerList[[i]]
innerList[i][j] = "new String";



It would be great if someone could help me.



Many thanks :)







c++ r list rcpp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 10:16









duckmayr

7,17811226




7,17811226










asked Nov 12 '18 at 9:53









TillTill

85




85












  • "List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

    – Till
    Nov 12 '18 at 9:55












  • What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

    – Matthieu Brucher
    Nov 12 '18 at 9:56











  • Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

    – Matthieu Brucher
    Nov 12 '18 at 9:57











  • "CharacterVector" instead of "Character Vecotr". - sorry.

    – Till
    Nov 12 '18 at 9:59






  • 2





    Can you please edit your question to remove at least the trivial typos?

    – Ralf Stubner
    Nov 12 '18 at 10:16

















  • "List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

    – Till
    Nov 12 '18 at 9:55












  • What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

    – Matthieu Brucher
    Nov 12 '18 at 9:56











  • Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

    – Matthieu Brucher
    Nov 12 '18 at 9:57











  • "CharacterVector" instead of "Character Vecotr". - sorry.

    – Till
    Nov 12 '18 at 9:59






  • 2





    Can you please edit your question to remove at least the trivial typos?

    – Ralf Stubner
    Nov 12 '18 at 10:16
















"List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

– Till
Nov 12 '18 at 9:55






"List innerList = polymeraseFlagList[0];" is "List innerList = outerList[0];"

– Till
Nov 12 '18 at 9:55














What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

– Matthieu Brucher
Nov 12 '18 at 9:56





What's this: ` outerList((1)) ) "test";? And this outerList[[i]]`? Please provide a minimum reproducible example.

– Matthieu Brucher
Nov 12 '18 at 9:56













Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

– Matthieu Brucher
Nov 12 '18 at 9:57





Also do you expect the environment to reflect the changes you make tot he list? You are copying them, not modifying the original one.

– Matthieu Brucher
Nov 12 '18 at 9:57













"CharacterVector" instead of "Character Vecotr". - sorry.

– Till
Nov 12 '18 at 9:59





"CharacterVector" instead of "Character Vecotr". - sorry.

– Till
Nov 12 '18 at 9:59




2




2





Can you please edit your question to remove at least the trivial typos?

– Ralf Stubner
Nov 12 '18 at 10:16





Can you please edit your question to remove at least the trivial typos?

– Ralf Stubner
Nov 12 '18 at 10:16












1 Answer
1






active

oldest

votes


















1














I found some of your posted code hard to follow, but this is a fairly straightforward task, whether accessing the list from the global environment in R in a hard-coded way as you first tried, or having the list passed as a parameter; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
void test(List x)
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;


// [[Rcpp::export]]
void test2()
Environment env = Environment::global_env();
List x = env["ListR"];
CharacterVector tmp = x[0];
tmp[0] = "Y";
x[0] = tmp;


/*** R
ListR <- list(a = LETTERS[1:3])
ListR
test(ListR)
ListR
test2()
ListR
*/


I get in R



> Rcpp::sourceCpp("modify-list.cpp")

> ListR <- list(a = LETTERS[1:3])

> ListR
$a
[1] "A" "B" "C"


> test(ListR)

> ListR
$a
[1] "Z" "B" "C"


> test2()

> ListR
$a
[1] "Y" "B" "C"


Update



This is also fairly straightforward to extend to a list within a list; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// For when you need to modify an element of a list within a list
// [[Rcpp::export]]
void test3()
Environment env = Environment::global_env();
List y = env["listR"];
List x = y[0];
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;



I get the following in R



Rcpp::sourceCpp("modify-list.cpp")
listR = list(list())
listR[[1]] = list(LETTERS[1:3])
listR
# [[1]]
# [[1]][[1]]
# [1] "A" "B" "C"
test3()
listR
# [[1]]
# [[1]][[1]]
# [1] "Z" "B" "C"





share|improve this answer

























  • Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

    – Till
    Nov 12 '18 at 11:33











  • @Till It's pretty easy to extend to a list within a list; see the updates to the answer

    – duckmayr
    Nov 12 '18 at 11:45











  • many thanks for your help! :)

    – Till
    Nov 12 '18 at 11:57












  • @Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

    – Dirk Eddelbuettel
    Nov 12 '18 at 12:35











  • @DirkEddelbuettel Sure! :)

    – Till
    Nov 12 '18 at 12:47










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259607%2frcpp-change-a-list-item-in-a-list-of-a-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














I found some of your posted code hard to follow, but this is a fairly straightforward task, whether accessing the list from the global environment in R in a hard-coded way as you first tried, or having the list passed as a parameter; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
void test(List x)
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;


// [[Rcpp::export]]
void test2()
Environment env = Environment::global_env();
List x = env["ListR"];
CharacterVector tmp = x[0];
tmp[0] = "Y";
x[0] = tmp;


/*** R
ListR <- list(a = LETTERS[1:3])
ListR
test(ListR)
ListR
test2()
ListR
*/


I get in R



> Rcpp::sourceCpp("modify-list.cpp")

> ListR <- list(a = LETTERS[1:3])

> ListR
$a
[1] "A" "B" "C"


> test(ListR)

> ListR
$a
[1] "Z" "B" "C"


> test2()

> ListR
$a
[1] "Y" "B" "C"


Update



This is also fairly straightforward to extend to a list within a list; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// For when you need to modify an element of a list within a list
// [[Rcpp::export]]
void test3()
Environment env = Environment::global_env();
List y = env["listR"];
List x = y[0];
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;



I get the following in R



Rcpp::sourceCpp("modify-list.cpp")
listR = list(list())
listR[[1]] = list(LETTERS[1:3])
listR
# [[1]]
# [[1]][[1]]
# [1] "A" "B" "C"
test3()
listR
# [[1]]
# [[1]][[1]]
# [1] "Z" "B" "C"





share|improve this answer

























  • Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

    – Till
    Nov 12 '18 at 11:33











  • @Till It's pretty easy to extend to a list within a list; see the updates to the answer

    – duckmayr
    Nov 12 '18 at 11:45











  • many thanks for your help! :)

    – Till
    Nov 12 '18 at 11:57












  • @Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

    – Dirk Eddelbuettel
    Nov 12 '18 at 12:35











  • @DirkEddelbuettel Sure! :)

    – Till
    Nov 12 '18 at 12:47















1














I found some of your posted code hard to follow, but this is a fairly straightforward task, whether accessing the list from the global environment in R in a hard-coded way as you first tried, or having the list passed as a parameter; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
void test(List x)
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;


// [[Rcpp::export]]
void test2()
Environment env = Environment::global_env();
List x = env["ListR"];
CharacterVector tmp = x[0];
tmp[0] = "Y";
x[0] = tmp;


/*** R
ListR <- list(a = LETTERS[1:3])
ListR
test(ListR)
ListR
test2()
ListR
*/


I get in R



> Rcpp::sourceCpp("modify-list.cpp")

> ListR <- list(a = LETTERS[1:3])

> ListR
$a
[1] "A" "B" "C"


> test(ListR)

> ListR
$a
[1] "Z" "B" "C"


> test2()

> ListR
$a
[1] "Y" "B" "C"


Update



This is also fairly straightforward to extend to a list within a list; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// For when you need to modify an element of a list within a list
// [[Rcpp::export]]
void test3()
Environment env = Environment::global_env();
List y = env["listR"];
List x = y[0];
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;



I get the following in R



Rcpp::sourceCpp("modify-list.cpp")
listR = list(list())
listR[[1]] = list(LETTERS[1:3])
listR
# [[1]]
# [[1]][[1]]
# [1] "A" "B" "C"
test3()
listR
# [[1]]
# [[1]][[1]]
# [1] "Z" "B" "C"





share|improve this answer

























  • Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

    – Till
    Nov 12 '18 at 11:33











  • @Till It's pretty easy to extend to a list within a list; see the updates to the answer

    – duckmayr
    Nov 12 '18 at 11:45











  • many thanks for your help! :)

    – Till
    Nov 12 '18 at 11:57












  • @Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

    – Dirk Eddelbuettel
    Nov 12 '18 at 12:35











  • @DirkEddelbuettel Sure! :)

    – Till
    Nov 12 '18 at 12:47













1












1








1







I found some of your posted code hard to follow, but this is a fairly straightforward task, whether accessing the list from the global environment in R in a hard-coded way as you first tried, or having the list passed as a parameter; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
void test(List x)
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;


// [[Rcpp::export]]
void test2()
Environment env = Environment::global_env();
List x = env["ListR"];
CharacterVector tmp = x[0];
tmp[0] = "Y";
x[0] = tmp;


/*** R
ListR <- list(a = LETTERS[1:3])
ListR
test(ListR)
ListR
test2()
ListR
*/


I get in R



> Rcpp::sourceCpp("modify-list.cpp")

> ListR <- list(a = LETTERS[1:3])

> ListR
$a
[1] "A" "B" "C"


> test(ListR)

> ListR
$a
[1] "Z" "B" "C"


> test2()

> ListR
$a
[1] "Y" "B" "C"


Update



This is also fairly straightforward to extend to a list within a list; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// For when you need to modify an element of a list within a list
// [[Rcpp::export]]
void test3()
Environment env = Environment::global_env();
List y = env["listR"];
List x = y[0];
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;



I get the following in R



Rcpp::sourceCpp("modify-list.cpp")
listR = list(list())
listR[[1]] = list(LETTERS[1:3])
listR
# [[1]]
# [[1]][[1]]
# [1] "A" "B" "C"
test3()
listR
# [[1]]
# [[1]][[1]]
# [1] "Z" "B" "C"





share|improve this answer















I found some of your posted code hard to follow, but this is a fairly straightforward task, whether accessing the list from the global environment in R in a hard-coded way as you first tried, or having the list passed as a parameter; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// [[Rcpp::export]]
void test(List x)
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;


// [[Rcpp::export]]
void test2()
Environment env = Environment::global_env();
List x = env["ListR"];
CharacterVector tmp = x[0];
tmp[0] = "Y";
x[0] = tmp;


/*** R
ListR <- list(a = LETTERS[1:3])
ListR
test(ListR)
ListR
test2()
ListR
*/


I get in R



> Rcpp::sourceCpp("modify-list.cpp")

> ListR <- list(a = LETTERS[1:3])

> ListR
$a
[1] "A" "B" "C"


> test(ListR)

> ListR
$a
[1] "Z" "B" "C"


> test2()

> ListR
$a
[1] "Y" "B" "C"


Update



This is also fairly straightforward to extend to a list within a list; using the C++ code



#include <Rcpp.h>

using namespace Rcpp;

// For when you need to modify an element of a list within a list
// [[Rcpp::export]]
void test3()
Environment env = Environment::global_env();
List y = env["listR"];
List x = y[0];
CharacterVector tmp = x[0];
tmp[0] = "Z";
x[0] = tmp;



I get the following in R



Rcpp::sourceCpp("modify-list.cpp")
listR = list(list())
listR[[1]] = list(LETTERS[1:3])
listR
# [[1]]
# [[1]][[1]]
# [1] "A" "B" "C"
test3()
listR
# [[1]]
# [[1]][[1]]
# [1] "Z" "B" "C"






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 11:45

























answered Nov 12 '18 at 10:26









duckmayrduckmayr

7,17811226




7,17811226












  • Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

    – Till
    Nov 12 '18 at 11:33











  • @Till It's pretty easy to extend to a list within a list; see the updates to the answer

    – duckmayr
    Nov 12 '18 at 11:45











  • many thanks for your help! :)

    – Till
    Nov 12 '18 at 11:57












  • @Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

    – Dirk Eddelbuettel
    Nov 12 '18 at 12:35











  • @DirkEddelbuettel Sure! :)

    – Till
    Nov 12 '18 at 12:47

















  • Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

    – Till
    Nov 12 '18 at 11:33











  • @Till It's pretty easy to extend to a list within a list; see the updates to the answer

    – duckmayr
    Nov 12 '18 at 11:45











  • many thanks for your help! :)

    – Till
    Nov 12 '18 at 11:57












  • @Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

    – Dirk Eddelbuettel
    Nov 12 '18 at 12:35











  • @DirkEddelbuettel Sure! :)

    – Till
    Nov 12 '18 at 12:47
















Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

– Till
Nov 12 '18 at 11:33





Many thanks duckmayr! You are right, I should have written clearer. The hard coded way is what I want. Do you have an example for a list in R which include a list. Like: listR = list(list()); listR[[1]] = c("A","B","C");

– Till
Nov 12 '18 at 11:33













@Till It's pretty easy to extend to a list within a list; see the updates to the answer

– duckmayr
Nov 12 '18 at 11:45





@Till It's pretty easy to extend to a list within a list; see the updates to the answer

– duckmayr
Nov 12 '18 at 11:45













many thanks for your help! :)

– Till
Nov 12 '18 at 11:57






many thanks for your help! :)

– Till
Nov 12 '18 at 11:57














@Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

– Dirk Eddelbuettel
Nov 12 '18 at 12:35





@Till please feel free to accept and upvote the answer. That's how StackOverflow works, and there is a tour for new users.

– Dirk Eddelbuettel
Nov 12 '18 at 12:35













@DirkEddelbuettel Sure! :)

– Till
Nov 12 '18 at 12:47





@DirkEddelbuettel Sure! :)

– Till
Nov 12 '18 at 12:47

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259607%2frcpp-change-a-list-item-in-a-list-of-a-list%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo