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 in Data Analytics by akhtar
• 33,720 points
39 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 by MD
• 79,930 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 3, 2018 in Data Analytics by Kalgi
• 51,970 points
805 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,580 points
378 views
0 votes
1 answer

What are the options for deploying models in production with R?

Well, I could say that the answer ...READ MORE

answered Apr 12, 2018 in Data Analytics by DataKing99
• 8,210 points
661 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 5, 2019 in Data Analytics by anonymous
8,345 views
+1 vote
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,100 points
81 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 in Data Analytics by MD
• 79,930 points
77 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 in Data Analytics by MD
• 79,930 points
84 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
988 views
0 votes
1 answer

How to merge or join 2 dataframes in r?

Hi, When you merge two Dataframes, the result ...READ MORE

answered Oct 30 in Data Analytics by MD
• 79,930 points
95 views
0 votes
1 answer

How to install R Studio in Windows?

Hi@akhtar, To install R Studio in your system, ...READ MORE

answered Apr 29 in Data Analytics by MD
• 79,930 points
176 views