R Use List not Pairlist (Part 2 of 2)

.. completes the updates to RTool.cpp

.. as predicted by forming the pmc data.frame via an S3
   list instead of a pair list the merge() function works
   properly and column names are retained.
This commit is contained in:
Mark Liversedge
2016-05-26 21:19:52 +01:00
parent c27f246bd4
commit a6f328c459
2 changed files with 69 additions and 109 deletions

View File

@@ -10,7 +10,7 @@
"heightFactor":"2",
"style":"0",
"resizable":"0",
"script":"##\n## TSB v IF with TSS\n##\n## How fresh were we and how hard did we go\n## and how much stress did we elicit.\n## A more meaningful way of reviewing the\n## PMC data in terms of managing load\/intensity\n\nGC.page(width=800, height=600)\n\n## get data\ncompares <- GC.season.metrics(compare=TRUE)\n\n## all pmc data\npmc <- GC.season.pmc(all=TRUE, metric=\"TSS\")\n\n# bigger margins please\npar(mar=c(6,6,6,6))\n\nplot(x=c(-30), y=c(0), \n ylim=c(0.6,1.1), xlim=c(-60,+60),\n xlab=\"\", main=\"\", ylab=\"\")\n\n## grid lines\ngrid(col=\"#404040\", lty=\"solid\", lwd=1)\n\n## title\ntitle(main=\"\", \n xlab=\"TSB\",\n ylab=\"IF\")\n\n## abline\nabline(h=0.85, slope=0, lty=\"dashed\", col=\"white\")\nabline(v=0, slope=1, lty=\"dashed\", col=\"white\")\n\nfor (compare in compares) {\n\n # combine pmc and metric data\n z <- merge(compare$metrics, pmc, by=\"date\")\n\n # area of circle should be proportional\n radius <- sqrt( z$Duration\/ 3.1415927 )\n\n # plot using ride colors if not comparing\n # or only one date range selected\n if (length(compares) == 1) {\n\n # make transparent for overlapping\n colors <- adjustcolor(z$color, 0.6)\n\n symbols(z$\"4\", z$IF, \n circles=radius,\n inches=0.4,\n add=TRUE,\n bg=colors,fg=colors,\n xlab=\"\", ylab=\"\")\n } else {\n\n # make transparent for overlapping\n color <- adjustcolor(compare$color, 0.6)\n\n symbols(z$\"4\", z$IF, \n circles=radius,\n inches=0.4,\n add=TRUE,\n bg=color,\n fg=color,\n xlab=\"\", ylab=\"\")\n\n\n }\n\n # labels for each bubble\n ##text(z$\"4\", z$IF, z$Workout_Code, col=\"gray\", cex=0.5)\n}\n\n## name the quadrants\ntext(-30,0.6, \"Maintain\", col=\"darkgray\", cex=1)\ntext(30,1.09, \"Race\", col=\"darkgray\", cex=1)\ntext(-30,1.09, \"Overload\", col=\"darkgray\", cex=1)\ntext(30,0.6, \"Junk\", col=\"darkgray\", cex=1) ",
"script":"##\n## TSB v IF with TSS\n##\n## How fresh were we and how hard did we go\n## and how much stress did we elicit.\n## A more meaningful way of reviewing the\n## PMC data in terms of managing load\/intensity\n\nGC.page(width=800, height=600)\n\n## get data\ncompares <- GC.season.metrics(compare=TRUE)\n\n## all pmc data\npmc <- GC.season.pmc(all=TRUE, metric=\"cTSS\")\n\n# bigger margins please\npar(mar=c(6,6,6,6))\n\nplot(x=c(-30), y=c(0), \n ylim=c(0.6,1.1), xlim=c(-60,+60),\n xlab=\"\", main=\"\", ylab=\"\")\n\n## grid lines\ngrid(col=\"#404040\", lty=\"solid\", lwd=1)\n\n## title\ntitle(main=\"\", \n xlab=\"TSB\",\n ylab=\"IF\")\n\n## abline\nabline(h=0.85, slope=0, lty=\"dashed\", col=\"white\")\nabline(v=0, slope=1, lty=\"dashed\", col=\"white\")\n\nfor (compare in compares) {\n\n # combine pmc and metric data\n z <- merge(compare$metrics, pmc, by=\"date\")\n\n # area of circle should be proportional\n radius <- sqrt( z$cTSS\/ 3.1415927 )\n\n # plot using ride colors if not comparing\n # or only one date range selected\n if (length(compares) == 1) {\n\n # make transparent for overlapping\n colors <- adjustcolor(z$color, 0.6)\n\n symbols(z$sb, z$IF, \n circles=radius,\n inches=0.4,\n add=TRUE,\n bg=colors,fg=colors,\n xlab=\"\", ylab=\"\")\n } else {\n\n # make transparent for overlapping\n color <- adjustcolor(compare$color, 0.6)\n\n symbols(z$sb, z$IF, \n circles=radius,\n inches=0.4,\n add=TRUE,\n bg=color,\n fg=color,\n xlab=\"\", ylab=\"\")\n\n\n }\n\n # labels for each bubble\n ##text(z$\"4\", z$IF, z$Workout_Code, col=\"gray\", cex=0.5)\n}\n\n## name the quadrants\ntext(-30,0.6, \"Maintain\", col=\"darkgray\", cex=1)\ntext(30,1.09, \"Race\", col=\"darkgray\", cex=1)\ntext(-30,1.09, \"Overload\", col=\"darkgray\", cex=1)\ntext(30,0.6, \"Junk\", col=\"darkgray\", cex=1) ",
"state":" ",
"showConsole":"0",
"__LAST__":"1",