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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:09:55+00:00 2026-06-17T21:09:55+00:00

I am a newcomer to R. Last week I had a long and complicated

  • 0

I am a newcomer to R. Last week I had a long and complicated function working perfectly. The program was letting me pick a subset of columns and doing various manipulations on that subset. The function must work ‘function(arg1=first_header_name, arg2=second_header_name,….)’. I have cleared the console, removed the old history file. I have read the manual again, I have checked the .csv file to make sure everything there is still the same. I have gone back and reworked it all step by step and I have the place where this new problem occurs. As it is a very long function, I am only going to reproduce it in a simplified version of the part that is suddenly not working.

 elbow <- function(arg1,arg2) {
   my_data <- read.csv("data.csv", header=TRUE, sep=",") 
   average_A <- (arg1 + arg2)
   average_A
 }
 elbow(A3,A5)
 # Error in elbow(A3, A5) : object 'A3' not found

Column headers are A3,A4,A5,A7,A8,A9,B2,B3,B5,B6,B7,B9

What stupid little error am I making? This is driving me batty. It has to be something trivial.

  • 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-17T21:09:56+00:00Added an answer on June 17, 2026 at 9:09 pm

    Here’s my guess at what might work the way you wanted:

    elbow <- function(arg1,arg2) {
       my_data <- read.csv("data.csv", header=TRUE, sep=",") 
       average_A <- my_data[[arg1]] + my_data[[arg2]]   # "[[" evaluates args
       average_A
     }
     elbow('A3','A5')  # entered a character literals
    

    You should realize that the rest of my_data will have evaporated and be garbage collected after return from the elbow call. I could have showed you how to use your original expression following attach(), which would have been arguably safe within that function, but that would have violated my religious principles.

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

Sidebar

Related Questions

I'm a newcomer to the iPhone world. I'm working on an application having a
I am a complete newcomer to Object C but I thought I had the
I am a newcomer to NSIS and I plan to distribute a program A
Relative newcomer to Javascript and looking for a way to remove the last character
I am a newcomer trying to learn java. I am doing a project for
I'm a newcomer to Qt, but I'm trying to implement what basically amounts to
I am a newcomer to Maven, and I was wondering if there was a
As a newcomer to iOS, I found that ARC has thus far really helped
I'm a newcomer to Caliburn.Micro and there are a few things I'm still not
I am a newcomer to TDD. What are some of the techniques you guys

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.