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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:50:14+00:00 2026-05-25T23:50:14+00:00

I have several functions that I am trying to implement in R(studio). I will

  • 0

I have several functions that I am trying to implement in R(studio). I will show the simplest one. I am trying to append names on to a vector for later use as a col.name.

# Initialize
headerA <- vector(mode="character",length=20)
headerA[1]="source";headerA[2]="matches"

# Function - add on new name
h <- function(df, compareA, compareB) {
   new_header <- paste(compareA,"Vs",compareB,sep="_")
   data.frame(df,new_header)
}
# Comparison 1:
compareA <-"AA"
compareB <-"BB"
headers <- (headerA, compareA, compareB)

But I am getting this error and it is very puzzling. I have googled it but the search is too vague/broad.
When run I get:

headers <- (headerA, compareA, compareB)
Error: unexpected ‘,’ in “headers <- (headerA,”

The second error for the other function is similar…

  • 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-05-25T23:50:14+00:00Added an answer on May 25, 2026 at 11:50 pm

    It looks like you’re missing a call to your function h and just have an open ( instead:

    headers <- h(headerA, compareA, compareB)
    

    Results in:

            df new_header
    1   source   AA_Vs_BB
    2  matches   AA_Vs_BB
    3            AA_Vs_BB
    4            AA_Vs_BB
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to interface with a Dll that implements several functions, one of
I have several functions that I wrote and I use regularly on my servers,
I have a Bourne Shell script that has several functions in it, and allows
I have noticed that Google Toolbox for Mac replaces several SQLite built-in functions (LOWER/UPPER,
I have been trying for several hours to implement a GLSL replacement for glTexGen
I'm trying to create a class TestClass that's divided over several files. I have
I have an algorithm that calls several functions to process its data. Each of
I have an array of structs, and I have some functions that will be
I have an UI application that serves several functions (<800KB). I wanted to allow
I have a data-upload function that load some data into several tables and processes

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.