How to deal with NaN values in R

0 votes
Due of my inexperience with programming and newness to R, my query and shoddy code are both newbie mistakes.

I was given a task in which I had to construct Fibonacci sequence numbers that were less than 4,000,000 using a while loop (the Fibonacci sequence is characterised by the fact that every number after the first two is the sum of the two preceding ones).

The total of the even integers in the created sequence had to then be calculated.

My response was successful, however I don't think the code was written very effectively. What might I have done differently?

If (x == 0 & y == 1), then > x - 0 > y - 1 > z - 0 While (x 4000000), cat(x), cat(y), cat(" ")
Jul 9, 2022 in Data Science by avinash
• 1,840 points
329 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
0 answers

Introduction to Statistical Learning with Applications in R Figure Codes

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

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

How to make loop for one-at-a time logistic regression in R?

You're probably looking for something similar to ...READ MORE

answered Jun 20, 2022 in Data Science by Sohail
• 3,040 points
1,031 views
0 votes
1 answer

How To Create Vector of Vector In R

Create a list: List() on x returns x[[1]] ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
472 views
0 votes
0 answers

how to make 2 separate substrings from strsplit in R

When it comes to accessing the elements ...READ MORE

Jun 13, 2022 in Data Science by Avinash
• 1,260 points
308 views
0 votes
1 answer

How to overlay density plots in R?

The second one has 104 usage lines: plot(density(MyData$Column1)) ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
1,008 views
0 votes
1 answer

How to implement Knn-algorithm without using k-nn function in r?

I created an example that demonstrates the ...READ MORE

answered Jun 24, 2022 in Data Science by Sohail
• 3,040 points
457 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,570 points
1,024 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
1,159 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
5,882 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
1,092 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