How to use strrep() function In R Language
This function is used to get the N character strings in a single string.
Syntax:
strrep( “string”,N)
Example: R program to get N character strings using strrep() function
R
# get 2 times print ( strrep ( "Hello_Geek" ,2)) print ( "-----" ) # get 10 times print ( strrep ( "Python" ,10)) print ( "-----" ) # get 3 times print ( strrep ( "java" ,3)) print ( "-----" ) # get 4 times print ( strrep ( "dbms" ,4)) print ( "-----" ) # get 5 times print ( strrep ( "sql" ,5)) print ( "-----" ) # get 7 times print ( strrep ( "big data" ,7)) |
Output:
[1] “Hello_GeekHello_Geek”
[1] “—–“
[1] “PythonPythonPythonPythonPythonPythonPythonPythonPythonPython”
[1] “—–“
[1] “javajavajava”
[1] “—–“
[1] “dbmsdbmsdbmsdbms”
[1] “—–“
[1] “sqlsqlsqlsqlsql”
[1] “—–“
[1] “big databig databig databig databig databig databig data”
Repeat Character String N Times in R
In this article, we will discuss how to repeat the character string N times in the R programming language. Character string means a set of characters .
Example:
“Hello Geek”,”Python”,”Languages_Python” are some examples
Contact Us