Re: [R] Question about dotwhisker
Sorry, forgot to link the actual vignette: https://cran.r-project.org/web/packages/dotwhisker/vignettes/dotwhisker-vignette.html In fact the vignette states: dwplot(m1_df) #same as dwplot(m1) where m1_df is m1_df <- tidy(m1) They are not the same in either the vignette itself or on my computer. I don't understand the part about "rescale the coefficients", but it seems that that is now the default... Just visually at least... If the plots in the vignette are auto-generated from code, then that would explain why the discrepancy isn't mentioned in the text. On Fri, 18 Dec 2020 at 13:47, Dan Bolser wrote: > Hello, > > I'm reading this and one part is confusing me (the most ;-) > > library(dotwhisker) > library(broom) > library(dplyr) > > m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars) > > # Please compare: > dwplot(m1) > dwplot(tidy(m1)) > > Why is the dwplot of tidy(m1) so different from the dwplot of m1? > > I had thought that tidy just gathers data from m1 and that that is what > dwplot is showing, but the latter shows results that are closer to what you > get from inspecting m1: > > Coefficients: > (Intercept) wt cyl disp gear > 43.539847-3.792867-1.784296 0.006944-0.490445 > > Sorry if I'm being stupid, but the latter looks right while the former > looks wrong (i.e. I can't work out what the former is actually plotting). > > > Many thanks, > Dan. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Question about dotwhisker
Hello, I'm reading this and one part is confusing me (the most ;-) library(dotwhisker) library(broom) library(dplyr) m1 <- lm(mpg ~ wt + cyl + disp + gear, data = mtcars) # Please compare: dwplot(m1) dwplot(tidy(m1)) Why is the dwplot of tidy(m1) so different from the dwplot of m1? I had thought that tidy just gathers data from m1 and that that is what dwplot is showing, but the latter shows results that are closer to what you get from inspecting m1: Coefficients: (Intercept) wt cyl disp gear 43.539847-3.792867-1.784296 0.006944-0.490445 Sorry if I'm being stupid, but the latter looks right while the former looks wrong (i.e. I can't work out what the former is actually plotting). Many thanks, Dan. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem installing RMySQL (S4R.h:40:17: error: S.h: No such file or directory?)
Hi, I'm trying to install RMySQL and I keep hitting errors. My computer is: uname -a Linux cricket 2.6.18-92.1.22.el5PAE #1 SMP Tue Dec 16 12:36:25 EST 2008 i686 i686 i386 GNU/Linux I have set the following environment settings: export PKG_LIBS=-L/usr/lib/mysql -lmysqlclient export PKG_CPPFLAGS=-I/usr/include/mysql I run the following command: R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7 RMySQL_0.7-2.tar.gz And I get the output below. Can anyone help me with this? What additional system details can I send? Thanks very much for any tips. Dan. R CMD INSTALL --library $HOME/R/i386-redhat-linux-gnu-library/2.7 RMySQL_0.7-2.tar.gz * Installing *source* package 'RMySQL' ... checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking how to run the C preprocessor... gcc -E checking for compress in -lz... yes checking for getopt_long in -lc... yes checking for mysql_init in -lmysqlclient... no checking for egrep... grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking mysql.h usability... no checking mysql.h presence... no checking for mysql.h... no configure: creating ./config.status config.status: creating src/Makevars ** libs gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/mysql -I/usr/local/include-fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -c RS-DBI.c -o RS-DBI.o In file included from RS-DBI.h:32, from RS-DBI.c:22: S4R.h:40:17: error: S.h: No such file or directory S4R.h:53:24: error: Rversion.h: No such file or directory S4R.h:54:51: error: missing binary operator before token ( S4R.h:62:26: error: Rdefines.h: No such file or directory S4R.h:154:49: error: missing binary operator before token ( S4R.h:176:49: error: missing binary operator before token ( In file included from RS-DBI.c:22: RS-DBI.h:100: error: expected specifier-qualifier-list before 'SEXPTYPE' RS-DBI.h:170: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:173: error: expected ')' before '*' token RS-DBI.h:174: error: expected ')' before '*' token RS-DBI.h:175: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:176: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:179: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:181: error: expected ')' before '*' token RS-DBI.h:182: error: expected ')' before '*' token RS-DBI.h:183: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:184: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:187: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:188: error: expected ')' before '*' token RS-DBI.h:189: error: expected ')' before '*' token RS-DBI.h:190: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:191: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:194: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:195: error: expected ')' before '*' token RS-DBI.h:213: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:220: error: expected ')' before '*' token RS-DBI.h:224: error: expected ')' before '*' token RS-DBI.h:231: error: expected ')' before '*' token RS-DBI.h:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:253: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:257: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.h:259: error: expected declaration specifiers or '...' before 'SEXPTYPE' RS-DBI.h:260: error: expected declaration specifiers or '...' before 'SEXPTYPE' RS-DBI.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:109: error: expected ')' before '*' token RS-DBI.c:137: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:207: error: expected ')' before '*' token RS-DBI.c:261: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token RS-DBI.c:309: error: expected ')' before '*' token RS-DBI.c: In function 'RS_DBI_allocFields': RS-DBI.c:350: warning: implicit declaration of function
[R] plotting prcomp
Please consider the following PCA example; my.df - data.frame(A=(x - rnorm(100,mean=100, sd=10)), B=(y - x + rnorm(100,mean=10, sd=10))) plot(my.df) my.pc - prcomp(my.df, center=TRUE, scale=TRUE) biplot(my.pc) my.x - (my.pc$x)[,1] my.y - (my.pc$x)[,2] plot(my.x, my.y, type=n) text(my.x, my.y, labels=1:100) Clearly the plots have the same relative values, but I can't work out how the second plot is relative to the first. I have been reading the manual, but I still can't work it out. Can anyone show me the code to generate the data that I see plotted using biplot? What am I missing? Dan. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting prcomp
2008/6/27 Prof Brian Ripley [EMAIL PROTECTED]: On Fri, 27 Jun 2008, Prof Brian Ripley wrote: On Fri, 27 Jun 2008, Dan Bolser wrote: Please consider the following PCA example; my.df - data.frame(A=(x - rnorm(100,mean=100, sd=10)), B=(y - x + rnorm(100,mean=10, sd=10))) plot(my.df) my.pc - prcomp(my.df, center=TRUE, scale=TRUE) biplot(my.pc) my.x - (my.pc$x)[,1] my.y - (my.pc$x)[,2] plot(my.x, my.y, type=n) text(my.x, my.y, labels=1:100) Clearly the plots have the same relative values, but I can't work out how the second plot is relative to the first. I have been reading the manual, but I still can't work it out. Can anyone show me the code to generate the data that I see plotted using biplot? I forgot to answer that: just ask R to show you stats:::biplot.prcomp Ah! I never knew the ::: trick! I got it working after looking at the code - my.df - data.frame(A=(x - rnorm(100,mean=100, sd=10)), B=(y - x + rnorm(100,mean=10, sd=10))) plot(my.df) my.pc - prcomp(my.df, center=TRUE, scale=TRUE) biplot(my.pc) attributes(my.pc) head(scores - my.pc$x) lam - my.pc$sdev n - nrow(my.pc$x) lam - lam * sqrt(n) my.x - (my.pc$x)[,1] / lam[1] my.y - (my.pc$x)[,2] / lam[2] plot(my.x, my.y, type=n) text(my.x, my.y, labels=1:100) What am I missing? Reading the references on ?biplot.prcomp, or a good book on the subject (such as MASS or Gower Hand). A biplot is a specific type of plot and the help page does not spell out the rather mathematical details (and there are several variants). Dan. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- hello [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Reminder about R 'chat room'...
If you like using IRC, then you might like to try the channel devoted to R: irc://irc.freenode.net/#R You can go there to ask all your R related questions! -- MetaBase - http://BioDatabase.Org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Setting the xlab for 'the other' (upper) X axis?
I would like to set the 'xlab' on the 'upper' x axis. The following code shows roughly what I want by way of (one possible) expected behaviour. par(mar=c(5.1, 4.1, 5.1, 2.1)) plot(rnorm(10), rnorm(10), xlab=the lower one) axis(3, xlab=the upper one) There are various other ways that could be expected to work, but hopefully the above is clear enough to show you what I want to achieve. The following works, but is fragile (works without resizing the window of an X11 device). title(xlab=the upper one, line=-28) Is there any better way to do it other than tinkering with 'line='? Here is the same code as above but with comments just for reference. # Give upper and lower margins an equal size par(mar=c(5.1, 4.1, 5.1, 2.1)) # Plot (labeling the lower x axis) plot(rnorm(10), rnorm(10), xlab=the lower one) # Add the upper x axis (labeling fails!) axis(3, xlab=the upper one) # Works but is fragile title(xlab=the upper one, line=-28) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Setting the xlab for 'the other' (upper) X axis?
And the answer is... mtext(the upper one?, side=3, line = par(mgp)[1]) 2008/6/19 Dan Bolser [EMAIL PROTECTED]: I would like to set the 'xlab' on the 'upper' x axis. The following code shows roughly what I want by way of (one possible) expected behaviour. par(mar=c(5.1, 4.1, 5.1, 2.1)) plot(rnorm(10), rnorm(10), xlab=the lower one) axis(3, xlab=the upper one) There are various other ways that could be expected to work, but hopefully the above is clear enough to show you what I want to achieve. The following works, but is fragile (works without resizing the window of an X11 device). title(xlab=the upper one, line=-28) Is there any better way to do it other than tinkering with 'line='? Here is the same code as above but with comments just for reference. # Give upper and lower margins an equal size par(mar=c(5.1, 4.1, 5.1, 2.1)) # Plot (labeling the lower x axis) plot(rnorm(10), rnorm(10), xlab=the lower one) # Add the upper x axis (labeling fails!) axis(3, xlab=the upper one) # Works but is fragile title(xlab=the upper one, line=-28) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.