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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:32:54+00:00 2026-06-13T15:32:54+00:00

I have a huge list with data.frames (same number of columns, different number of

  • 0

I have a huge list with data.frames (same number of columns, different number of rows).
I succeeded to use apply – instead of the for loops I learned to avoid – to create a mean value over specific columns in each list element with

t2<-lapply(t1, function(x) cbind(x,rowMeans(x[,c("ColumnX","ColumnY","ColumnZ")])))

The problem I am stuck with now is the new columns name. It is “rowMeans(x[,c(“ColumnX”,”ColumnY”,”ColumnZ”)])”.

How can I change this for all list elements? My poor “lapply”-knowledge was not sufficient for this task.

  • 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-13T15:32:55+00:00Added an answer on June 13, 2026 at 3:32 pm

    There’s two ways to do this, and it actually has to do with the cbind function and not the lapply function:

    cbind(x,DesiredName = rowMeans(x[,...]))
    

    Or after you’ve cbind’ed:

    > names(x)
    [1] "Column X" "Column Y" "Column Z" "rowMeans(x[,...])"
    > names(x)[4]
    "rowMeans(x[,...])"
    > names(x)[4] <- "DesiredName" ###Assign a name to the fourth column
    > names(x)
    [1] "Column X" "Column Y" "Column Z" "DesiredName"
    

    That’s obviously the long way, but it useful for if you forget to name something during the apply or cbind process.

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

Sidebar

Related Questions

I have a huge checkbox list with different levels and I would like to
I have a huge list of data, more than 1M records in a form
I have a huge word list, around 1 million words. If I use relational
some thing like the above image. I have a huge list of data being
I have a huge Ping list and want to clean it. Using PHP I
I have a huge autocomplete field with a list of exams. This field prepends
I have huge amount of data from database, i need to get or store
I have huge data which is static. I need to save it within the
I have huge amont of geographic data represented in simple object structure consisting only
I have a huge XML document 200MB in size containing textual information. The data

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.