[R] Value passing in print option
i want to pass a value with print option x-10 y2*x print(Current value of y is ) # confused dont know how to pass value i want output as Current value of y is 10 [[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.
Re: [R] Value passing in print option
?paste Best, Uwe Ligges On 20.07.2015 08:48, Partha Sinha wrote: i want to pass a value with print option x-10 y2*x print(Current value of y is ) # confused dont know how to pass value i want output as Current value of y is 10 [[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-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.
Re: [R] modifying a package installed via GitHub
Steve, You are able to work with a github package the same as any github repo. If you clone the repo: git clone https://github.com/user/repo.git If using RStudio it is simple enough to create a new project in that new directory (if the .Rproj file does not exist, otherwise open that). Once you have the project open for that directory you can modify source files and rebuild and install as you like. If at the CMD line, you do as Bob instructed with R CMD install . I recommend, however, either creating a new branch for you changes (if you familiar with git management) or at least make sure to change the subversion of the package so it doesn't conflict with the 'original'. That way you 'know' which version of the package is installed at a given time. Naturally, if you feel your modifications are valuable you may want to actually fork the package on github and create a pull request of your changes for the maintainer to incorporate in to the next release. Hope this helps clarify things, Charles On Sat, Jul 18, 2015 at 8:49 AM, boB Rudis b...@rudis.net wrote: You can go to the package directory: cd /some/path/to/package and do R CMD install . from a command-line there. Many github-based packages are also made using RStudio and you can just open the .Rproj file (i.e. load it into R studio) and build the package there which will install it. The same-named package will overwrite what you have previously installed. Just: devtools::install_github(owner/package) to go back to the original. On Fri, Jul 17, 2015 at 8:12 PM, Steve E. se...@vt.edu wrote: Hi Folks, I am working with a package installed via GitHub that I would like to modify. However, I am not sure how I would go about loading a 'local' version of the package after I have modified it, and whether that process would including uninstalling the original unmodified package (and, conversely, how to uninstall my local, modified version if I wanted to go back to the unmodified version available on GitHub). Any advice would be appreciated. Thanks, Steve -- View this message in context: http://r.789695.n4.nabble.com/modifying-a-package-installed-via-GitHub-tp4710016.html Sent from the R help mailing list archive at Nabble.com. __ 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-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. [[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] Difference between drop1() vs. anova() for Gaussian glm models
Dear list members, I’m having some problems understanding why drop1() and anova() gives different results for *Gaussian* glm models. Here’s a simple example: d = data.frame(x=1:6, group=factor(c(rep(A,2), rep(B, 4 l = glm(x~group, data=d) Running the following code gives *three* different p-values. (I would expect it to give two different p-values.) anova(l, test=F) # p = 0.04179 anova(l, test=Chisq) # p = 0.00313 drop1(l, test=Chisq) # p = 0.00841 I’m used to anova() and drop1() giving identical results for the same ‘test’ argument. However, it looks like the first two tests above use the F- statistic as a test statistic, while the last one uses a ‘scaled deviance’ statistic: 1-pf(8.7273, 1, 4) # F-statistic 1-pchisq(8.7273, 1) # F-statistic 1-pchisq(6.9447, 1) # Scaled deviance I couldn’t find any documentation on this difference. The help page for drop1() does say: The F tests for the glm methods are based on analysis of deviance tests, so if the dispersion is estimated it is based on the residual deviance, unlike the F tests of anova.glm. But here it’s talking about *F* tests. And drop1() with test=F actually gives the *same* p-value as anova() with test=F: drop1(l, test=F) # p = 0.04179 Any ideas why anova() and drop(1) uses different test statistics for the same ‘test’ arguments? And why the help page implies (?) that the results should differ for F-tests (while not mentioning chi-squared test), but here they do not (and the chi-squared tests do)? $ sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-suse-linux-gnu (64-bit) Running under: openSUSE 20150714 (Tumbleweed) (x86_64) locale: [1] LC_CTYPE=nn_NO.UTF-8 LC_NUMERIC=C [3] LC_TIME=nn_NO.UTF-8LC_COLLATE=nn_NO.UTF-8 [5] LC_MONETARY=nn_NO.UTF-8LC_MESSAGES=nn_NO.UTF-8 [7] LC_PAPER=nn_NO.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=nn_NO.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets [6] methods base loaded via a namespace (and not attached): [1] tools_3.2.1 -- Karl Ove Hufthammer E-mail: k...@huftis.org Jabber: huf...@jabber.no __ 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] For Hadley Wickham: Need for a small fix in haven::read_spss
Hadley, you've added function labelled to haven, which is great. However, when it so happens that in SPSS a variable has no long label, your code considers it to be NULL rather than an NA. NULL is correct, but NA would probably be better. For example, I've read in an SPSS file: library(haven) spss1 - read_spss(SPSS_Example.sav) varnames - names(spss1) mylabels - unlist(lapply(spss1, attr, label)) length(varnames) [1] 64 length(mylabels) [1] 62 Because in this particular dataset there were 2 variables without either variable labels or data labels. When I run lapply(spss1, attr, label) I see under those 2 variables NULL - which is true and valid. However, would it be possible to have instead of NULL an NA? This way the length of varnames and mylables would the same and one could put them side by side (e.g., in one data frame)? Thanks a lot! -- Dimitri Liakhovitski __ 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] Differences in output of lme() when introducing interactions
Dear List Members, I am searching for correlations between a dependent variable and a factor or a combination of factors in a repeated measure design. So I use lme() function in R. However, I am getting very different results depending on whether I add on the lme formula various factors compared to when only one is present. If a factor is found to be significant, shouldn't remain significant also when more factors are introduced in the model? I give an example of the outputs I get using the two models. In the first model I use one single factor: library(nlme) summary(lme(Mode ~ Weight, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIC logLik 2119.28 2130.154 -1055.64 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1952.495 2496.424 Fixed effects: Mode ~ Weight Value Std.Error DF t-value p-value (Intercept) 10308.966 2319.0711 95 4.445299 0.000 Weight-99.036 32.3094 17 -3.065233 0.007 Correlation: (Intr) Weight -0.976 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.74326719 -0.41379593 -0.06508451 0.39578734 2.27406649 Number of Observations: 114 Number of Groups: 19 As you can see the p-value for factor Weight is significant. This is the second model, in which I add various factors for searching their correlations: library(nlme) summary(lme(Mode ~ Weight*Height*Shoe_Size*BMI, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIClogLik 1975.165 2021.694 -969.5825 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.127993 2494.826 Fixed effects: Mode ~ Weight * Height * Shoe_Size * BMI Value Std.Error DFt-value p-value (Intercept) 5115955 10546313 95 0.4850941 0.6287 Weight -13651237 6939242 3 -1.9672518 0.1438 Height -18678 53202 3 -0.3510740 0.7487 Shoe_Size 93427213737 3 0.4371115 0.6916 BMI -13011088 7148969 3 -1.8199949 0.1663 Weight:Height 28128 14191 3 1.9820883 0.1418 Weight:Shoe_Size 351453186304 3 1.8864467 0.1557 Height:Shoe_Size -783 1073 3 -0.7298797 0.5183 Weight:BMI 19475 11425 3 1.7045450 0.1868 Height:BMI 226512118364 3 1.9136867 0.1516 Shoe_Size:BMI 329377190294 3 1.7308827 0.1819 Weight:Height:Shoe_Size -706 371 3 -1.9014817 0.1534 Weight:Height:BMI-10963 3 -1.7258742 0.1828 Weight:Shoe_Size:BMI -273 201 3 -1.3596421 0.2671 Height:Shoe_Size:BMI-5858 3200 3 -1.8306771 0.1646 Weight:Height:Shoe_Size:BMI 2 1 3 1.3891782 0.2589 Correlation: (Intr) Weight Height Sho_Sz BMIWght:H Wg:S_S Hg:S_S Wg:BMI Hg:BMI S_S:BM Wg:H:S_S W:H:BM W:S_S: H:S_S: Weight -0.895 Height -0.996 0.869 Shoe_Size -0.930 0.694 0.933 BMI -0.911 0.998 0.887 0.720 Weight:Height0.894 -1.000 -0.867 -0.692 -0.997 Weight:Shoe_Size 0.898 -0.997 -0.873 -0.700 -0.999 0.995 Height:Shoe_Size 0.890 -0.612 -0.904 -0.991 -0.641 0.609 0.619 Weight:BMI 0.911 -0.976 -0.887 -0.715 -0.972 0.980 0.965 0.637 Height:BMI 0.900 -1.000 -0.875 -0.703 -0.999 0.999 0.999 0.622 0.973 Shoe_Size:BMI0.912 -0.992 -0.889 -0.726 -0.997 0.988 0.998 0.649 0.958 0.995 Weight:Height:Shoe_Size -0.901 0.999 0.876 0.704 1.000 -0.997 -1.000 -0.623 -0.971 -1.000 -0.997 Weight:Height:BMI -0.908 0.978 0.886 0.704 0.974 -0.982 -0.968 -0.627 -0.999 -0.975 -0.961 0.973 Weight:Shoe_Size:BMI-0.949 0.941 0.928 0.818 0.940 -0.946 -0.927 -0.751 -0.980 -0.938 -0.924 0.9350.974 Height:Shoe_Size:BMI-0.901 0.995 0.878
Re: [R] For Hadley Wickham: Need for a small fix in haven::read_spss
(FWIW this would've been better send to me directly or filed on github, rather than sent to R-help) I think this is more of a problem with the way that you're accessing the info, than the design of the underlying structure. I'd do something like this: attr_default - function(x, which, default) { val - attr(x, which) if (is.null(val)) default else val } sapply(spss1, attr_default, label, NA_character_) (code untested, but you get the idea) Hadley On Mon, Jul 20, 2015 at 8:56 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hadley, you've added function labelled to haven, which is great. However, when it so happens that in SPSS a variable has no long label, your code considers it to be NULL rather than an NA. NULL is correct, but NA would probably be better. For example, I've read in an SPSS file: library(haven) spss1 - read_spss(SPSS_Example.sav) varnames - names(spss1) mylabels - unlist(lapply(spss1, attr, label)) length(varnames) [1] 64 length(mylabels) [1] 62 Because in this particular dataset there were 2 variables without either variable labels or data labels. When I run lapply(spss1, attr, label) I see under those 2 variables NULL - which is true and valid. However, would it be possible to have instead of NULL an NA? This way the length of varnames and mylables would the same and one could put them side by side (e.g., in one data frame)? Thanks a lot! -- Dimitri Liakhovitski __ 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. -- http://had.co.nz/ __ 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.
Re: [R] For Hadley Wickham: Need for a small fix in haven::read_spss
Thank you, Hadley. Yes, you are right - next time I'll email you directly. On Mon, Jul 20, 2015 at 10:01 AM, Hadley Wickham h.wick...@gmail.com wrote: (FWIW this would've been better send to me directly or filed on github, rather than sent to R-help) I think this is more of a problem with the way that you're accessing the info, than the design of the underlying structure. I'd do something like this: attr_default - function(x, which, default) { val - attr(x, which) if (is.null(val)) default else val } sapply(spss1, attr_default, label, NA_character_) (code untested, but you get the idea) Hadley On Mon, Jul 20, 2015 at 8:56 AM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hadley, you've added function labelled to haven, which is great. However, when it so happens that in SPSS a variable has no long label, your code considers it to be NULL rather than an NA. NULL is correct, but NA would probably be better. For example, I've read in an SPSS file: library(haven) spss1 - read_spss(SPSS_Example.sav) varnames - names(spss1) mylabels - unlist(lapply(spss1, attr, label)) length(varnames) [1] 64 length(mylabels) [1] 62 Because in this particular dataset there were 2 variables without either variable labels or data labels. When I run lapply(spss1, attr, label) I see under those 2 variables NULL - which is true and valid. However, would it be possible to have instead of NULL an NA? This way the length of varnames and mylables would the same and one could put them side by side (e.g., in one data frame)? Thanks a lot! -- Dimitri Liakhovitski __ 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. -- http://had.co.nz/ -- Dimitri Liakhovitski __ 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.
Re: [R] To simplify or not simplify?
This forum is for questions about R. There are forums that focus on the theory of statistics (e.g. stats.stackexchage.com), but this particular issue is addressed in many statistics classes as well... and there is not necessarily a simple answer that always applies in all cases so be prepared to validate your model against a data set set aside for that purpose. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On July 20, 2015 2:02:24 AM PDT, Georgina Southon g.sout...@sheffield.ac.uk wrote: Dear R help, This is rather a basic question, but I can't seem to find an answer anywhere else. When I run a model such as lm/aov(height~var1) where var 1 is a categorical variable with 6 levels, I get output that shows some significant parameters and other non significant. Normally I would then proceed to simplify the model by removing the insignificant terms, however, I have recently begun to wonder if that should be standard practice or whether the full model output (not reduced by simplification) has more integrity and should be retained? Any thoughts would be most welcome! Thanks, Lizzie [[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-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] Printing row and column names of cells with specific value in a big matrix
Hi All I've two big matrices (5k*4k) with the same structure, i.e. : mRNA1 mRNA2 mRNA3 lncRNA1 0.395646 0.94995 0.76177 lncRNA2 0.03791 0.661258 0.558658 lncRNA3 0.67846 0.652364 0.359054 lncRNA4 0.57769 0.003 0.459127 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? Regards -- *Gaurav Kandoi* [[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.
Re: [R] Knitr: setting echo = FALSE globally
Section 5.1.3 of the book Dynamic Documents with R and knitr is titled Global Options. I don't know how to make it more clear for readers to find information on global options in the book. Regards, Yihui -- Yihui Xie xieyi...@gmail.com Web: http://yihui.name On Mon, Jul 20, 2015 at 12:58 PM, Rich Shepard rshep...@appl-ecosys.com wrote: Near the beginning of a LyX document I have a knitr chunk with options that begin with 'global_options', and includes echo=F. This presents the R code in that chunk from displaying in the compiled PDF file. However, all following knitr chunks are included in the PDF file. Reading the docs (including the Knitr book) does not show me what I am doing incorrectly. A pointer to the solution is needed. Rich __ 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.
Re: [R] Value passing in print option
Also: cat(Current value of y is,y,\n) Cheers, K On Mon, Jul 20, 2015 at 8:24 AM Uwe Ligges lig...@statistik.tu-dortmund.de wrote: ?paste Best, Uwe Ligges On 20.07.2015 08:48, Partha Sinha wrote: i want to pass a value with print option x-10 y2*x print(Current value of y is ) # confused dont know how to pass value i want output as Current value of y is 10 [[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-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. [[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] jaccards index
hi.. I have a csv file containing 35 coloumns and 193 rows.i want to generate jaccards index to normalise these data.how can i do this also from these data i want to draw boxplot.plz help -- View this message in context: http://r.789695.n4.nabble.com/jaccards-index-tp4710057.html Sent from the R help mailing list archive at Nabble.com. __ 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] Knitr: setting echo = FALSE globally
Near the beginning of a LyX document I have a knitr chunk with options that begin with 'global_options', and includes echo=F. This presents the R code in that chunk from displaying in the compiled PDF file. However, all following knitr chunks are included in the PDF file. Reading the docs (including the Knitr book) does not show me what I am doing incorrectly. A pointer to the solution is needed. Rich __ 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.
Re: [R] Knitr: setting echo = FALSE globally
Have you tried echo = FALSE instead of echo = F. If that doesn't solve your problem, please provide a minimal reproducible example. Op 20-jul.-2015 20:02 schreef Rich Shepard rshep...@appl-ecosys.com: Near the beginning of a LyX document I have a knitr chunk with options that begin with 'global_options', and includes echo=F. This presents the R code in that chunk from displaying in the compiled PDF file. However, all following knitr chunks are included in the PDF file. Reading the docs (including the Knitr book) does not show me what I am doing incorrectly. A pointer to the solution is needed. Rich __ 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. [[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] using dcast with a function of multiple arguments
I am trying to figure out how to use dcast.data.table with a function with multiple arguments. Here is my reproducible example for a simple function of one argument: require(data.table) dt - as.data.table(mtcars) dcast.data.table(dt, carb ~ cyl, value.var='mpg', fun=mean) If I instead want to use, say, weighted.mean(x, w), how do I do so? The docs say ... Any other arguments that maybe passed to the aggregating function. So I tried: dcast.data.table(dt, carb ~ cyl, value.var='mpg', fun=weighted.mean, w=wt) Error in weighted.mean.default(data[[value.var]][0], ...) : 'x' and 'w' must have the same length The docs also say that value.var can be a list, so I tried that: In cases where value.var is a list, the function should be able to handle a list input and provide a single value or list of length one as output. dcast.data.table(dt, carb ~ cyl, value.var=list('mpg','wt'), fun=weighted.mean) Error in dcast.data.table(dt, carb ~ cyl, value.var = list(mpg, wt), : 'value.var' must be a character vector of length 1. I didn't actually expect that to work, but without an example I don't know what else to try. Any hints would be greatly appreciated. Thanks, Roger *** This message and any attachments are for the intended recipient's use only. This message may contain confidential, proprietary or legally privileged information. No right to confidential or privileged treatment of this message is waived or lost by an error in transmission. If you have received this message in error, please immediately notify the sender by e-mail, delete the message, any attachments and all copies from your system and destroy any hard copies. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message or any attachments if you are not the intended recipient. __ 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.
Re: [R] jaccards index
Sarah Goslee’s package “ecodist” will compute a Jaccard index, I believe. You are unlikely to get much help, however, unless you provide more details as to what you are trying to accomplish. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for how to create a reproducible example, as requested in the PostingGuide. On Jul 19, 2015, at 10:23 PM, sreenath sreenath.ra...@macfast.ac.in wrote: hi.. I have a csv file containing 35 coloumns and 193 rows.i want to generate jaccards index to normalise these data.how can i do this also from these data i want to draw boxplot.plz help -- View this message in context: http://r.789695.n4.nabble.com/jaccards-index-tp4710057.html Sent from the R help mailing list archive at Nabble.com. __ 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-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] error reading file DESCRIPTION
Hello, After downloading imview from SourceForge.net http://sourceforge.net/projects/imview/?source=directory, I get the following error and warning when trying to install this package: install.packages(~/Downloads/imview-src-1.0.1.tar.gz, repos = NULL, type = source) Error: error reading file '/var/folders/57/76qlq1g9607g8nm3pv7txydwgp/T//Rtmp9Xr791/R.INSTALL4b47344defc/imview-1.0.1/DESCRIPTION' Warning in install.packages : installation of package ‘/Users/wmorgan/Downloads/imview-src-1.0.1.tar.gz’ had non-zero exit status Any suggestions on how to solve this problem? Thanks, Bill P.S. I’m using R Studio, on a Mac Airbook with OS 10.10.4. William R. Morgan, Ph.D. Theron L. Peterson and Dorothy R. Peterson Professor of Biology The College of Wooster Department of Biology 931 College Mall Wooster, OH 44691 330-263-2379 wmor...@wooster.edu __ 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] help with contributed package MTS
Dear Sirs: I am using R-3.2.1, and when I type install.packages(�MTS�), I get the message: package �MTS� is not available (for R version 3.2.1). I have tried also to install from local zip files, and I got it, but when I type: library(MTS), I got the message that Rcpp was absent. Would you please, tell me how to install MTS in R-3.2.1? Thanks a lot Agust�n Alonso [[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.
Re: [R] To simplify or not simplify?
Off topic . This list is about R programming. Post on a statistics list like stats.stackexchange.com instead. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Jul 20, 2015 at 2:02 AM, Georgina Southon g.sout...@sheffield.ac.uk wrote: Dear R help, This is rather a basic question, but I can't seem to find an answer anywhere else. When I run a model such as lm/aov(height~var1) where var 1 is a categorical variable with 6 levels, I get output that shows some significant parameters and other non significant. Normally I would then proceed to simplify the model by removing the insignificant terms, however, I have recently begun to wonder if that should be standard practice or whether the full model output (not reduced by simplification) has more integrity and should be retained? Any thoughts would be most welcome! Thanks, Lizzie [[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-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.
Re: [R] help with contributed package MTS
Hi, On Mon, Jul 20, 2015 at 2:01 PM, AGUSTIN ALONSO RODRIGUEZ aalo...@rcumariacristina.com wrote: I am using R-3.2.1, and when I type install.packages(“MTS”), I get the message: package ‘MTS’ is not available (for R version 3.2.1). It's on CRAN, and passes check for R-release: https://cran.r-project.org/web/checks/check_results_MTS.html I didn't have any problem installing it with install.packages(). I'd suggest trying again after installing the requirements (see below), and if you still have no success posting your sessionInfo(). I have tried also to install from local zip files, and I got it, but when I type: library(MTS), I got the message that Rcpp was absent. That means you need to install the Rcpp package before you can install MTS. You can see these requirements listed: https://cran.r-project.org/web/packages/MTS/index.html Would you please, tell me how to install MTS in R-3.2.1? By reading and following the error messages you received. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ 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] ggplot2 geom_boxplot limits
With base graphics, one can use the ylim argument to zoom in on a boxplot. With ggplot2, using limits to try to zoom in on a boxplot *changes the box*. Since the box usually indicates the 25th and 75th percentiles of a quantitative variable, this is puzzling. The toy code below demonstrates this. In ggplot2, zooming in causes the two boxes to overlap, when they did not overlap in the full plot. Also, the center lines --- which usually indicate the median of the variable --- change when one zooms in. In base graphics, zooming in does not cause the boxes to overlap or, as far as I can see, the median line to move relative to the scale. What is going on here? pdf(file=toy-example.pdf) set.seed(1) toy1-data.frame(Y=rnorm(500, mean=3), A=one) toy2-data.frame(Y=rnorm(500, mean=1.6), A=two) toy-rbind(toy1,toy2) toy$A-factor(toy$A) library(ggplot2) mybreaks-signif(seq(from=min(toy$Y),to=max(toy$Y),by=0.5),digits=2) mylimits-c(0.61,3.7) print(myplot-ggplot(toy, aes(x=A,y=Y)) + geom_boxplot()+scale_y_continuous(breaks=mybreaks)+theme_bw()) print(myplot+scale_y_continuous(breaks=mybreaks,limits=mylimits)) boxplot(toy1$Y,toy2$Y) boxplot(toy1$Y,toy2$Y, ylim=mylimits) graphics.off() sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.4 (Yosemite) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_1.0.1 loaded via a namespace (and not attached): [1] MASS_7.3-40 colorspace_1.2-6 scales_0.2.5 magrittr_1.5 plyr_1.8.3 tools_3.2.1 gtable_0.1.2 reshape2_1.4.1 [9] Rcpp_0.11.6 stringi_0.5-5grid_3.2.1 stringr_1.0.0 digest_0.6.8 proto_0.3-10 munsell_0.4.2 Jacob A. Wegelin __ 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.
Re: [R] best way to globally set parameters for base graphics
On 20/07/2015 11:27 AM, Martin Batholdy via R-help wrote: Hi, I am looking for a way to modify the basic setup for any kind of plot. (everything that is set with the par function – like margins, cex, las etc.) I want to do this once – preferably across R sessions and not individually before every plot. My first attempt was to add a par() with all my own defaults to the .Rprofile file. This obviously does not work because par opens a new drawing device, applying its effect only to this device. My next attempt was to write my own version of all basic plot functions (like plot, barplot etc.) adding a par() call within these functions. This works but only if I draw a single plot. As soon as I want to use mfrow or layout to draw multiple plots side by side into one device this version also does not work, since each of these functions will open a new drawing device by themselves. So, my question is; Is there any way to globally define parameters given to par() so that they apply to all plots in (at least) an entire R-session? I haven't played with it, but setting a plot.new hook (or before.plot.new) might do it for you. See ?plot.new. It might be tricky, because some par() parameters (e.g. mfrow) shouldn't be called before every plot. You'd have to look at par(mfrow) to decide whether to call it or not. Duncan Murdoch __ 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.
Re: [R] Differences in output of lme() when introducing interactions
In-line On 20/07/2015 15:10, angelo.arc...@virgilio.it wrote: Dear List Members, I am searching for correlations between a dependent variable and a factor or a combination of factors in a repeated measure design. So I use lme() function in R. However, I am getting very different results depending on whether I add on the lme formula various factors compared to when only one is present. If a factor is found to be significant, shouldn't remain significant also when more factors are introduced in the model? The short answer is 'No'. The long answer is contained in any good book on statistics which you really need to have by your side as the long answer is too long to include in an email. I give an example of the outputs I get using the two models. In the first model I use one single factor: library(nlme) summary(lme(Mode ~ Weight, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIC logLik 2119.28 2130.154 -1055.64 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1952.495 2496.424 Fixed effects: Mode ~ Weight Value Std.Error DF t-value p-value (Intercept) 10308.966 2319.0711 95 4.445299 0.000 Weight-99.036 32.3094 17 -3.065233 0.007 Correlation: (Intr) Weight -0.976 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.74326719 -0.41379593 -0.06508451 0.39578734 2.27406649 Number of Observations: 114 Number of Groups: 19 As you can see the p-value for factor Weight is significant. This is the second model, in which I add various factors for searching their correlations: library(nlme) summary(lme(Mode ~ Weight*Height*Shoe_Size*BMI, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIClogLik 1975.165 2021.694 -969.5825 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.127993 2494.826 Fixed effects: Mode ~ Weight * Height * Shoe_Size * BMI Value Std.Error DFt-value p-value (Intercept) 5115955 10546313 95 0.4850941 0.6287 Weight -13651237 6939242 3 -1.9672518 0.1438 Height -18678 53202 3 -0.3510740 0.7487 Shoe_Size 93427213737 3 0.4371115 0.6916 BMI -13011088 7148969 3 -1.8199949 0.1663 Weight:Height 28128 14191 3 1.9820883 0.1418 Weight:Shoe_Size 351453186304 3 1.8864467 0.1557 Height:Shoe_Size -783 1073 3 -0.7298797 0.5183 Weight:BMI 19475 11425 3 1.7045450 0.1868 Height:BMI 226512118364 3 1.9136867 0.1516 Shoe_Size:BMI 329377190294 3 1.7308827 0.1819 Weight:Height:Shoe_Size -706 371 3 -1.9014817 0.1534 Weight:Height:BMI-10963 3 -1.7258742 0.1828 Weight:Shoe_Size:BMI -273 201 3 -1.3596421 0.2671 Height:Shoe_Size:BMI-5858 3200 3 -1.8306771 0.1646 Weight:Height:Shoe_Size:BMI 2 1 3 1.3891782 0.2589 Correlation: (Intr) Weight Height Sho_Sz BMIWght:H Wg:S_S Hg:S_S Wg:BMI Hg:BMI S_S:BM Wg:H:S_S W:H:BM W:S_S: H:S_S: Weight -0.895 Height -0.996 0.869 Shoe_Size -0.930 0.694 0.933 BMI -0.911 0.998 0.887 0.720 Weight:Height0.894 -1.000 -0.867 -0.692 -0.997 Weight:Shoe_Size 0.898 -0.997 -0.873 -0.700 -0.999 0.995 Height:Shoe_Size 0.890 -0.612 -0.904 -0.991 -0.641 0.609 0.619 Weight:BMI 0.911 -0.976 -0.887 -0.715 -0.972 0.980 0.965 0.637 Height:BMI 0.900 -1.000 -0.875 -0.703 -0.999 0.999 0.999 0.622 0.973 Shoe_Size:BMI0.912 -0.992 -0.889 -0.726 -0.997 0.988 0.998 0.649 0.958 0.995 Weight:Height:Shoe_Size -0.901 0.999 0.876 0.704 1.000 -0.997 -1.000 -0.623 -0.971 -1.000 -0.997 Weight:Height:BMI -0.908 0.978 0.886 0.704 0.974 -0.982 -0.968 -0.627 -0.999 -0.975 -0.961 0.973 Weight:Shoe_Size:BMI-0.949 0.941 0.928 0.818 0.940 -0.946 -0.927 -0.751 -0.980 -0.938 -0.924 0.9350.974 Height:Shoe_Size:BMI-0.901 0.995 0.878 0.707 0.998 -0.992 -1.000 -0.627 -0.960 -0.997 -0.999 0.9990.964 0.923 Weight:Height:Shoe_Size:BMI 0.952 -0.948 -0.933 -0.812 -0.947 0.953 0.935 0.747 0.985 0.946 0.932 -0.943 -0.980 -0.999 -0.931 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.03523736 -0.47889716 -0.02149143 0.41118126 2.20012158 Number of Observations: 114 Number of Groups: 19 This time the p-value associated to Weight is not significant anymore. Why?
[R] To simplify or not simplify?
Dear R help, This is rather a basic question, but I can't seem to find an answer anywhere else. When I run a model such as lm/aov(height~var1) where var 1 is a categorical variable with 6 levels, I get output that shows some significant parameters and other non significant. Normally I would then proceed to simplify the model by removing the insignificant terms, however, I have recently begun to wonder if that should be standard practice or whether the full model output (not reduced by simplification) has more integrity and should be retained? Any thoughts would be most welcome! Thanks, Lizzie [[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] R GUI tklistbox get value
Hi, i have a dataframe, dat, with 2 variables, one and two. I want to print in R the mean of the selected variable of the dataframe. You can select it with a tklistbox, but when you click OK button, the mean is not displayed, just NA one-c(5,5,6,9,5,8) two-c(12,13,14,12,14,12) dat-data.frame(uno,dos) require(tcltk) tt-tktoplevel() tl-tklistbox(tt,height=4,selectmode=single) tkgrid(tklabel(tt,text=Selecciona la variable para calcular media)) tkgrid(tl) for (i in (1:4)) { tkinsert(tl,end,colnames(dat[i])) } OnOK - function() { selecvar - dat[as.numeric(tkcurselection(tl))+1] print(mean(selecvar)) } OK.but -tkbutton(tt,text= OK ,command=OnOK) tkgrid(OK.but) tkfocus(tt) # Can someone please help me?? Thanks!!! -- View this message in context: http://r.789695.n4.nabble.com/R-GUI-tklistbox-get-value-tp4710064.html Sent from the R help mailing list archive at Nabble.com. __ 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] best way to globally set parameters for base graphics
Hi, I am looking for a way to modify the basic setup for any kind of plot. (everything that is set with the par function – like margins, cex, las etc.) I want to do this once – preferably across R sessions and not individually before every plot. My first attempt was to add a par() with all my own defaults to the .Rprofile file. This obviously does not work because par opens a new drawing device, applying its effect only to this device. My next attempt was to write my own version of all basic plot functions (like plot, barplot etc.) adding a par() call within these functions. This works but only if I draw a single plot. As soon as I want to use mfrow or layout to draw multiple plots side by side into one device this version also does not work, since each of these functions will open a new drawing device by themselves. So, my question is; Is there any way to globally define parameters given to par() so that they apply to all plots in (at least) an entire R-session? Thank You! __ 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.
Re: [R] Difference between drop1() vs. anova() for Gaussian glm models
I am somewhat surprised that _anything_ sensible comes out of anova.glm(l, test=Chisq). I think it is mostly expected that you use F tests for that case. What does seem to come out is the same as for drop1(l, test=Rao), which gives the scaled score test, which would seem to be equivalent to scaled deviance in this case. drop1.glm(l, test=Chisq) appears to be calculating the real likelihood ratio test, evaluated in its asymptotic chi-square distribution: 2*(logLik(l) - logLik(update(l,.~1))) 'log Lik.' 6.944717 (df=3) (Apologies for the daft output there... Why does - not either subtract the df or unclass the whole thing?) Notice that the scaled tests basically assume that the scale is known, even if it is estimated, so in that sense, the real LRT should be superior. However, in that case it is well known that the asymptotic approximation can be improved by transforming the LRT to the F statistic, whose exact distribution is known. The remaining part of the riddle is why anova.glm doesn't do likelihood differences in the same fashion as drop1.glm. My best guess is that it tries to be consistent with anova.lm and anova.lm tries not to have to refit the sequence of submodels. On 20 Jul 2015, at 14:59 , Karl Ove Hufthammer k...@huftis.org wrote: Dear list members, I’m having some problems understanding why drop1() and anova() gives different results for *Gaussian* glm models. Here’s a simple example: d = data.frame(x=1:6, group=factor(c(rep(A,2), rep(B, 4 l = glm(x~group, data=d) Running the following code gives *three* different p-values. (I would expect it to give two different p-values.) anova(l, test=F) # p = 0.04179 anova(l, test=Chisq) # p = 0.00313 drop1(l, test=Chisq) # p = 0.00841 I’m used to anova() and drop1() giving identical results for the same ‘test’ argument. However, it looks like the first two tests above use the F- statistic as a test statistic, while the last one uses a ‘scaled deviance’ statistic: 1-pf(8.7273, 1, 4) # F-statistic 1-pchisq(8.7273, 1) # F-statistic 1-pchisq(6.9447, 1) # Scaled deviance I couldn’t find any documentation on this difference. The help page for drop1() does say: The F tests for the glm methods are based on analysis of deviance tests, so if the dispersion is estimated it is based on the residual deviance, unlike the F tests of anova.glm. But here it’s talking about *F* tests. And drop1() with test=F actually gives the *same* p-value as anova() with test=F: drop1(l, test=F) # p = 0.04179 Any ideas why anova() and drop(1) uses different test statistics for the same ‘test’ arguments? And why the help page implies (?) that the results should differ for F-tests (while not mentioning chi-squared test), but here they do not (and the chi-squared tests do)? $ sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-suse-linux-gnu (64-bit) Running under: openSUSE 20150714 (Tumbleweed) (x86_64) locale: [1] LC_CTYPE=nn_NO.UTF-8 LC_NUMERIC=C [3] LC_TIME=nn_NO.UTF-8LC_COLLATE=nn_NO.UTF-8 [5] LC_MONETARY=nn_NO.UTF-8LC_MESSAGES=nn_NO.UTF-8 [7] LC_PAPER=nn_NO.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=nn_NO.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets [6] methods base loaded via a namespace (and not attached): [1] tools_3.2.1 -- Karl Ove Hufthammer E-mail: k...@huftis.org Jabber: huf...@jabber.no __ 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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.
Re: [R] best way to globally set parameters for base graphics
Thanks for the reply. It works fine for a single plot-call. But as soon as I call layout() before plotting I again run into the problem that plots are not drawn into one graphic device but another one is opened for the second plot-call. see here; setHook(plot.new, function() par(bty='n', cex=0.8, las=1, ann=F, lwd=2, mar=c(5, 4, 2, 1), oma=c(0,0,0,0), pch=19, xpd=T, cex.axis=0.85, mgp=c(2.5, 0.72, 0), tcl=-0.4 ) ) layout(matrix(1:2, 1, 2, byrow=T)) plot(c(1,2,3)) plot(c(3,2,1)) On 20 Jul 2015, at 17:48 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 20/07/2015 11:27 AM, Martin Batholdy via R-help wrote: Hi, I am looking for a way to modify the basic setup for any kind of plot. (everything that is set with the par function – like margins, cex, las etc.) I want to do this once – preferably across R sessions and not individually before every plot. My first attempt was to add a par() with all my own defaults to the .Rprofile file. This obviously does not work because par opens a new drawing device, applying its effect only to this device. My next attempt was to write my own version of all basic plot functions (like plot, barplot etc.) adding a par() call within these functions. This works but only if I draw a single plot. As soon as I want to use mfrow or layout to draw multiple plots side by side into one device this version also does not work, since each of these functions will open a new drawing device by themselves. So, my question is; Is there any way to globally define parameters given to par() so that they apply to all plots in (at least) an entire R-session? I haven't played with it, but setting a plot.new hook (or before.plot.new) might do it for you. See ?plot.new. It might be tricky, because some par() parameters (e.g. mfrow) shouldn't be called before every plot. You'd have to look at par(mfrow) to decide whether to call it or not. Duncan Murdoch __ 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.
Re: [R] ggplot2 geom_boxplot limits
Here is the answer: http://rpubs.com/INBOstats/zoom_in ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-07-20 22:19 GMT+02:00 Jacob Wegelin jacobwege...@fastmail.fm: On 2015-07-20 Mon 15:19, Thierry Onkelinx wrote: Limits in scales set values outside the limits to NA. Hence the boxplots, smoothers,... change. Use coord_cartesian() to zoom in. Thanks. What do I do if I also want to use coord_flip(), that is, if I want the boxes to lie horizontally *and* to zoom in? myplot+coord_cartesian(ylim=mylimits) # zooms in myplot+coord_cartesian(ylim=mylimits) + coord_flip() # flips but does not zoom myplot + coord_flip()+coord_cartesian(ylim=mylimits) # zooms but does not flip Jacob Wegelin Op 20-jul.-2015 20:29 schreef Jacob Wegelin jacobwege...@fastmail.fm: With base graphics, one can use the ylim argument to zoom in on a boxplot. With ggplot2, using limits to try to zoom in on a boxplot *changes the box*. Since the box usually indicates the 25th and 75th percentiles of a quantitative variable, this is puzzling. The toy code below demonstrates this. In ggplot2, zooming in causes the two boxes to overlap, when they did not overlap in the full plot. Also, the center lines --- which usually indicate the median of the variable --- change when one zooms in. In base graphics, zooming in does not cause the boxes to overlap or, as far as I can see, the median line to move relative to the scale. What is going on here? pdf(file=toy-example.pdf) set.seed(1) toy1-data.frame(Y=rnorm(500, mean=3), A=one) toy2-data.frame(Y=rnorm(500, mean=1.6), A=two) toy-rbind(toy1,toy2) toy$A-factor(toy$A) library(ggplot2) mybreaks-signif(seq(from=min(toy$Y),to=max(toy$Y),by=0.5),digits=2) mylimits-c(0.61,3.7) print(myplot-ggplot(toy, aes(x=A,y=Y)) + geom_boxplot()+scale_y_continuous(breaks=mybreaks)+theme_bw()) print(myplot+scale_y_continuous(breaks=mybreaks,limits=mylimits)) boxplot(toy1$Y,toy2$Y) boxplot(toy1$Y,toy2$Y, ylim=mylimits) graphics.off() sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.4 (Yosemite) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_1.0.1 loaded via a namespace (and not attached): [1] MASS_7.3-40 colorspace_1.2-6 scales_0.2.5 magrittr_1.5 plyr_1.8.3 tools_3.2.1 gtable_0.1.2 reshape2_1.4.1 [9] Rcpp_0.11.6 stringi_0.5-5grid_3.2.1 stringr_1.0.0 digest_0.6.8 proto_0.3-10 munsell_0.4.2 Jacob A. Wegelin __ 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. [[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.
Re: [R] change text size on a graphics
On Jul 20, 2015, at 1:24 PM, carol white via R-help wrote: Hi,How is it possible to increase the size of a histogram labels (displayed on the top of the bars)? I thought that if I use cex 1, it will increase all text size on a plot (axis labels, axis annotation, title of the graphics and histogram labels) which I want but it doesn't. Need to know which function you are using to determine where your thinking (or failure to read the documentation) has gone wrong. Regards, Carol [[alternative HTML version deleted]] You have been advised to stop using HTML in the past. What sort of incentive is needed? __ 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. David Winsemius Alameda, CA, USA __ 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.
Re: [R] [FORGED] change text size on a graphics
On 21/07/15 08:24, carol white via R-help wrote: Hi,How is it possible to increase the size of a histogram labels (displayed on the top of the bars)? I thought that if I use cex 1, it will increase all text size on a plot (axis labels, axis annotation, title of the graphics and histogram labels) which I want but it doesn't. ***What*** labels displayed on the top of the bars??? I don't see any such labels when I plot a histogram. Reproducible example? And please don't post in HTML. cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ 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.
Re: [R] jaccards index
On Mon, Jul 20, 2015 at 2:02 PM, Don McKenzie d...@u.washington.edu wrote: Sarah Goslee’s package “ecodist” will compute a Jaccard index, I believe. Indeed it does, and for that matter so does the dist() function in base R. But I couldn't see how that index could be used to normalize data, being a dissimilarity on pairwise samples, so I left the question alone hoping it made more sense to someone else on the list. You are unlikely to get much help, however, unless you provide more details as to what you are trying to accomplish. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for how to create a reproducible example, as requested in the PostingGuide. Please do! You might also try reading the documentation about data import and boxplots. http://www.rseek.org might help you find the appropriate docs. Sarah On Jul 19, 2015, at 10:23 PM, sreenath sreenath.ra...@macfast.ac.in wrote: hi.. I have a csv file containing 35 coloumns and 193 rows.i want to generate jaccards index to normalise these data.how can i do this also from these data i want to draw boxplot.plz help -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] ggplot2 geom_boxplot limits
Limits in scales set values outside the limits to NA. Hence the boxplots, smoothers,... change. Use coord_cartesian() to zoom in. Op 20-jul.-2015 20:29 schreef Jacob Wegelin jacobwege...@fastmail.fm: With base graphics, one can use the ylim argument to zoom in on a boxplot. With ggplot2, using limits to try to zoom in on a boxplot *changes the box*. Since the box usually indicates the 25th and 75th percentiles of a quantitative variable, this is puzzling. The toy code below demonstrates this. In ggplot2, zooming in causes the two boxes to overlap, when they did not overlap in the full plot. Also, the center lines --- which usually indicate the median of the variable --- change when one zooms in. In base graphics, zooming in does not cause the boxes to overlap or, as far as I can see, the median line to move relative to the scale. What is going on here? pdf(file=toy-example.pdf) set.seed(1) toy1-data.frame(Y=rnorm(500, mean=3), A=one) toy2-data.frame(Y=rnorm(500, mean=1.6), A=two) toy-rbind(toy1,toy2) toy$A-factor(toy$A) library(ggplot2) mybreaks-signif(seq(from=min(toy$Y),to=max(toy$Y),by=0.5),digits=2) mylimits-c(0.61,3.7) print(myplot-ggplot(toy, aes(x=A,y=Y)) + geom_boxplot()+scale_y_continuous(breaks=mybreaks)+theme_bw()) print(myplot+scale_y_continuous(breaks=mybreaks,limits=mylimits)) boxplot(toy1$Y,toy2$Y) boxplot(toy1$Y,toy2$Y, ylim=mylimits) graphics.off() sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.4 (Yosemite) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_1.0.1 loaded via a namespace (and not attached): [1] MASS_7.3-40 colorspace_1.2-6 scales_0.2.5 magrittr_1.5 plyr_1.8.3 tools_3.2.1 gtable_0.1.2 reshape2_1.4.1 [9] Rcpp_0.11.6 stringi_0.5-5grid_3.2.1 stringr_1.0.0 digest_0.6.8 proto_0.3-10 munsell_0.4.2 Jacob A. Wegelin __ 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. [[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.
Re: [R] Knitr: setting echo = FALSE globally
On Mon, 20 Jul 2015, Yihui Xie wrote: Section 5.1.3 of the book Dynamic Documents with R and knitr is titled Global Options. I don't know how to make it more clear for readers to find information on global options in the book. Yes, I've read that and have not found where 'opts_chunk$set(echo = FALSE)' should be inserted in the document. If I put it in the first chunk, outside the options box, pdflatex throws an error. If it is in it's own chunk, either by itself or in the options box, there's the same verbose error when trying to compile it. When I put it in the body of the document it's printed as is. Where should that command be entered in the document? Rich __ 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.
Re: [R] ggplot2 geom_boxplot limits
On 2015-07-20 Mon 15:19, Thierry Onkelinx wrote: Limits in scales set values outside the limits to NA. Hence the boxplots, smoothers,... change. Use coord_cartesian() to zoom in. Thanks. What do I do if I also want to use coord_flip(), that is, if I want the boxes to lie horizontally *and* to zoom in? myplot+coord_cartesian(ylim=mylimits) # zooms in myplot+coord_cartesian(ylim=mylimits) + coord_flip() # flips but does not zoom myplot + coord_flip()+coord_cartesian(ylim=mylimits) # zooms but does not flip Jacob Wegelin Op 20-jul.-2015 20:29 schreef Jacob Wegelin jacobwege...@fastmail.fm: With base graphics, one can use the ylim argument to zoom in on a boxplot. With ggplot2, using limits to try to zoom in on a boxplot *changes the box*. Since the box usually indicates the 25th and 75th percentiles of a quantitative variable, this is puzzling. The toy code below demonstrates this. In ggplot2, zooming in causes the two boxes to overlap, when they did not overlap in the full plot. Also, the center lines --- which usually indicate the median of the variable --- change when one zooms in. In base graphics, zooming in does not cause the boxes to overlap or, as far as I can see, the median line to move relative to the scale. What is going on here? pdf(file=toy-example.pdf) set.seed(1) toy1-data.frame(Y=rnorm(500, mean=3), A=one) toy2-data.frame(Y=rnorm(500, mean=1.6), A=two) toy-rbind(toy1,toy2) toy$A-factor(toy$A) library(ggplot2) mybreaks-signif(seq(from=min(toy$Y),to=max(toy$Y),by=0.5),digits=2) mylimits-c(0.61,3.7) print(myplot-ggplot(toy, aes(x=A,y=Y)) + geom_boxplot()+scale_y_continuous(breaks=mybreaks)+theme_bw()) print(myplot+scale_y_continuous(breaks=mybreaks,limits=mylimits)) boxplot(toy1$Y,toy2$Y) boxplot(toy1$Y,toy2$Y, ylim=mylimits) graphics.off() sessionInfo() R version 3.2.1 (2015-06-18) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.4 (Yosemite) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ggplot2_1.0.1 loaded via a namespace (and not attached): [1] MASS_7.3-40 colorspace_1.2-6 scales_0.2.5 magrittr_1.5 plyr_1.8.3 tools_3.2.1 gtable_0.1.2 reshape2_1.4.1 [9] Rcpp_0.11.6 stringi_0.5-5 grid_3.2.1 stringr_1.0.0 digest_0.6.8 proto_0.3-10 munsell_0.4.2 Jacob A. Wegelin __ 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-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.
Re: [R] Knitr: setting echo = FALSE globally
We need the source file. Not the output. And please try to make it as small as possible while still reproducing the problem. The smaller the example, the easier it is for us to help you. Op 20-jul.-2015 21:17 schreef Rich Shepard rshep...@appl-ecosys.com: On Mon, 20 Jul 2015, Thierry Onkelinx wrote: Have you tried echo = FALSE instead of echo = F. If that doesn't solve your problem, please provide a minimal reproducible example. Yes, I have. Attached is a TeX file renamed to sample.txt (rather than .tex to ensure it is not stripped), a PDF of the compiled page, and the source data that's being read in the sample doc. Thanks, Rich __ 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. [[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.
Re: [R] error reading file DESCRIPTION
On Mon, Jul 20, 2015 at 1:42 PM, William Morgan wmor...@wooster.edu wrote: Hello, After downloading imview from SourceForge.net http://sourceforge.net/projects/imview/?source=directory, I get the following error and warning when trying to install this package: That would be because it isn't an R package. That's the source code for stand-alone image processing software. install.packages(~/Downloads/imview-src-1.0.1.tar.gz, repos = NULL, type = source) Error: error reading file '/var/folders/57/76qlq1g9607g8nm3pv7txydwgp/T//Rtmp9Xr791/R.INSTALL4b47344defc/imview-1.0.1/DESCRIPTION' Warning in install.packages : installation of package ‘/Users/wmorgan/Downloads/imview-src-1.0.1.tar.gz’ had non-zero exit status Any suggestions on how to solve this problem? Thanks, Bill P.S. I’m using R Studio, on a Mac Airbook with OS 10.10.4. William R. Morgan, Ph.D. Theron L. Peterson and Dorothy R. Peterson Professor of Biology The College of Wooster Department of Biology 931 College Mall Wooster, OH 44691 330-263-2379 wmor...@wooster.edu -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] Printing row and column names of cells with specific value in a big matrix
Without a reproducible example, or at least a non-mangled one (please don't post in HTML), I'm not inclined to try it, but why not use sig_values to index row.names() and col.names() if you're after the names? Sarah On Mon, Jul 20, 2015 at 1:44 PM, gaurav kandoi kandoigau...@gmail.com wrote: Hi All I've two big matrices (5k*4k) with the same structure, i.e. : mRNA1 mRNA2 mRNA3 lncRNA1 0.395646 0.94995 0.76177 lncRNA2 0.03791 0.661258 0.558658 lncRNA3 0.67846 0.652364 0.359054 lncRNA4 0.57769 0.003 0.459127 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? Regards -- *Gaurav Kandoi* [[alternative HTML version deleted]] -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] Printing row and column names of cells with specific value in a big matrix
Hi Sarah, sorry for posting in HTML. I've two big matrices (5k*4k) with the same structure, i.e. : ,mRNA1,mRNA2,mRNA3 lncRNA1,0.395646498,0.949950035,0.761770206 lncRNA2,0.037909944,0.661258022,0.558657799 lncRNA3,0.678459646,0.652364052,0.359053653 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? I've also tried printing using the following print command: paste(rownames(Pmatrix)[sig_values[1]], colnames(Pmatrix)[sig_values[2]], sep=, ) But it gives a output like this: [1] lncRNA2, NA Sample input files available for download: https://goo.gl/xR6XDg Regards On Mon, Jul 20, 2015 at 2:11 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Without a reproducible example, or at least a non-mangled one (please don't post in HTML), I'm not inclined to try it, but why not use sig_values to index row.names() and col.names() if you're after the names? Sarah On Mon, Jul 20, 2015 at 1:44 PM, gaurav kandoi kandoigau...@gmail.com wrote: Hi All I've two big matrices (5k*4k) with the same structure, i.e. : mRNA1 mRNA2 mRNA3 lncRNA1 0.395646 0.94995 0.76177 lncRNA2 0.03791 0.661258 0.558658 lncRNA3 0.67846 0.652364 0.359054 lncRNA4 0.57769 0.003 0.459127 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? Regards -- *Gaurav Kandoi* [[alternative HTML version deleted]] -- Sarah Goslee http://www.functionaldiversity.org -- Gaurav Kandoi __ 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.
Re: [R] Printing row and column names of cells with specific value in a big matrix
Subsetting error. See below. On Mon, Jul 20, 2015 at 3:29 PM, gaurav kandoi kandoigau...@gmail.com wrote: Hi Sarah, sorry for posting in HTML. I've two big matrices (5k*4k) with the same structure, i.e. : ,mRNA1,mRNA2,mRNA3 lncRNA1,0.395646498,0.949950035,0.761770206 lncRNA2,0.037909944,0.661258022,0.558657799 lncRNA3,0.678459646,0.652364052,0.359053653 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? I've also tried printing using the following print command: paste(rownames(Pmatrix)[sig_values[1]], colnames(Pmatrix)[sig_values[2]], sep=, ) But it gives a output like this: [1] lncRNA2, NA Well, yes. sig_values[1] sig_values[1] [1] 2 sig_values[2] [1] 8 And there is no column 8, so no name. paste(rownames(Pmatrix)[sig_values[,1]], colnames(Pmatrix)[sig_values[,2]], sep=, ) [1] lncRNA2, mRNA1 lncRNA8, mRNA1 lncRNA4, mRNA2 lncRNA7, mRNA2 lncRNA1, mRNA4 [6] lncRNA3, mRNA4 lncRNA5, mRNA5 Sample input files available for download: https://goo.gl/xR6XDg dput() is preferred to expecting people to download things from unknown sources. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] Knitr: setting echo = FALSE globally
On Mon, 20 Jul 2015, Thierry Onkelinx wrote: We need the source file. Attached to the original message was the TeX output called, 'sample.txt'. I've attached it again, but with the .tex extension. Also, the .lyx file is attached. Rich#LyX 2.1 created this file. For more info see http://www.lyx.org/ \lyxformat 474 \begin_document \begin_header \textclass scrreprt \begin_preamble \date{} \usepackage{textcomp,url,multicol} %\setkomafont{sectioning}{\rmfamily} \end_preamble \options abstract=on \use_default_options false \begin_modules natbibapa knitr \end_modules \maintain_unincluded_children false \language english \language_package default \inputencoding auto \fontencoding global \font_roman palatino \font_sans default \font_typewriter default \font_math auto \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command bibtex \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize letterpaper \use_geometry false \use_package amsmath 1 \use_package amssymb 1 \use_package cancel 1 \use_package esint 0 \use_package mathdots 1 \use_package mathtools 1 \use_package mhchem 1 \use_package stackrel 1 \use_package stmaryrd 1 \use_package undertilde 1 \cite_engine natbib \cite_engine_type authoryear \biblio_style humannat \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \justification true \use_refstyle 0 \index Index \shortcut idx \color #008000 \end_index \secnumdepth 2 \tocdepth 2 \paragraph_separation indent \paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 2 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Standard In 1986 Ward described the status of water quality assessment as data rich and information poor \begin_inset CommandInset citation LatexCommand citep key Ward1986 \end_inset . The authors addressed the lack of science-based design of monitoring location networks; this situation still applies. They defined water quality monitoring as any effort by a government or private enterprise to obtain an understanding of the physical, chemical, and biological characteristics of water via statistical sampling. Of course, their definition also applies to appropriate statistical analyses of the collected data. \end_layout \begin_layout Standard \begin_inset Flex Chunk status open \begin_layout Plain Layout \begin_inset Argument 1 status open \begin_layout Plain Layout opts_chunk$set(echo = FALSE) \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard \begin_inset Flex Chunk status collapsed \begin_layout Plain Layout load('.RData') \begin_inset Argument 1 status collapsed \begin_layout Plain Layout tidy=T, tidy.opts=list(width.cutoff=60) \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard The data available for the Carlin site (USGS station number 10321000 are in Appendix A. Many documents on data analysis and statistics use small sample sets to illustrate the points the author wants the reader to learn. Real-world environmental data sets frequently are very large so this document uses 52 variables from the total available from the USGS's web site. \end_layout \begin_layout Standard The first step in analyzing water chemistry data for CWA compliance is reading it into the analytical software and converting column data types as necessary. \end_layout \begin_layout Standard \begin_inset Flex Chunk status collapsed \begin_layout Plain Layout carlin - read.csv(./carlin.csv, header=T, sep=,, stringsAsFactors=F) \end_layout \begin_layout Plain Layout carlin$sampdate - as.Date(carlin$sampdate) \begin_inset Argument 1 status open \begin_layout Plain Layout 'input_data' \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard Next, check that the data are what you expect to see and convert dates from factors. The site ID number is retained for use when examining multiple stations along the Humboldt River for longitudinal changes and other variables that might affect the measured values. \end_layout \begin_layout Standard \begin_inset Flex Chunk status collapsed \begin_layout Plain Layout \begin_inset Argument 1 status collapsed \begin_layout Plain Layout 'data_set_structure' \end_layout \end_inset str(carlin, width=60, strict.width='cut') \end_layout \end_inset \end_layout \end_body \end_document __ 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.
Re: [R] Printing row and column names of cells with specific value in a big matrix
Thanks a lot Sarah. I think I've got what I wanted. On Mon, Jul 20, 2015 at 2:55 PM, Sarah Goslee sarah.gos...@gmail.com wrote: Subsetting error. See below. On Mon, Jul 20, 2015 at 3:29 PM, gaurav kandoi kandoigau...@gmail.com wrote: Hi Sarah, sorry for posting in HTML. I've two big matrices (5k*4k) with the same structure, i.e. : ,mRNA1,mRNA2,mRNA3 lncRNA1,0.395646498,0.949950035,0.761770206 lncRNA2,0.037909944,0.661258022,0.558657799 lncRNA3,0.678459646,0.652364052,0.359053653 Now, I would like to extract the names of the row,col pairs whose value is less than 0.05. In this case, I should get the output as (lncRNA2,mRNA1) and (lncRNA4,mRNA2) alongwith their values (0.03791 and 0.003). Since the structure of both the matrix is same, I would also like to retrieve the corresponding values and row,col names from the second matrix. (lncRNA2,mRNA1 and lncRNA4,mRNA2 alongwith their values in the second matrix.) I'm using the following code: Pmatrix = read.table(pmatrix.csv, header=T, sep=, , row.names=1) sig_values - which(Pmatrix0.05, arr.ind=TRUE) sig_values Corr_Matrix = read.csv(corr_matrix.csv, header = T, row.names=1) Corr_Matrix[sig_values] However, it only prints the row,col number (sig_values command) or only the values (Corr_Matrix[sig_values]) command. How can I get the row and column names alongwith their values? I've also tried printing using the following print command: paste(rownames(Pmatrix)[sig_values[1]], colnames(Pmatrix)[sig_values[2]], sep=, ) But it gives a output like this: [1] lncRNA2, NA Well, yes. sig_values[1] sig_values[1] [1] 2 sig_values[2] [1] 8 And there is no column 8, so no name. paste(rownames(Pmatrix)[sig_values[,1]], colnames(Pmatrix)[sig_values[,2]], sep=, ) [1] lncRNA2, mRNA1 lncRNA8, mRNA1 lncRNA4, mRNA2 lncRNA7, mRNA2 lncRNA1, mRNA4 [6] lncRNA3, mRNA4 lncRNA5, mRNA5 Sample input files available for download: https://goo.gl/xR6XDg dput() is preferred to expecting people to download things from unknown sources. Sarah -- Sarah Goslee http://www.functionaldiversity.org -- Gaurav Kandoi __ 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.
Re: [R] Value passing in print option
On Jul 19, 2015, at 11:48 PM, Partha Sinha wrote: i want to pass a value with print option x-10 y2*x print(Current value of y is ) # confused dont know how to pass value i want output as Current value of y is 10 With that code we really do not have any assurance that y is 10 (or anything for that matter), and if you meant to type y - 2*x it would be 20, not 10. The sprintf function is often used: x-10 y - 2*x sprintf(Current value of y is %d, y) [1] Current value of y is 20 [[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. David Winsemius Alameda, CA, USA __ 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] change text size on a graphics
Hi,How is it possible to increase the size of a histogram labels (displayed on the top of the bars)? I thought that if I use cex 1, it will increase all text size on a plot (axis labels, axis annotation, title of the graphics and histogram labels) which I want but it doesn't. Regards, Carol [[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.
Re: [R] Knitr: setting echo = FALSE globally
On Mon, 20 Jul 2015, Thierry Onkelinx wrote: Have you tried echo = FALSE instead of echo = F. If that doesn't solve your problem, please provide a minimal reproducible example. Yes, I have. Attached is a TeX file renamed to sample.txt (rather than .tex to ensure it is not stripped), a PDF of the compiled page, and the source data that's being read in the sample doc. Thanks, Rich \batchmode \makeatletter \def\input@path{{/home/rshepard/documents/white-papers/water-chem-anal//}} \makeatother \documentclass[letterpaper,twoside,english,abstract=on]{scrreprt}\usepackage[]{graphicx}\usepackage[]{color} %% maxwidth is the original width if it is less than linewidth %% otherwise use linewidth (to make sure the graphics do not exceed the margin) \makeatletter \def\maxwidth{ % \ifdim\Gin@nat@width\linewidth \linewidth \else \Gin@nat@width \fi } \makeatother \definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345} \newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}% \newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}% \newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}% \newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}% \newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}% \newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}% \newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}% \newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}% \newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}% \usepackage{framed} \makeatletter \newenvironment{kframe}{% \def\at@end@of@kframe{}% \ifinner\ifhmode% \def\at@end@of@kframe{\end{minipage}}% \begin{minipage}{\columnwidth}% \fi\fi% \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep \colorbox{shadecolor}{##1}\hskip-\fboxsep % There is no \\@totalrightmargin, so: \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% \MakeFramed {\advance\hsize-\width \@totalleftmargin\z@ \linewidth\hsize \@setminipage}}% {\par\unskip\endMakeFramed% \at@end@of@kframe} \makeatother \definecolor{shadecolor}{rgb}{.97, .97, .97} \definecolor{messagecolor}{rgb}{0, 0, 0} \definecolor{warningcolor}{rgb}{1, 0, 1} \definecolor{errorcolor}{rgb}{1, 0, 0} \newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX \usepackage{alltt} \usepackage{mathpazo} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \makeatletter %% LyX specific LaTeX commands. \pdfpageheight\paperheight \pdfpagewidth\paperwidth %% Textclass specific LaTeX commands. \usepackage[natbibapa]{apacite} %% User specified LaTeX commands. \date{} \usepackage{textcomp,url,multicol} %\setkomafont{sectioning}{\rmfamily} \makeatother \usepackage{babel} \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \begin{document} In 1986 Ward described the status of water quality assessment as \textquotedbl{}data rich and information poor\textquotedbl{} \citep{Ward1986}. The authors addressed the lack of science-based design of monitoring location networks; this situation still applies. They defined water quality monitoring as \textquotedbl{}any effort by a government or private enterprise to obtain an understanding of the physical, chemical, and biological characteristics of water via statistical sampling.\textquotedbl{} Of course, their definition also applies to appropriate statistical analyses of the collected data. The data available for the Carlin site (USGS station number 10321000 are in Appendix A. Many documents on data analysis and statistics use small sample sets to illustrate the points the author wants the reader to learn. Real-world environmental data sets frequently are very large so this document uses 52 variables from the total available from the USGS's web site. The first step in analyzing water chemistry data for CWA compliance is reading it into the analytical software and converting column data types as necessary. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlstd{carlin} \hlkwb{-} \hlkwd{read.csv}\hlstd{(}\hlstr{./carlin.csv}\hlstd{,} \hlkwc{header}\hlstd{=T,} \hlkwc{sep}\hlstd{=}\hlstr{,}\hlstd{,}\hlkwc{stringsAsFactors}\hlstd{=F)} \hlstd{carlin}\hlopt{$}\hlstd{sampdate} \hlkwb{-} \hlkwd{as.Date}\hlstd{(carlin}\hlopt{$}\hlstd{sampdate)} \end{alltt} \end{kframe} \end{knitrout} Next, check that the data are what you expect to see and convert dates from factors. The site ID number is retained for use when examining multiple stations along the Humboldt River for longitudinal changes and other variables that might affect the measured values. \begin{knitrout} \definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe} \begin{alltt} \hlkwd{str}\hlstd{(carlin,} \hlkwc{width}\hlstd{=}\hlnum{60}\hlstd{,} \hlkwc{strict.width}\hlstd{=}\hlstr{'cut'}\hlstd{)} \end{alltt}
Re: [R] R: Re: Differences in output of lme() when introducing interactions
I believe Michael's point is that you need to STOP asking such questions and START either learning some statistics or work with someone who already knows some. You should not be doing such analyses on your own given your present state of statistical ignorance. Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Jul 20, 2015 at 5:45 PM, angelo.arc...@virgilio.it angelo.arc...@virgilio.it wrote: Dear Michael, thanks for your answer. Despite it answers to my initial question, it does not help me in finding the solution to my problem unfortunately. Could you please tell me which analysis of the two models should I trust then? My goal is to know whether participants’ choices of the dependent variable are linearly related to their own weight, height, shoe size and the combination of those effects. Would the analysis of model 2 be more correct than that of model 1? Which of the two analysis should I trust according to my goal? What is your recommendation? Thanks in advance Angelo Messaggio originale Da: li...@dewey.myzen.co.uk Data: 20-lug-2015 17.56 A: angelo.arc...@virgilio.itangelo.arc...@virgilio.it, r-help@r-project.org Ogg: Re: [R] Differences in output of lme() when introducing interactions In-line On 20/07/2015 15:10, angelo.arc...@virgilio.it wrote: Dear List Members, I am searching for correlations between a dependent variable and a factor or a combination of factors in a repeated measure design. So I use lme() function in R. However, I am getting very different results depending on whether I add on the lme formula various factors compared to when only one is present. If a factor is found to be significant, shouldn't remain significant also when more factors are introduced in the model? The short answer is 'No'. The long answer is contained in any good book on statistics which you really need to have by your side as the long answer is too long to include in an email. I give an example of the outputs I get using the two models. In the first model I use one single factor: library(nlme) summary(lme(Mode ~ Weight, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIC logLik 2119.28 2130.154 -1055.64 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1952.495 2496.424 Fixed effects: Mode ~ Weight Value Std.Error DF t-value p-value (Intercept) 10308.966 2319.0711 95 4.445299 0.000 Weight-99.036 32.3094 17 -3.065233 0.007 Correlation: (Intr) Weight -0.976 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.74326719 -0.41379593 -0.06508451 0.39578734 2.27406649 Number of Observations: 114 Number of Groups: 19 As you can see the p-value for factor Weight is significant. This is the second model, in which I add various factors for searching their correlations: library(nlme) summary(lme(Mode ~ Weight*Height*Shoe_Size*BMI, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIClogLik 1975.165 2021.694 -969.5825 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.127993 2494.826 Fixed effects: Mode ~ Weight * Height * Shoe_Size * BMI Value Std.Error DFt-value p-value (Intercept) 5115955 10546313 95 0.4850941 0.6287 Weight -13651237 6939242 3 -1.9672518 0.1438 Height -18678 53202 3 -0.3510740 0.7487 Shoe_Size 93427213737 3 0.4371115 0.6916 BMI -13011088 7148969 3 -1.8199949 0.1663 Weight:Height 28128 14191 3 1.9820883 0.1418 Weight:Shoe_Size 351453186304 3 1.8864467 0.1557 Height:Shoe_Size -783 1073 3 -0.7298797 0.5183 Weight:BMI 19475 11425 3 1.7045450 0.1868 Height:BMI 226512118364 3 1.9136867 0.1516 Shoe_Size:BMI 329377190294 3 1.7308827 0.1819 Weight:Height:Shoe_Size -706 371 3 -1.9014817 0.1534 Weight:Height:BMI-10963 3 -1.7258742 0.1828 Weight:Shoe_Size:BMI -273 201 3 -1.3596421 0.2671 Height:Shoe_Size:BMI-5858 3200 3 -1.8306771 0.1646 Weight:Height:Shoe_Size:BMI 2 1 3 1.3891782 0.2589 Correlation: (Intr) Weight Height Sho_Sz BMIWght:H Wg:S_S Hg:S_S Wg:BMI Hg:BMI S_S:BM Wg:H:S_S W:H:BM W:S_S: H:S_S: Weight -0.895 Height -0.996 0.869 Shoe_Size -0.930 0.694 0.933 BMI
Re: [R] Knitr: setting echo = FALSE globally
Hi Rich, I have no idea wha that chunk is not working but I think you can get the same result using the old method Stick the following in an ERT (Insert Tex Code) set-ops, echo = FALSE= opts_chunk$set(echo = FALSE) @ Heck, I've only been using LyX for 4-5 years and already I'm sounding crotchety. John Kane Kingston ON Canada -Original Message- From: rshep...@appl-ecosys.com Sent: Mon, 20 Jul 2015 12:58:51 -0700 (PDT) To: r-help@r-project.org Subject: Re: [R] Knitr: setting echo = FALSE globally On Mon, 20 Jul 2015, Thierry Onkelinx wrote: We need the source file. Attached to the original message was the TeX output called, 'sample.txt'. I've attached it again, but with the .tex extension. Also, the .lyx file is attached. Rich __ 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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ 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.
Re: [R] modifying a package installed via GitHub
Bob and Charles, Thanks very much for taking the time to write, I greatly appreciate your help. I have been so spoiled by Rstudio for so long that I cannot recall the last time I had to use R CMD install. Although I installed this package from GitHub using devtools, I do not see that an .Rproj exists, and the R code is in the .rdb and .rdx formats. However, if I understand Charles correctly, one approach would be to (1) fork the repo, (2) clone it, (3) make my edits, (4) push the edits to my fork of the repo, then (5) (re)install the package from my forked repo (e.g., install_github(myreponame/packagename))...then I should be able to call all the functions with my edits. If I wanted to go back to the original, published version of the package, then I can just reinstall from the source (e.g.,install_github(author/packagename), and that will overwrite what I have done locally. Do I have that right? Thanks again for your thoughtful advice! Steve On Mon, Jul 20, 2015 at 5:52 AM, Charles Determan cdeterma...@gmail.com wrote: Steve, You are able to work with a github package the same as any github repo. If you clone the repo: git clone https://github.com/user/repo.git If using RStudio it is simple enough to create a new project in that new directory (if the .Rproj file does not exist, otherwise open that). Once you have the project open for that directory you can modify source files and rebuild and install as you like. If at the CMD line, you do as Bob instructed with R CMD install . I recommend, however, either creating a new branch for you changes (if you familiar with git management) or at least make sure to change the subversion of the package so it doesn't conflict with the 'original'. That way you 'know' which version of the package is installed at a given time. Naturally, if you feel your modifications are valuable you may want to actually fork the package on github and create a pull request of your changes for the maintainer to incorporate in to the next release. Hope this helps clarify things, Charles On Sat, Jul 18, 2015 at 8:49 AM, boB Rudis b...@rudis.net wrote: You can go to the package directory: cd /some/path/to/package and do R CMD install . from a command-line there. Many github-based packages are also made using RStudio and you can just open the .Rproj file (i.e. load it into R studio) and build the package there which will install it. The same-named package will overwrite what you have previously installed. Just: devtools::install_github(owner/package) to go back to the original. On Fri, Jul 17, 2015 at 8:12 PM, Steve E. se...@vt.edu wrote: Hi Folks, I am working with a package installed via GitHub that I would like to modify. However, I am not sure how I would go about loading a 'local' version of the package after I have modified it, and whether that process would including uninstalling the original unmodified package (and, conversely, how to uninstall my local, modified version if I wanted to go back to the unmodified version available on GitHub). Any advice would be appreciated. Thanks, Steve -- View this message in context: http://r.789695.n4.nabble.com/modifying-a-package-installed-via-GitHub-tp4710016.html Sent from the R help mailing list archive at Nabble.com. __ 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-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. [[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] R: Re: Differences in output of lme() when introducing interactions
Dear Michael, thanks for your answer. Despite it answers to my initial question, it does not help me in finding the solution to my problem unfortunately. Could you please tell me which analysis of the two models should I trust then? My goal is to know whether participants’ choices of the dependent variable are linearly related to their own weight, height, shoe size and the combination of those effects. Would the analysis of model 2 be more correct than that of model 1? Which of the two analysis should I trust according to my goal? What is your recommendation? Thanks in advance Angelo Messaggio originale Da: li...@dewey.myzen.co.uk Data: 20-lug-2015 17.56 A: angelo.arc...@virgilio.itangelo.arc...@virgilio.it, r-help@r-project.org Ogg: Re: [R] Differences in output of lme() when introducing interactions In-line On 20/07/2015 15:10, angelo.arc...@virgilio.it wrote: Dear List Members, I am searching for correlations between a dependent variable and a factor or a combination of factors in a repeated measure design. So I use lme() function in R. However, I am getting very different results depending on whether I add on the lme formula various factors compared to when only one is present. If a factor is found to be significant, shouldn't remain significant also when more factors are introduced in the model? The short answer is 'No'. The long answer is contained in any good book on statistics which you really need to have by your side as the long answer is too long to include in an email. I give an example of the outputs I get using the two models. In the first model I use one single factor: library(nlme) summary(lme(Mode ~ Weight, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIC logLik 2119.28 2130.154 -1055.64 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1952.495 2496.424 Fixed effects: Mode ~ Weight Value Std.Error DF t-value p-value (Intercept) 10308.966 2319.0711 95 4.445299 0.000 Weight-99.036 32.3094 17 -3.065233 0.007 Correlation: (Intr) Weight -0.976 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.74326719 -0.41379593 -0.06508451 0.39578734 2.27406649 Number of Observations: 114 Number of Groups: 19 As you can see the p-value for factor Weight is significant. This is the second model, in which I add various factors for searching their correlations: library(nlme) summary(lme(Mode ~ Weight*Height*Shoe_Size*BMI, data = Gravel_ds, random = ~1 | Subject)) Linear mixed-effects model fit by REML Data: Gravel_ds AIC BIClogLik 1975.165 2021.694 -969.5825 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.127993 2494.826 Fixed effects: Mode ~ Weight * Height * Shoe_Size * BMI Value Std.Error DFt-value p-value (Intercept) 5115955 10546313 95 0.4850941 0.6287 Weight -13651237 6939242 3 -1.9672518 0.1438 Height -18678 53202 3 -0.3510740 0.7487 Shoe_Size 93427213737 3 0.4371115 0.6916 BMI -13011088 7148969 3 -1.8199949 0.1663 Weight:Height 28128 14191 3 1.9820883 0.1418 Weight:Shoe_Size 351453186304 3 1.8864467 0.1557 Height:Shoe_Size -783 1073 3 -0.7298797 0.5183 Weight:BMI 19475 11425 3 1.7045450 0.1868 Height:BMI 226512118364 3 1.9136867 0.1516 Shoe_Size:BMI 329377190294 3 1.7308827 0.1819 Weight:Height:Shoe_Size -706 371 3 -1.9014817 0.1534 Weight:Height:BMI-10963 3 -1.7258742 0.1828 Weight:Shoe_Size:BMI -273 201 3 -1.3596421 0.2671 Height:Shoe_Size:BMI-5858 3200 3 -1.8306771 0.1646 Weight:Height:Shoe_Size:BMI 2 1 3 1.3891782 0.2589 Correlation: (Intr) Weight Height Sho_Sz BMIWght:H Wg:S_S Hg:S_S Wg:BMI Hg:BMI S_S:BM Wg:H:S_S W:H:BM W:S_S: H:S_S: Weight -0.895 Height -0.996 0.869 Shoe_Size -0.930 0.694 0.933 BMI -0.911 0.998 0.887 0.720 Weight:Height0.894 -1.000 -0.867 -0.692 -0.997 Weight:Shoe_Size 0.898 -0.997 -0.873 -0.700 -0.999 0.995 Height:Shoe_Size 0.890 -0.612 -0.904 -0.991 -0.641 0.609 0.619 Weight:BMI 0.911 -0.976 -0.887 -0.715 -0.972 0.980 0.965 0.637 Height:BMI 0.900 -1.000 -0.875 -0.703 -0.999 0.999 0.999 0.622 0.973 Shoe_Size:BMI0.912 -0.992 -0.889 -0.726
Re: [R] R GUI tklistbox get value
Dear j.para.fernandez, Try selecvar - dat[, as.numeric(tkcurselection(tl))+1] Omitting the comma returns a one-column data frame, not a numeric vector. I hope this helps, John John Fox, Professor McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Mon, 20 Jul 2015 03:29:07 -0700 (PDT) jpara3 j.para.fernan...@hotmail.com wrote: Hi, i have a dataframe, dat, with 2 variables, one and two. I want to print in R the mean of the selected variable of the dataframe. You can select it with a tklistbox, but when you click OK button, the mean is not displayed, just NA one-c(5,5,6,9,5,8) two-c(12,13,14,12,14,12) dat-data.frame(uno,dos) require(tcltk) tt-tktoplevel() tl-tklistbox(tt,height=4,selectmode=single) tkgrid(tklabel(tt,text=Selecciona la variable para calcular media)) tkgrid(tl) for (i in (1:4)) { tkinsert(tl,end,colnames(dat[i])) } OnOK - function() { selecvar - dat[as.numeric(tkcurselection(tl))+1] print(mean(selecvar)) } OK.but -tkbutton(tt,text= OK ,command=OnOK) tkgrid(OK.but) tkfocus(tt) # Can someone please help me?? Thanks!!! -- View this message in context: http://r.789695.n4.nabble.com/R-GUI-tklistbox-get-value-tp4710064.html Sent from the R help mailing list archive at Nabble.com. __ 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-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] plot auto key and text into panels using lattice
Dear all, I am writing some text into several panels which I can do with this script (in capital the variables): xyplot(Y ~ X | Z, data = DATAFRAME, groups = Z, ylab= Y, xlab=X, main=TITLE, scales = list( x = list(draw = FALSE), y = list(draw = FALSE), relation=same, alternating=TRUE), as.table = TRUE, layout = LAYOUT, par.settings = list( strip.background=list(col=white), axis.text = list(cex = 0.6), par.xlab.text = list(cex = 0.75), par.ylab.text = list(cex = 0.75), par.main.text = list(cex = 0.8), superpose.symbol = list(pch = ., cex = 1) ), strip= FALSE, type = l, col = 3, panel = function(x, y,...) { panel.xyplot(x,y,...) panel.text(MIN.X+(0.1*MAX.X), MAX.Y-(0.1*MAX.Y), labels=LABELS[panel.number()], cex=0.3 ) } ) A similar plot also add the autokey because it takes in account two different Y values, but the plot is not drawn rather the function is implemented but the plot remains empty: xyplot(Y1+Y2 ~ X | Z, data = DATAFRAME, ylab= Y, xlab=X, main=TITLE, scales = list( x = list(draw = FALSE), y = list(draw = FALSE), relation=same, alternating=TRUE), as.table = TRUE, layout = LAYOUT, auto.key= list(space = centre), par.settings = list( strip.background=list(col=white), axis.text = list(cex = 0.6), par.xlab.text = list(cex = 0.75), par.ylab.text = list(cex = 0.75), par.main.text = list(cex = 0.8), superpose.symbol = list(pch = ., cex = 1) ), strip= FALSE, type = l, col = c(4,2), key = list( space=top, columns=2, text=list(TEXT_FOR_AUTOKEY, col=black), lines=list(col=c(4,2)), panel = panel.superpose ), panel = function(x, y,...) { panel.xyplot(x,y,...) panel.text(MIN.X+(0.1*MAX.X), MAX.Y-(0.1*MAX.Y), labels=LAB[panel.number()], cex=0.3, panel = panel.superpose ) } ) I am not attaching actual data because I believe the problem is in the actual call, maybe I am using twice panel.superimpose, although several combination I made (for instance moving the key argument into the panel function) did not solve the problem. Could you tell me where I am getting it wrong? Thank you. best regards Luigi __ 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.
Re: [R] modifying a package installed via GitHub
You essentially have it but you can just click the 'build and install' button to rebuild on the changes you made. But technically it would still work pushing to your repo and using devtools. On Monday, July 20, 2015, Stevan Earl se...@vt.edu wrote: Bob and Charles, Thanks very much for taking the time to write, I greatly appreciate your help. I have been so spoiled by Rstudio for so long that I cannot recall the last time I had to use R CMD install. Although I installed this package from GitHub using devtools, I do not see that an .Rproj exists, and the R code is in the .rdb and .rdx formats. However, if I understand Charles correctly, one approach would be to (1) fork the repo, (2) clone it, (3) make my edits, (4) push the edits to my fork of the repo, then (5) (re)install the package from my forked repo (e.g., install_github(myreponame/packagename))...then I should be able to call all the functions with my edits. If I wanted to go back to the original, published version of the package, then I can just reinstall from the source (e.g.,install_github(author/packagename), and that will overwrite what I have done locally. Do I have that right? Thanks again for your thoughtful advice! Steve On Mon, Jul 20, 2015 at 5:52 AM, Charles Determan cdeterma...@gmail.com javascript:_e(%7B%7D,'cvml','cdeterma...@gmail.com'); wrote: Steve, You are able to work with a github package the same as any github repo. If you clone the repo: git clone https://github.com/user/repo.git If using RStudio it is simple enough to create a new project in that new directory (if the .Rproj file does not exist, otherwise open that). Once you have the project open for that directory you can modify source files and rebuild and install as you like. If at the CMD line, you do as Bob instructed with R CMD install . I recommend, however, either creating a new branch for you changes (if you familiar with git management) or at least make sure to change the subversion of the package so it doesn't conflict with the 'original'. That way you 'know' which version of the package is installed at a given time. Naturally, if you feel your modifications are valuable you may want to actually fork the package on github and create a pull request of your changes for the maintainer to incorporate in to the next release. Hope this helps clarify things, Charles On Sat, Jul 18, 2015 at 8:49 AM, boB Rudis b...@rudis.net javascript:_e(%7B%7D,'cvml','b...@rudis.net'); wrote: You can go to the package directory: cd /some/path/to/package and do R CMD install . from a command-line there. Many github-based packages are also made using RStudio and you can just open the .Rproj file (i.e. load it into R studio) and build the package there which will install it. The same-named package will overwrite what you have previously installed. Just: devtools::install_github(owner/package) to go back to the original. On Fri, Jul 17, 2015 at 8:12 PM, Steve E. se...@vt.edu javascript:_e(%7B%7D,'cvml','se...@vt.edu'); wrote: Hi Folks, I am working with a package installed via GitHub that I would like to modify. However, I am not sure how I would go about loading a 'local' version of the package after I have modified it, and whether that process would including uninstalling the original unmodified package (and, conversely, how to uninstall my local, modified version if I wanted to go back to the unmodified version available on GitHub). Any advice would be appreciated. Thanks, Steve -- View this message in context: http://r.789695.n4.nabble.com/modifying-a-package-installed-via-GitHub-tp4710016.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org javascript:_e(%7B%7D,'cvml','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-help@r-project.org javascript:_e(%7B%7D,'cvml','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. [[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.