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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:36:40+00:00 2026-06-13T08:36:40+00:00

Basically, I have the following say: counter <- 3 k <- 9999 I would

  • 0

Basically, I have the following say:

counter <- 3
k <- 9999

I would like to get R to print the following:

on the 3rd count: 9999 

Does anyone what command should I use to do this? Please spell it out for me ,as I am completely new to R.

  • 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-13T08:36:42+00:00Added an answer on June 13, 2026 at 8:36 am

    The basic construction is

    paste("on the ", counter, "rd count: ", k, sep="")
    

    You’ll have to be a little clever to choose the right suffix for the digit (i.e. “rd” after 3, “th” after 4-9, etc. Here’s a function to do it:

    suffixSelector <- function(x) {
      if (x%%10==1) {
        suffixSelector <- "st"
      } else if(x%%10==2) {
        suffixSelector <- "nd"
      } else if(x%%10==3) {
        suffixSelector <- "rd"
      } else {
        suffixSelector <- "th"
      }
    

    }

    Thus:

    suffix <- suffixSelector(counter)
    paste("on the ", counter, suffix, " count: ", k, sep="")
    

    You need to set the sep argument because by default paste inserts a blank space in between strings.

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

Sidebar

Related Questions

Problem: I have to design an algorithm, which does the following for me: Say
Let's say I have the following short-tag regex: \[BANNER{([0-9]*)}{(site1|site2)}{([A-Z]*)}\] basically, I have a CMS
I have the following thing in my bat file. say set path=c:\temp\test so basically
Say I have the following link: <li class=hook> <a href=i_have_underscores>I_have_underscores</a> </li> How would I,
I basically have the following string in the format: A,B,C:D,E,F What I am trying
I basically have the following class: .sf-sub-indicator { background: url(/abcprod/images/arrows-ffffff.png) no-repeat -10px -100px; }
I am wondering if the following is possible in MVC 3 I basically have
Basically I have a new client that is after the following functionality from her
I have the following views in my application. Basically I want to call show_house()
I have created following thing in android using android compatibility support package Basically i

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.