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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:24:47+00:00 2026-06-06T01:24:47+00:00

Not sure how to ask this, but i’ll give it a try: I have

  • 0

Not sure how to ask this, but i’ll give it a try:

I have 20 data.frames (e.g. 2006_1, 2006_2, 2007_1, 2007_2, …) that I imported from MS Access.

Each data.frame has 10 columns and approximately 3 millions rows.

The first column in each data.frame is named secuityName, which is a list of stock tickers followed by some tags.

I would like to upcase every row in the SecurityName column in every one of the 20 data.frames.

The structure follows:

2006_1

> **SecurityName**   **...**
> AAPL abcdef        **...**
> MSFT abcdef        **...**

2006_2

> **SecurityName**   **...**
> AAPL abcdef        **...**
> MSFT abcdef        **...**

I would like each one to look like this:

2006_1

> **SecurityName**   **...**
> AAPL ABCDEF        **...**
> MSFT ABCDEF        **...**

I have a vector named *Raw_data_vector* that has all the data.frame names

Raw_data_vector

> 2006_1
> 2006_2
> 2007_1
> 2007_2
> ...

I have tried to use lapply but can’t get it to work:

lapply(1:length(Raw_data_vector), function(x) toupper(get(x)[,1]),Raw_data_vector)
  • 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-06T01:24:48+00:00Added an answer on June 6, 2026 at 1:24 am

    This should get you started. I used data.frames that have characters that start their names so I don’t wind up with any funny business.

    oh6_1 <- data.frame(SecurityName=letters[1:20], v=1:20)
    oh6_2 <- oh6_1
    
    out <- lapply(ls(pattern = 'oh[0-9]_*'), 
                  function(x) {
                    df <- get(x)
                    df[, 1] <- toupper(df[, 1])  
                    return(df)
                  })
    

    Per the comments:

    Depending on the names of your data.frames, you’ll need to alter the pattern argument to ls. Also, R doesn’t change things in place (for the most part) instead it creates a new one.

    You are seeing it as output to the console because it isn’t assigned to anything! Instead use something like out <- llply(ls(...)...). Then inspect out. It will be a list of the data frames you supplied with their additional column. You can inspect R objects with ?str.

    Finally, this list of objects notion is a common result when working with many similar (or identical) things. It is easy from here to continue doing whatever process you want, accept instead of calling function(data.frame) in something like a for loop, you can call lapply(list of data frames, function)

    … Clear as mud to be sure.

    If you must do the lowercase operation to the existing data.frame, you can use the always scary assign function:

    myfun <- function(X) {
      df <- get(x)
      df[, 1] <- toupper(df[, 1])
      assign(x, df, .GlobalEnv)
      return(NULL)
    }
    
    lapply(ls(), myfun)
    

    now look at your data.frames.

    > oh6_1
       SecurityName  v
    1             A  1
    2             B  2
    3             C  3
    4             D  4
    5             E  5
    6             F  6
    7             G  7
    8             H  8
    9             I  9
    10            J 10
    11            K 11
    12            L 12
    13            M 13
    14            N 14
    15            O 15
    16            P 16
    17            Q 17
    18            R 18
    19            S 19
    20            T 20
    > 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im not even sure how to ask this question, but i'll give it a
(Not sure if this is an okay place to ask, but i'll try). After
Not sure how to ask this question, but here goes. Say I have: var
Sorry but I am not sure how to ask this question but I am
I'm not really sure how to ask this question, but I'll do my best.
I'm not sure I know how to ask this. say I have a function
I'm not sure if I should ask this here but here we go, while
I'm not sure SO is the right place to ask this, but I'm willing
Not sure where else to ask this, so I figured I'd give good old
I am not sure if this is the correct place to ask this, 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.