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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:59:59+00:00 2026-06-11T12:59:59+00:00

Please correct me if my terminology is wrong because on this question Im not

  • 0

Please correct me if my terminology is wrong because on this question Im not quite sure what Im dealing with regarding elements, objects, lists..I just know its not a data frame.
Using the example from prepksel {adehabitatHS} I am trying to modify my own data to fit into their package. Running this command on their example data creates an object? called x which is a list with 3 sections? elements? to it.
The example data code:

 library(adehabitatHS)
    data(puechabonsp)
    locs <- puechabonsp$relocs
    map <- puechabonsp$map
    pc <- mcp(locs[,"Name"])
    hr <- hr.rast(pc, map)
    cp <- count.points(locs[,"Name"], map)
     x <- prepksel(map, hr, cp)

looking at the structure of x it is a list of 3 elements called tab, weight, and factor

str(x) 
List of 3
 $ tab   :'data.frame': 191 obs. of  4 variables:
  ..$ Elevation : num [1:191] 141 140 170 160 152 121 104 102 106 103 ...
  ..$ Aspect    : num [1:191] 4 4 4 1 1 1 1 1 4 4 ...
  ..$ Slope     : num [1:191] 20.9 18 17 24 23.9 ...
  ..$ Herbaceous: num [1:191] 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 ...
 $ weight: num [1:191] 1 1 1 1 1 2 2 4 0 1 ...
 $ factor: Factor w/ 4 levels "Brock","Calou",..: 1 1 1 1 1 1 1 1 1 1 ...

for my data, I will create multiple "x" lists and want to merge the data within each segment. So, I have created an "x" for year 2007, 2008 and 2009. Now, I want to append the "tab" element of 08 to 07, then 09 to 07/08. and do the same for the "weight" and "factor" elements of this list "x". How do you bind that data? I thought about using unlist on each segment of the list and then appending and then joining the yearly data for each segment and then rejoining the three segments back into one list. But this was cumbersome and seemed rather inefficient.

I know this is not how it will work, but in my head this is what I should be doing:

newlist<-append(x07$tab, x08$tab, x09$tab)
newlist<-append(x07$weight, x08$weight, x09$weight)
newlist<-append(x07$factor, x08$factor, x09$factor)

maybe rbind? do.call("rbind", lapply(....uh...stuck

  • 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-11T13:00:00+00:00Added an answer on June 11, 2026 at 1:00 pm

    append works for vectors and lists, but won’t give the output you want for data frames, the elements in your list (and they are lists) are of different types. Something like

    tocomb <- list(x07,x08,x09)
    newlist <- list(
      tab = do.call("rbind",lapply(tocomb,function(x) x$tab)), 
      weight = c(lapply(tocomb,function(x) x$weight),recursive=TRUE), 
      factor = c(lapply(tocomb,function(x) x$factor),recursive=TRUE)
    )
    

    You may need to be careful with factors if they have different levels – something like as.character on the factors before converting them back with as.factor.

    This isn’t tested, so some assembly may be required. I’m not an R wizard, and this may not be the best answer.

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

Sidebar

Related Questions

I'm not quite sure how indexes works. Here's how I understood it, please correct
I'm not sure if I'm using the correct terminology, so please correct me if
Please correct me if I am wrong. I am asking this question to clarify
please excuse me if i am not stating this correctly or using correct terminology
Forgive my probably incorrect application of terminology in this question (btw, please correct me
Could you please explain why this code is not syntactically correct? private void addEditor(final
I am not sure the correct terminology for the process that I am trying
I'm not sure whether it is the right terminology for this kind of relationship,
Please Note: This question is about the difference in terminology between the words destructor
If I am wrong then please correct me as I am new in this.

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.