error while executing plot command using data frame
Title
Question
<span style="color: rgb(85, 85, 85); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; background-color: rgb(205, 205, 205);">plot(captaincy $names,captaincy $played)</span>
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf
R Introduction-to-Data-Frames-in-R 07-08 min 0-10 sec
Answers:
You should refer to the solution given here: https://community.rstudio.com/t/plot-x-y-error-in-plot-window-need-finite-xlim-values/33597
Please note that the plot() function simply plots two vectors against each other. Like plot(c(1:4),c(1,4,9,16)).
In your case, it seems you wish to draw a barplot. For this, please type the commands as given below:
barplot(captaincy$played, names.arg = captaincy$names)
Please checkout https://forums.spoken-tutorial.org/question/2241/r-pogram-data-frame/#answer4655
Login to add comment