Creating an R dataframe row-by-row

0 votes
In RStudio, if I execute this code:

"1 + 1 is: percent d," sprintf(1+1),
"2 + 2 is: percent d," sprintf(2+2)

If (1), then sprintf("1 + 1 is: percent d", 1+1) and sprintf("2 + 2 is: percent d," 2+2) are appropriate.
This is what I receive:

"1 + 1 is: percent d," sprintf(1+1),
[1] sprintf("1 + 1 is: 2," "2 + 2 is: percent d", 2+2)
[1] "2 + 2 is: 4" > \s> if (1+sprintf "1 + 1 is: percent d", 1+1)
+ sprintf("%D is: 2 + 2 is:", 2+2)
+ } [1] "2 Plus 2 is: 4"
Why doesn't the 1+1 line, which is the initial print statement in the if(1) condition, print to the console as well, I wonder? Every time I have a "if" condition with numerous output lines that I want to print or plot, it seems that only the final one displays. How do I repair this?
Jul 5 in Data Science by avinash
• 1,840 points
12 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Data Science

0 votes
1 answer

Creating new Functions with Linear Regression in R :

When we want to create a model ...READ MORE

answered Jun 1 in Data Science by Sohail
• 2,960 points
30 views
0 votes
0 answers

In R, how to get an object's name after it is sent to a function?

I'm trying to find the opposite of ...READ MORE

Jul 5 in Data Science by avinash
• 1,840 points
8 views
0 votes
0 answers

Read an Excel file directly from a R script

How do I open an Excel file ...READ MORE

Jul 9 in Data Science by avinash
• 1,840 points
11 views
0 votes
0 answers

How to read a csv-file from an url in R?

I'm not very experienced with R, so ...READ MORE

Jul 22 in Data Science by avinash
• 1,840 points
21 views
0 votes
0 answers

Introduction to Statistical Learning with Applications in R Figure Codes

I recently bought the following book: An Introduction ...READ MORE

Jun 1 in Data Science by avinash
• 1,840 points
33 views
0 votes
1 answer

Difference between the == and %in% operators in R

percent in percent "returns a vector of ...READ MORE

answered Jun 20 in Data Science by Sohail
• 2,960 points
21 views
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,610 points
438 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
483 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
4,353 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
504 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP