[R] Print and plot a cross Data

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Sat Aug 8 02:30:29 CEST 2020


Hi Pedro,
Scratch that last email. I remembered that "tus.datos" was so large
that it was hanging my R session last time. However, this seems to
work:

tus.datos<-read.table("datayield.csv",sep=";",
 header=TRUE,stringsAsFactors=FALSE)
row_subset<-tus.datos$DATA_TYPE_FM %in% data_types &
 tus.datos$TIME_PERIOD == "01/06/2020"
x<-tus.datos$DATA_TYPE_FM[row_subset]
y<-as.numeric(tus.datos$OBS_VALUE[row_subset])
# DATA_TYPE_FM is a character variable
# unless you let it be read as a factor (beware, it may hang your R session)
# and use as.numeric() it will not turn out well.
barplot(y,names.arg=x)

Jim



More information about the R-help mailing list