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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:19:11+00:00 2026-06-08T10:19:11+00:00

I am having some difficulty in using the function else in R. When I

  • 0

I am having some difficulty in using the function else in R.
When I input ?else, I didn’t get any help about the function else.

When I run the following program:

i=1

if(i>1){print("aa")}

else{print("bb")}

the else didn’t work. Can someone tell me the reasons?

  • 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-08T10:19:13+00:00Added an answer on June 8, 2026 at 10:19 am

    to get help type

    ?'else'
    

    look at the paragraph in help

    Note that it is a common mistake to forget to put braces ({ .. }) around your statements, e.g., after if(..) or for(….). In particular, you should not have a newline between } and else to avoid a syntax error in entering a if … else construct at the keyboard or via source. For that reason, one (somewhat extreme) attitude of defensive programming is to always use braces, e.g., for if clauses.

    if(i>1){print("aa")
    }else{print("bb")}
    

    or

    if(i>1){print("aa")}else{print("bb")}
    

    will presumably work for you.

    i=1
    
    {
    if(i>1){print("aa")}
    else{print("bb")}
    }
    

    would also work. The key is to let the parser know to expect more input.

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

Sidebar

Related Questions

Having some difficulty using a variable within an ajax() function. I know it is
I'm having some difficulty using the API function QueueUserAPC . Basically, I created a
I'm very familiar with using Enums in other languages, but I'm having some difficulty
I have some jQuery code that is having difficulty running because I'm using it
I'm trying to parse an mrss feed using jquery but am having some difficulty
I am having some difficulty writing a function that will search through a directory
I'm having difficulty changing the calue of a dropdown menu using jquery. <div class=input-box>
I'm having difficulty parsing some JSON data returned from my server using jQuery.ajax() To
I'm having some difficulty with managing an administration page, where I constantly get an
I am having some extreme difficulty with this using blocks and inheritance. I declared

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.