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

  • Home
  • SEARCH
  • 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 8135333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:23:23+00:00 2026-06-06T10:23:23+00:00

Is there an R type equivalent to the Matlab structure type? I have a

  • 0

Is there an R type equivalent to the Matlab structure type?

I have a few named vectors and I try to store them in a data frame. Ideally, I would simply access one element of an object and it would return the named vectors (like a structure in Matlab). I feel that using a data frame is not the right thing to do since it can store the values of the named vectors but not the names when they differ from one vector to the other.

More generally, is it possible to store a bunch of different objects in a single one in R?

Edit: As Joran said I think that list does the job.

l = list()
l$vec1 = namedVector1
l$vec2 = namedVector2
...

If I have a list of names

name1 = 'vec1'
name2 = 'vec2'

is there any way for the interpreter to understand that when I use a variable name like name1, I am not referring to the variable name but to its content? I have tried get(name1) but it does not work.

  • 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-06T10:23:25+00:00Added an answer on June 6, 2026 at 10:23 am

    I could still be wrong about what you’re trying to do, but I think this is the best you’re going to get in terms of accessing each list element by name:

    l <- list(a= 1:3,b = 1:10)
    > ind <- "a"
    > l[[ind]]
    [1] 1 2 3
    

    Namely, you’re going to have to use [[ explicitly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a data type in eVC++ that is the equivalent of __int64 ?
Are there any standalone type conversion libraries? I have a data storage system that
Possible Duplicate: Does SQL Server 2005 have an equivalent to MySql’s ENUM data type?
Is there an equivalent to the following: header(Content-type: text/xml); I'm using Google Maps with
Are there equivalent methods for ceilf and floorf for the NSDecimalNumber type? I couldn't
Is there an equivalent for the C# 4 'dynamic' keyword when using type safe
Is there any equivalent to %TYPE in MSSQL2005? CREATE TABLE TEST (ID NUMBER(5)); DECLARE
Is there an equivalent object type for Actionscript's Vector in C#? If not, what
Possible Duplicate: C# - Programmatic equivalent of default(Type) Is there a method or property
Is there a way to change the data type of the static hasMany =

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.