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

  • Home
  • SEARCH
  • 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 9215195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:09:01+00:00 2026-06-18T02:09:01+00:00

Its just a basic ifelse but its returning the error: unexpected symbol and points

  • 0

Its just a basic ifelse but its returning the error: “unexpected symbol” and points to the first character of the last line.
any ideas?

input1<-readline("using C:/Users/HouseGroup/Desktop/betterformat.csv as the target csv file.
  Is this correct?  Y/N" )
ifelse (input1=="Y",
theData <- read.csv("C:/Users/HouseGroup/Desktop/betterformat.csv"),
rightDir<- readline("please input the proper file path") 
theData<-  read.csv(rightDir))
  • 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-18T02:09:03+00:00Added an answer on June 18, 2026 at 2:09 am

    You should use the standard if and else construct in R, as defined by the R language definition.

    When the if statement is not in a block the else, if present, must
    appear on the same line as the end of statement2. Otherwise the new
    line at the end of statement2 completes the if and yields a
    syntactically complete statement that is evaluated. A simple solution
    is to use a compound statement wrapped in braces, putting the else on
    the same line as the closing brace that marks the end of the statement

    if (input1=="Y") {
      theData <- read.csv("C:/Users/HouseGroup/Desktop/betterformat.csv")
    } else {
      rightDir <- readline("please input the proper file path") 
      theData <- read.csv(rightDir)
    }
    

    The command ifelse takes vectors and returns vectors. See ?ifelse for examples.

    x <- c(6:-4)
    sqrt(x)  #- gives warning
    sqrt(ifelse(x >= 0, x, NA))  # no warning
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Its just a basic question. I am fitting lines to scatter points using polyfit
I couldn't find anything on this, but probably its just because I don't know
I have a working ChangeTrackingList implementation which does its job just fine, but I'd
After reading http://www.pragprog.com/magazines/2010-03/javascript-its-not-just-for-browsers-any-more I'm wondering which is the best IDE to develop server-side javascript
Im having a weird issue here. Its probably just something stupid but I dont
was wondering if anyone could help me improve my code. Its just some basic
I am trying to write a script for matrix multiplication. Its just a basic
Like there are many Applications which are just basic but you can have install
I'm creating a comment system for my website. Right now its just a basic
Pretty basic question, I know... I just don't know how it's done. I want

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.