R Printing Character String & Data Object on Same Line (Example Code)

This article shows how to return character strings and data objects on the same line to the RStudio console in R programming.

Example Data

my_str <- "Some character string content"    # Creating example string
my_var <- 101010101                          # Creating numeric data object

Example: Return String & Variable to RStudio Console Using print & paste

print(paste(my_str, my_var))                 # Using print() & paste() functions
# [1] "Some character string content 101010101"

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed