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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:36:52+00:00 2026-06-04T22:36:52+00:00

I’m trying to help my girlfriend with a task for a class with R.

  • 0

I’m trying to help my girlfriend with a task for a class with R.
I don’t have idea very things about the code, I know C++, but R I don’t know.

I was reading the documentation but if can you help me, that would be great!

The following code is from this website.

Part I of Code:

# rm(list=ls(all=TRUE))  
# It's discourteous to wipe out your responder's entire workspace
install.packages("abind")
library(abind)
simHPP<-function(lambda,T,N){
    # lambda: scalar, intensity of the Poisson process 
    # T: scalar, time horizon
    # N: scalar, number of trajectories
    EN <- rpois(N,lambda*T)
     y <- matrix(T,nrow=2*max(EN)+2,ncol=N)*matrix(1,nrow=2*max(EN)+2,ncol=N)
    yy <- abind(y,matrix(1,nrow=2*max(EN)+2,ncol=N)*EN,along=3)
i=1
  while(i<=N){
    if(EN[i]>0){
    yy[1:(2*EN[i]+1),i,1] <- c(0,rep(sort(T*runif(EN[i])),each=2))
    } else {
    yy[1,i,1]=0
    }
    yy[1:(2*EN[i]+2),i,2] <- c(0,floor((1:(2*EN[i]))/2),EN[i])
    i=i+1
  }
  return(yy)
}

The function abind, how is it working? The operator of assignment (=) in R, looks like a (<-) ?

And, for example, what is this doing?

yy[1:(2*EN[i]+1),i,1] <- c(0,rep(sort(T*runif(EN[i])),each=2))
  • 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-04T22:36:53+00:00Added an answer on June 4, 2026 at 10:36 pm

    There is a code review website, and that might be appropriate since you are asking (in part) for interpretation of code for which you have not given context.

    (t’s confusing, although not an error, to use capital T for a vector name since the default assignment to that name is logical TRUE.)

    abind takes arrays as arguments and returns augmented arrays. If you have two 2 x 2 x 2 arrays and you abind then you get a 2 x 2 x 4 array

    abind( array(1:8, c(2,2,2) ),  array (9:16, c(2,2,2)))
    #------------
    , , 1
         [,1] [,2]
    [1,]    1    3
    [2,]    2    4
    
    , , 2
         [,1] [,2]
    [1,]    5    7
    [2,]    6    8
    
    , , 3
         [,1] [,2]
    [1,]    9   11
    [2,]   10   12
    
    , , 4
         [,1] [,2]
    [1,]   13   15
    [2,]   14   16
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.