For loop in R programming

0 votes

Hi Guys,

I want to create a loop in R. But I don't know the syntax for a loop. How can I do that?

Oct 6, 2020 in Data Analytics by akhtar
• 38,260 points
743 views

1 answer to this question.

0 votes

Hi@akhtar,

You can create a loop in R in the same way. This below structure is used when a loop is to be executed a fixed number of times. It is commonly used for iterating over the elements of an object (list, vector).

for(i in 1:4){
     print (y[i])
}
answered Oct 6, 2020 by MD
• 95,460 points

Related Questions In Data Analytics

0 votes
2 answers

Installing MXNet for R in Windows System

You can install it for python in ...READ MORE

answered Dec 4, 2018 in Data Analytics by Kalgi
• 52,350 points
2,492 views
0 votes
1 answer

AUC for 3-Class prediction in R

Use type='probs' inside predict() function, so that ...READ MORE

answered Apr 4, 2018 in Data Analytics by Bharani
• 4,660 points
1,447 views
0 votes
2 answers

How to use group by for multiple columns in dplyr, using string vector input in R?

data = data.frame(   zzz11def = sample(LETTERS[1:3], 100, replace=TRUE),   zbc123qws1 ...READ MORE

answered Aug 6, 2019 in Data Analytics by anonymous
14,121 views
0 votes
1 answer

How to find out the sum/mean for multiple variables per group in R?

You can use the reshape2 package for ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,250 points
3,863 views
0 votes
1 answer

Can we have an if loop inside a for loop in R programming?

You're If loop doesn't have any condition ...READ MORE

answered Dec 21, 2018 in Data Analytics by Sophie may
• 10,620 points
726 views
0 votes
1 answer

Error in library(randomForest) : there is no package called ‘randomForest’

Hi@akhtar, You need to install the library in ...READ MORE

answered Oct 6, 2020 in Data Analytics by MD
• 95,460 points
10,896 views
0 votes
1 answer

Error in library(Metrics) : there is no package called ‘Metrics’

Hi@akhtar, The matrics library is not available in ...READ MORE

answered Oct 6, 2020 in Data Analytics by MD
• 95,460 points
4,376 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
2,268 views
+4 votes
3 answers

How to sum a variable by group in R?

You can also try this way, x_new = ...READ MORE

answered Aug 1, 2019 in Data Analytics by Cherukuri
• 33,030 points
78,209 views
+1 vote
2 answers

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
82,916 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP