plot - Problems with plotting in R after importing from Google Sheets -
i don't know if method of loading csv files has issues i'm encountering, it's lead. thing have been using great package @max conway (here), today got stuck generating exploratory plots illustrated below:
install.packages('gsheet') library(gsheet) data <- gsheet2tbl(("https://docs.google.com/spreadsheets/d/1tagyu-g8c1ea-rbntwewgdueg0uq-lfpkn1ehebenme/edit?usp=sharing")) head(data) source: local data frame [6 x 3] yield nitrogen phosphorus 1 0.8274156 no no 2 3.6126275 no no 3 2.6192581 no no 4 1.7412190 no no 5 0.6590589 no no 6 0.4891107 no no attach(data) plot(nitrogen,yield) error in plot.window(...) : need finite 'xlim' values in addition: warning messages: 1: in xy.coords(x, y, xlabel, ylabel, log) : nas introduced coercion 2: in min(x) : no non-missing arguments min; returning inf 3: in max(x) : no non-missing arguments max; returning -inf
so ran str see how data had been imported:
str(data) classes ‘tbl_df’, ‘tbl’ , 'data.frame': 40 obs. of 3 variables: $ yield : num 0.827 3.613 2.619 1.741 0.659 ... $ nitrogen : chr "no" "no" "no" "no" ... $ phosphorus: chr "no" "no" "no" "no" ...
ok... didn't data.frame, figured had easy fix:
data <- data.frame(data) > str(data) 'data.frame': 40 obs. of 3 variables: $ yield : num 0.827 3.613 2.619 1.741 0.659 ... $ nitrogen : chr "no" "no" "no" "no" ... $ phosphorus: chr "no" "no" "no" "no" ..
at point (and after visually examining df), seemed problem had fixed. precaution, didn't attach data:
plot(data$nitrogen,data$yield)
plot(data$nitrogen,data$yield) error in plot.window(...) : need finite 'xlim' values in addition: warning messages: 1: in xy.coords(x, y, xlabel, ylabel, log) : nas introduced coercion 2: in min(x) : no non-missing arguments min; returning inf 3: in max(x) : no non-missing arguments max; returning -inf
same problem...
what r trying say? doing wrong?
Comments
Post a Comment