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

0 votes
Is there a website to which I can refer? Actually, I'm a newbie when it comes to R programming. I'm not sure how to do it without the k-nn function. I just use the knn function to find example code.
Jun 19 in Data Science by Avinash
• 1,260 points
14 views

1 answer to this question.

0 votes
I created an example that demonstrates the algorithm's operation and how to use it in R. The data for my example is provided here.

students known data.frame(Major = c(rep("Arts",4", "Applied Science", 3), rep("Education",3), rep("Science",6));
The cost of tuition is equal to c(2000,2200,2100,1900,2800,3000,2900, 2500,2700,2600,3100,3200,3150,3000,3175,3300),
Age = c(20,18,22,21,24,23,21,19,19,21,20,18,17,21,24,23), GPA = c(3.55,3.40,3.30,3.50,2.90,3.05,2.50, 3.80,3.45,3.35,3.00,3.50,4.00,3.40,3.30),
students known

# Major Tuition Grade Point Average Age # 1 in the Arts (2000) 3.55 20 # 2 in the Arts (2002) 3.40 18 # 3 Arts 2100 3.30 22 # 4 Arts 1900 2.800 3.50 21 # 5 Applied Science Applied Science 3000 2.90 24 # 6 Applied Science 2900 3.05 23 # 7 Education, 2.50 21 # 8, 2500 3.80 19 # 9 Education 2700 3.45 19 No. 10 Education 2600 3,35 21, Position 11 in the Science 3100 Science, #12, at 3.00, and 3200 Science 3150, 3.50, 18 # 13, 4,00, 17, and 14, Science 3000, 3,40, and 21, respectively, Science 3175 3.45 24 No. 16 Science
answered Jun 24 by Sohail
• 2,960 points

Related Questions In Data Science

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
7 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 in Data Science by Avinash
• 1,260 points
12 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 in Data Science by Sohail
• 2,960 points
29 views
0 votes
0 answers
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
437 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
481 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,351 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
503 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 in Data Science by Sohail
• 2,960 points
58 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 in Data Science by Sohail
• 2,960 points
21 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