Plotting data frame column in Cluster representation in R

Viewed 25

I have data-frame of two columns and want to plot in such a way that I can have clusters which represents the respective column. I have tried to plot

plot(df[,1:2], col = kmeans(df[,1:2],2)$cluster,pch = 19)

but not sure that it is the best way to visualize the data. Can anyone recommend the best or other way to visualize the data so that I can have two clusters in the plot based on the column.?

The values of the two columns have quite different ranges df

structure(list(colum1 = c(0.00253556821544955, 0.00580752735507986, 
0.00170729670615445, 0.0047153368427216, 0.00207844233625078, 
0.00275079043135027, 0.00372243948270214, 0.0020015384632827, 
0.00181600201230862, 0.00163862255137385, 0.00572194071099955, 
0.00377393666078752, 0.0021614101104376, 0.00229301132288137, 
0.00209191488894335, 0.00377383009262211, 0.00505389454986345, 
0.0039459358031053, 0.00250788710148076, 0.00399431334574238), 
    column2 = c(4.33151728208976e-18, 3.86225424523543e-18, 1.17180694454915e-17, 
    5.82899214970158e-18, 5.47692302401188e-19, 3.14801164369759e-17, 
    3.16632701757469e-18, 6.69406506003323e-18, 2.70077545773733e-19, 
    1.88975844292911e-17, 4.4825290617701e-17, 7.67448169092432e-20, 
    1.12270703723055e-17, 7.10897649979119e-18, 1.34051021468176e-18, 
    1.44438974192662e-19, 1.22990704050353e-18, 5.97710792957353e-18, 
    5.62506017524996e-18, 1.19541618803766e-18)), class = "data.frame", row.names = c(NA, 
-20L))
0 Answers
Related