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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:59:46+00:00 2026-05-28T05:59:46+00:00

I am new to R. I have a data indexed onject which I need

  • 0

I am new to R. I have a data indexed onject which I need to filter so that I can get every Xth data point. How do I go about doing this?
Code used to create the data was:

temp <- blpGetData(conn, securities[1], fields=values,start=startdate,end=enddate, barsize=interval, barfields=tick,retval=datatype)
assign(paste(gsub(" +","",repl[1])),temp)
name <- paste("merge(",paste(gsub(" +","",repl[1])))
suf <- paste(", suffixes=c('.",paste(gsub(" +","",repl[1])),"'",sep="")

for(i in 2:length(securities)){
    temp <- blpGetData(conn, securities[i], 
                       fields=values,
                       start=startdate,
                       end=enddate, 
                       barsize=interval, 
                       barfields=tick,
                       retval=datatype)
    assign(paste(gsub(" +","",repl[i])),temp)
    name <- paste(name,",",paste(gsub(" +","",repl[i])))
    suf <- paste(suf,",'.",paste(gsub(" +","",repl[i])),"'",sep="")
} 
name <- paste(name,suf,"))")
mat <- eval(parse(text=name))

I want every Xth row. mat is the object.

 > cat(name) 
 PX_OPEN..CINC1 PX_HIGH..CINC1 PX_LOW..CINC1 PX_LAST..CINC1 PX_OPEN..CINC5 PX_HIGH..CINC5 PX_LOW..CINC5 PX_LAST..CINC5 PX_OPEN..UST10Y PX_HIGH..UST10Y PX_LOW..UST10Y PX_LAST..UST10Y

 > str(mat) ‘zoo’ series from 2011-11-11 to 2012-01-18
 Data: num [1:49, 1:12] 206 205 205 212 219 ...
- attr(*, "dimnames")=List of 2
 ..$ : NULL
 ..$ : chr [1:12] "PX_OPEN..CINC1" "PX_HIGH..CINC1" "PX_LOW..CINC1" "PX_LAST..CINC1" 
 ... Index: Date[1:49], format: "2011-11-11" "2011-11-14" "2011-11-15" "2011-11-16" "2011-11-17" "2011-11-18" ...
  • 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-05-28T05:59:47+00:00Added an answer on May 28, 2026 at 5:59 am

    It would help if you told us what your object is. A vector? A list?

    If it’s a vector called myvector and you want every xth data point starting from the first you can use seq(...) to generate the sequence 1, 1+x, 1+2*x, 1+3*x, ... to index into your object. See ?seq.

    e.g.:

    myvector <- runif(100) # generate vector of 100 random values
    idx      <- seq(1,length(myvector),by=10) # get every 10th value starting from
                                              # & including 1,
    myvector[idx] # every 10th value: elements 1, 11, 21, ...
    

    UPDATE

    Since your object is two-dimensional, try:

    n   <- 5 # get every 5th object
    idx <- seq(1,nrow(mat),by=n)
    mat[idx,]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that loads new data every day and another table that
I have a table into which new data is frequently inserted. I need to
im new to regular expressions in php. I have some data in which some
I am new to threads and in need of help. I have a data
We have a new filestream database that will be initially loaded with 65GB data,
I have a 'SessionVisit' table which collects data about user visits. The script for
I've come to the point where I need to store some additional data about
I have classes that store data, and methods to go get data for individual
I'm using Hibernate Search (which uses Lucene) for searching some Data I have indexed
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work

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.