Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:17:03+00:00 2026-06-15T14:17:03+00:00

I want to create a list of 2D matrices > x [,1] [,2] [1,]

  • 0

I want to create a list of 2D matrices

> x
     [,1] [,2]
[1,]    1    6
[2,]    2    7
[3,]    3    8
[4,]    4    9
[5,]    5   10

> y
     [,1] [,2]
[1,]  301  306
[2,]  302  307
[3,]  303  308
[4,]  304  309
[5,]  305  310

> MATS<-c(x,y)

> MATS[1]
[1] 1

I would like to be able to refer to MATS[1] as if it where x…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:17:05+00:00Added an answer on June 15, 2026 at 2:17 pm

    Try

    x <- matrix(1:10, ncol=2)
    y <- x+300
    
    MATS <- list(x, y) # use 'list' instead of 'c' to create a list of matrices
    MATS
    [[1]]
         [,1] [,2]
    [1,]    1    6
    [2,]    2    7
    [3,]    3    8
    [4,]    4    9
    [5,]    5   10
    
    [[2]]
         [,1] [,2]
    [1,]  301  306
    [2,]  302  307
    [3,]  303  308
    [4,]  304  309
    [5,]  305  310
    

    Here you have to refer to MATS[[1]] as if it were x

    If you want to append a new matrix to the exiting list try

    z <- x+500
    MATS[[3]] <- z  # appeding a new matrix to the existing list
    MATS
    
    [[1]]
         [,1] [,2]
    [1,]    1    6
    [2,]    2    7
    [3,]    3    8
    [4,]    4    9
    [5,]    5   10
    
    [[2]]
         [,1] [,2]
    [1,]  301  306
    [2,]  302  307
    [3,]  303  308
    [4,]  304  309
    [5,]  305  310
    
    [[3]]
         [,1] [,2]
    [1,]  501  506
    [2,]  502  507
    [3,]  503  508
    [4,]  504  509
    [5,]  505  510
    

    One drawback of this approach is that you have to know the position in the list where you have to append the new matrix, if you don’t know it or simply if you dont want this approach, then here’s a trick:

    unlist(list(MATS, list(z)), recursive=FALSE) # will give u the same list :D
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in ubuntu 12.04 LTS . I want to create list file
I want to create a list within a list item on jQuery mobile here's
I want to create a list of category terms (contained within a block), with
I want to create a list of GridBagPanel.Constraints . I read it in the
in my python code i want to create a list of lists...in a loop
I`v come across a need where I want to create multiple list items from
Sorry for the Newb-ness. I want to create a list of view elements in
I want create module which update list of usb devices automatically (not only mass
I want to create a dropdown list with a list of spoken languages (English,
I want to create a custom list in Flex for an interface prototype. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.