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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:25:27+00:00 2026-05-11T12:25:27+00:00

I have data that looks like this. In which I want to plot accumulative

  • 0

I have data that looks like this. In which I want to plot accumulative value of dat1 with respect to x-axis. Also plot it together with dat2.

#x-axis dat1              dat2 -10     0.0140149       0.0140146 -9      0.00890835      0.00891768 -8      0.00672276      0.00672488 -7      0.00876399      0.00879401 -6      0.00806879      0.00808141 -5      0.0088366       0.00885121 -4      0.00856872      0.00857769 -3      0.0195384       0.0196094 -2      0.0160239       0.0161829 -1      0.0254455       0.0257845 0       0.0397413       0.0400913 1       0.0743316       0.0755453 2       0.0247501       0.0253324 3       0.0214285       0.021778 4       0.0241462       0.0244967 5       0.0150943       0.015241 6       0.0141398       0.0142373 7       0.0101515       0.0102948 8       0.0308843       0.031294 9       0.0095504       0.00960626 10      0.00729676      0.0073713 

What’s the common way to do it in R?

I looked at ECDF from Hmisc, it doesn’t seem to do what I want. In particular it doesn’t allow us to give x-axis value.

  • 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. 2026-05-11T12:25:27+00:00Added an answer on May 11, 2026 at 12:25 pm

    I think the function you are looking for is cumsum() which will do a cumulative sum on a vector.

    #put your data into 3 vectors x<-c(-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10) dat1<-c(0.0140149,0.00890835,0.00672276,0.00876399,0.00806879,0.0088366,0.00856872,0.0195384,0.0160239,0.0254455,0.0397413,0.0743316,0.0247501,0.0214285,0.0241462,0.0150943,0.0141398,0.0101515,0.0308843,0.0095504,0.00729676) dat2<-c(0.014015,0.008918,0.006725,0.008794,0.008081,0.008851,0.008578,0.019609,0.016183,0.025785,0.040091,0.075545,0.025332,0.021778,0.024497,0.015241,0.014237,0.010295,0.031294,0.009606,0.007371)  #create a new vector called cdat1 to hold the cumulative sum cdat1<-cumsum(dat1) plot(x,cdat1) points(x,dat2,col="red") 

    I use the function points above in order to add dat2 to the existing plot. Run this in R and see if it gives you what you need.

    image of plot

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

Sidebar

Related Questions

I have data that looks like this: entities id name 1 Apple 2 Orange
I have SQL data that looks like this: events id name capacity 1 Cooking
I have YAML data that looks sort of like this, but ~150k of it:
I have data that looks like this: CUSTOMER_ID OPERDAYSJUL OPERDAYSAUG OPERDAYSSEP ... OPERDAYSJUN 1
I have an Oracle table with data that looks like this: ID BATCH STATUS
I have a query returning data that looks like this: Status Total Success 234
I have data that looks like CUSTOMER, CUSTOMER_ID, PRODUCT ABC INC 1 XYX ABC
I have a list of data that looks like the following: // timestep,x_position,y_position 0,4,7
I have code that looks like: //System.Data.IDataRecord dr try { Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
I have a costumer showing Notepad with a large set of data that looks

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.