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 8783645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:52:23+00:00 2026-06-13T20:52:23+00:00

I have data for several (here: 2) plots, which both have the same x-values.

  • 0

I have data for several (here: 2) plots, which both have the same x-values. I thought, that it might be nice to have a data.frame, that has those x-values as row-names.

# initialize the dataframe with x-values as row names
test = data.frame(
  row.names = c(1,2,3,3.5,4,5)
  )

# Add data
test = cbind(test, c(1:6))
test = cbind(test, a=c(3, 4, 2, 1, 4, 5))

str(test)
test[1]

# try plotting
plot(test[1])

How can I get the row-names as x-values? Do I need to add an extra variable for the x-values? If so: what are row-names used for?

  • 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-13T20:52:25+00:00Added an answer on June 13, 2026 at 8:52 pm

    This will use the row names as values on the x-axis:

    plot(rownames(test), test$a)
    

    I’m not sure what you are trying to achieve with this line though:

    test = cbind(test, c(1:6))
    

    It creates a rather oddly named column that is typically what one would have for row names. I would set this up like this:

    test = data.frame(x=c(1, 2 ,3, 3.5, 4, 5),
                      a=c(3, 4, 2,   1, 4, 5));
    plot(test$x, test$a)
    

    By default the row names are strings that are (1:nrow(test))

    > rownames(test)
    [1] "1" "2" "3" "4" "5" "6"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have data.frame that contains several factors and i want to rename factor levels
I have a data processing application, it has several workflows that extract data and
I want to have several data classes which all have an identifier that is
So, there have been several posts here about importing and saving data from an
I have several data that looks like this: Vector1_elements = T,C,A Vector2_elements = C,G,A
I have a data-upload function that load some data into several tables and processes
So, I have serialized data within the uc_orders table. This data has several parameters
I have a data frame with several variables. What I want is create a
I have several Core Data model version that I have added to my .xcdatamodeld
Let's say I have the following dataset bodysize=rnorm(20,30,2) bodysize=sort(bodysize) survive=c(0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,1,1,1) dat=as.data.frame(cbind(bodysize,survive)) I'm aware that

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.