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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:27:39+00:00 2026-06-08T03:27:39+00:00

To start off, I’m not really sure what the difference between paste and print

  • 0

To start off, I’m not really sure what the difference between paste and print is. But I am using “print” to spit out generic statements and “paste” to spit out statements that use/ reference specific variables.

My issue is that when using paste within a function, I am losing my pasted output if there is anything included in the function following the “paste” statement.

Please see the following three functions:

TS<-5

Example 1- everything works fine

T<-function(){

if(exists("TS"))
{paste("TS= ", TS, sep=" ")}

else

if(!exists("TS"))
{print.noquote("No TS Values")}

}

Example 2- My Problem. When I add anything (in this case another print command) following my “if” statement I will lose my pasted output

T<-function(){

if(exists("TS"))
{paste("TS= ", TS, sep=" ")}

else

if(!exists("TS"))
{print.noquote("No TS Values")}

print("my exsistance removes paste output") 

}

Example 3- The same statement placed before the “if” has no negative effect

T<-function(){

print("my exsistance does not remove paste output")

if(exists("TS"))
{paste("TS= ", TS, sep=" ")}

else

if(!exists("TS"))
{print.noquote("No TS Values")}


}

Can someone explain where the conflict is within this function. And better yet how can I work around it so that I can have a paste statement followed by other actions within a function

basically how can I get example #2 to work.

Brownie points- (for sake of visual consistency) when using “print.noquote”, is there such a thing as a paste.noquote?

  • 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-08T03:27:41+00:00Added an answer on June 8, 2026 at 3:27 am

    paste concatenates (pastes) strings and returns a character vector, so you can do thing like

    paste('a','b', sep = '-')
    
    ## [1] "a-b"
    

    print prints values. From ?print

    print prints its argument and returns it invisibly (via invisible(x)). It is a generic function which means that new printing methods can be easily added for new classes.

    Most classes will have a defined print method (or will use print.default)

    You can see the available print methods by typing

    methods('print')
    

    In your case
    paste("TS= ", TS, sep=" ") returns a character vector, so when this is the result of the function, print.character is used to display the results

    In fact, I think you want message not print or print.noquote.

    T <- function() {
        if (exists("TS"))
        {
            message(paste("TS= ", TS, sep=" "))
        } else if (!exists("TS")) {
            message("No TS Values")
        }
        message("my exsistance removes paste output") 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so to start off, I'm not using any sort of web service. Right
I need start off with code because I am not sure what terminology to
I'll start off and say I am not using the MVVM pattern for my
I'm trying to start off using FBJS, and I can't figure this out. The
I want to start off by saying I am not sure how to properly
Let me start off by saying I don't want to print only the duplicate
First, I'll start off by saying that I do not have control over the
To start off, I'm using Asp.Net MVC 4, and I've modified my solution to
To start off, I'm not that great with database strategies, so I don't know
To start off this might not be the right approach and I'm open to

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.