Expression Computation - R programming

0 votes

How to solve the following expression:

8 x 8
8 x 88
8 x 888
8 x 8888
8 x 88888

I am to use R programming to do the computation. But is there a way I can use R code for this computation with a single R expression that has no commas and braces (i.e. the use of , and {}).

Anyway to do this via vectorization, without using condition statements (if, while, for)?

Oct 29, 2018 in Data Analytics by Ali
• 10,670 points
40 views

1 answer to this question.

0 votes

The sequence of ones:

cumsum(10^(0:4))
## [1]     1    11   111  1111 11111

Eights:

8 * cumsum(10^(0:4))
## [1]     8    88   888  8888 88888

Times eight:

 8 * 8 * cumsum(10^(0:4))
## [1]     64    704   7104  71104 711104
answered Oct 29, 2018 by Maverick
• 10,820 points

Related Questions In Data Analytics

0 votes
1 answer

How to evaluate expression given as a string in R?

The eval() function evaluates an expression, but "5+5" is a string, ...READ MORE

answered Jun 7, 2018 in Data Analytics by DataKing99
• 8,150 points
1,098 views
0 votes
2 answers

What are the rules to define a variable name in R programming language?

The same rules almost follow for all ...READ MORE

answered Aug 26, 2019 in Data Analytics by anonymous
• 32,460 points
891 views
0 votes
1 answer

R programming Web Scraping

Try something like this: library(rvest) library(rvest) library(tidyverse) urls <- read_html("http://dk.farnell.com/c/office-computer-networking-products/prl/results/") pag <- ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,820 points
250 views
0 votes
1 answer

Difference between factor and as.factor in R programming

Hey @Ali, as.factor is a wrapper for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,820 points
2,057 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
712 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,720 points
376 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 9 by Gitika 156 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,720 points
230 views
0 votes
1 answer

Why should I adopt R programming

R Programming is the best mechanism for ...READ MORE

answered Oct 29, 2018 in Data Analytics by Maverick
• 10,820 points
70 views
0 votes
2 answers

Error: could not find function - R Programming

Yes, Just like @Maverik said, It happens ...READ MORE

answered Aug 22, 2019 in Data Analytics by anonymous
• 32,460 points
16,398 views