Re: [R] Conditional CCA and Monte Carlo - Help!
MWilson mjw029 at bucknell.edu writes: Hi All, I am using canonical correspondence analysis to compare a community composition matrix to a matrix of sample spatial relationships and environmental variables. In order to parse out how much variance is explained purely by space (S/E) or the environment (E/S) I am using a conditional (partial) CCA. I want to test significance via Monte Carlo but I can not find a way to do this with a conditional CCA. I have been using vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However, these two packages conflict when it comes to CCA. If I use vegan I can run a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't figure out how to do a conditional CCA with ade4 OR a Monte Carlo with vegan. If anyone has experience with this I would be truly grateful for your help! I am fairly new to R, and I have quickly found myself in a place where Google-ing has no longer proven useful. Below are my scripts and error messages. -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo- Help-tp4662572.html Sent from the R help mailing list archive at Nabble.com. randtest() is an ade4 function that only works with ade4 result objects. That you found the hard way. In vegan we have permutest: see ?permutest.cca. Some other similar functions are described together with permutest.cca, but permutest() is similar to randtest. ade4::randtest.cca and vegan:::permutest.cca work similarly and are comparable with basic models, but there are following differences: 1) vegan uses ter Braak's pseudo-F statistic, whereas ade4 returns the proportion constrained/all eigenvalues. These are similar to a constant multiplier in non-conditional models and with direct or reduced permutation models in vegan, but differ otherwise. The ade4 alternative is not good for partial models (but that does not matter since ade4 has no partial models). The vegan:::permutest.cca function returns items num and den (numerator and denominator) that can be used to get the proportion of ade4. 2) vegan permutes response (community) data whereas ade4 permutes constraints (environmental data). This makes only difference in partial (conditional) models or with some non-default permutation strategies in vegan. However, because of this, ade4 and vegan results are not identical with the same random number seed (with little trickery this can be fixed, but that is hardly for beginners). Permutation of community data is needed in analysis of conditional (partial) models, and in some permutation strategies. 3) We do not call it Monte Carlo, but permutation. (Monte Carlo is too expensive for me -- I prefer Menton). That may explain why Google did not find it to you. In general, you should not expect methods functions (such as ade4::randtest.cca) to work across packages. In sometimes they do, but in those cases the package authors have taken special care to make their functions to work with alien objects. Not in this case. It neither makes sense for ade4::randtest be able to handle vegan object because randtest does not know what to do with contional (partial) models. Cheers, Jari Oksanen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] changing y-axis intervals in a boxplot
Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odd graphic device behavior
On Mar 28, 2013, at 22:27 , Thomas Adams wrote: All, Well to my relief and embarrassment, I discovered my problem. About 5 weeks ago, I shutdown my computer and moved it. When I reconnected everything I apparently plugged my HDMI monitor into the 'wrong' output port without realizing it. So, on a whim, just now, I made the switch to the other port and presto changeo -- problem solved!! The odd thing was, besides my R graphics device window problems, everything else was fine... Out of curiosity, can anyone explain this? My best guess is that the pixel resolution was taken from the disconnected primary display and set to some safe standard value like 640x480, miscalculating the dimensions of your display, so that it ended up with huge virtual inches. The reason everything else didn't notice could be that they work in pixel units rather than physical units. (There seems to be no really perfect solution to the problem of setting default dimensions: Pixel count gives stamp-sized graphs on hi-res displays, physical dimensions are meaningless on projectors and not really what you want on a tiny screen, and percent of display area is undue imperialism if you have a large monitor, intending to overlook many windows at once.) Thanks for all the help... Tom On Thu, Mar 28, 2013 at 4:06 PM, Thomas Adams tea...@gmail.com wrote: Luca, Thank you for the suggestion; I do have an Nvidia graphics card and I am using the Nvida driver; still searching for a solution, quite odd... Tom On Thu, Mar 28, 2013 at 12:28 PM, Luca Nanetti luca.nane...@gmail.comwrote: Thomas, any chance that you could have problems with your graphic driver? For instance, if you have an Nvidia graphic card, I would recommend switching from the 'nouveau' driver to the official Nvidia one. Kind regards, luca [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 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] Need to read an Excel File
I have found that the easiest way to read/write Excel files is to use the XLConnect package. Sent from my iPad On Mar 28, 2013, at 15:54, Henry Njovu hnj...@mwekawildlife.org wrote: To be able to import excel-files into R you also need to download Perl from http://www.perl.org/. From this link you will have to downlaod a suitable Strawberry based on the computer you use (Mac/Window). Once installed you should be able to move on. -- View this message in context: http://r.789695.n4.nabble.com/Need-to-read-an-Excel-File-tp2307915p4662778.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Need to read an Excel File
I use XlsReadWrite package, its good. On Fri, Mar 29, 2013 at 9:00 AM, Jim Holtman jholt...@gmail.com wrote: I have found that the easiest way to read/write Excel files is to use the XLConnect package. Sent from my iPad On Mar 28, 2013, at 15:54, Henry Njovu hnj...@mwekawildlife.org wrote: To be able to import excel-files into R you also need to download Perl from http://www.perl.org/. From this link you will have to downlaod a suitable Strawberry based on the computer you use (Mac/Window). Once installed you should be able to move on. -- View this message in context: http://r.789695.n4.nabble.com/Need-to-read-an-Excel-File-tp2307915p4662778.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem with data
Hello all! I have a problem with my data in R. When I want to plot the following data, I have a problem with y scale. The maximum value is cc. 10 degrees and in R is about 100. I use this code: fasy-read.table(gridd1.txt,sep=\t,dec=,,header=T,row.names=1) # here are the years: x - as.numeric(rownames(fasy)) # extract a series that you want to plot: y - fasy[,1] # remove the NA's from both: mask - !is.na(y) x - x[mask] y - y[mask] plot(x,y,type=l) Please help me to solve this problem. Thank you very much! And data: row.names medie 1 1901 8.125 2 1902 7.133 3 1903 8.60833325 4 1904 7.58267 5 1905 8.25833 6 1906 8.425 7 1907 7.24167 8 1908 7.825 9 1909 8.01575 10 1910 9.03258 11 1911 8.15833 12 1912 7.37492 13 1913 8.4 14 1914 7.875000108 15 1915 8.36767 16 1916 9.20017 17 1917 8.0825 18 1918 8.96667 19 1919 7.89175 20 1920 8.20008 21 1921 8.375 22 1922 7.42583 23 1923 9.041666833 24 1924 7.83425 25 1925 9.22475 26 1926 8.95 27 1927 8.61583 28 1928 7.7083334 29 1929 7.291666575 30 1930 9.01667 31 1931 7.8 32 1932 8.15833325 33 1933 6.558333167 34 1934 9.31667 35 1935 7.725000108 36 1936 9.2325 37 1937 8.6325 38 1938 8.78258 39 1939 8.90842 40 1940 6.44175 41 1941 7.21708 42 1942 6.62417 43 1943 8.325 44 1944 8.225 45 1945 7.95083 46 1946 8.88333 47 1947 7.97508 48 1948 8.75 49 1949 8.79908 50 1950 9 51 1951 9.325 52 1952 8.325 53 1953 8.03342 54 1954 7.2325 55 1955 7.98433 56 1956 6.84917 57 1957 8.6 58 1958 8.7585 59 1959 8.18333 60 1960 8.835 61 1961 8.74925 62 1962 8.07483 63 1963 7.60833325 64 1964 7.61667 65 1965 7.20833325 66 1966 8.95833325 67 1967 8.65833 68 1968 8.74925 69 1969 7.15167 70 1970 8.38333 71 1971 8.40842 72 1972 8.40833 73 1973 8.2 74 1974 8.7 75 1975 9.37492 76 1976 7.275 77 1977 8.6 78 1978 7.7 79 1979 8.6 80 1980 7.18417 81 1981 8.4325 82 1982 8.56667 83 1983 9.3 84 1984 8.27508 85 1985 7.14158 86 1986 8.55833325 87 1987 7.4 88 1988 8.29992 89 1989 9.82475 90 1990 9.77417 91 1991 8.25 92 1992 8.85 93 1993 8.125 94 1994 9.808333217 95 1995 8.55833 96 1996 7.92417 97 1997 8.091666583 98 1998 8.675 99 1999 9.59167 100 2000 9.91742 101 2001 9.05825 102 2002 9.51583 103 2003 8.61583 104 2004 8.9175 105 2005 8.74167 106 2006 8.65833 107 2007 10.3583 108 2008 9.97492 109 2009 9.9 -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX:+4 0230 52 16 64 silvic.usv.ro [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Hi, Example adapted from ?boxplot par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,2.5)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,1)) HTH, Pascal On 29/03/13 18:22, Berg, Tobias van den wrote: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with data
hello all! I solve the problem! Sorry for disturbing! Best regards, CR On 29 March 2013 11:28, catalin roibu catalinro...@gmail.com wrote: Hello all! I have a problem with my data in R. When I want to plot the following data, I have a problem with y scale. The maximum value is cc. 10 degrees and in R is about 100. I use this code: fasy-read.table(gridd1.txt,sep=\t,dec=,,header=T,row.names=1) # here are the years: x - as.numeric(rownames(fasy)) # extract a series that you want to plot: y - fasy[,1] # remove the NA's from both: mask - !is.na(y) x - x[mask] y - y[mask] plot(x,y,type=l) Please help me to solve this problem. Thank you very much! And data: row.names medie 1 1901 8.125 2 1902 7.133 3 1903 8.60833325 4 1904 7.58267 5 1905 8.25833 6 1906 8.425 7 1907 7.24167 8 1908 7.825 9 1909 8.01575 10 1910 9.03258 11 1911 8.15833 12 1912 7.37492 13 1913 8.4 14 1914 7.875000108 15 1915 8.36767 16 1916 9.20017 17 1917 8.0825 18 1918 8.96667 19 1919 7.89175 20 1920 8.20008 21 1921 8.375 22 1922 7.42583 23 1923 9.041666833 24 1924 7.83425 25 1925 9.22475 26 1926 8.95 27 1927 8.61583 28 1928 7.7083334 29 1929 7.291666575 30 1930 9.01667 31 1931 7.8 32 1932 8.15833325 33 1933 6.558333167 34 1934 9.31667 35 1935 7.725000108 36 1936 9.2325 37 1937 8.6325 38 1938 8.78258 39 1939 8.90842 40 1940 6.44175 41 1941 7.21708 42 1942 6.62417 43 1943 8.325 44 1944 8.225 45 1945 7.95083 46 1946 8.88333 47 1947 7.97508 48 1948 8.75 49 1949 8.79908 50 1950 9 51 1951 9.325 52 1952 8.325 53 1953 8.03342 54 1954 7.2325 55 1955 7.98433 56 1956 6.84917 57 1957 8.6 58 1958 8.7585 59 1959 8.18333 60 1960 8.835 61 1961 8.74925 62 1962 8.07483 63 1963 7.60833325 64 1964 7.61667 65 1965 7.20833325 66 1966 8.95833325 67 1967 8.65833 68 1968 8.74925 69 1969 7.15167 70 1970 8.38333 71 1971 8.40842 72 1972 8.40833 73 1973 8.2 74 1974 8.7 75 1975 9.37492 76 1976 7.275 77 1977 8.6 78 1978 7.7 79 1979 8.6 80 1980 7.18417 81 1981 8.4325 82 1982 8.56667 83 1983 9.3 84 1984 8.27508 85 1985 7.14158 86 1986 8.55833325 87 1987 7.4 88 1988 8.29992 89 1989 9.82475 90 1990 9.77417 91 1991 8.25 92 1992 8.85 93 1993 8.125 94 1994 9.808333217 95 1995 8.55833 96 1996 7.92417 97 1997 8.091666583 98 1998 8.675 99 1999 9.59167 100 2000 9.91742 101 2001 9.05825 102 2002 9.51583 103 2003 8.61583 104 2004 8.9175 105 2005 8.74167 106 2006 8.65833 107 2007 10.3583 108 2008 9.97492 109 2009 9.9 -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX:+4 0230 52 16 64 silvic.usv.ro -- --- Catalin-Constantin ROIBU Forestry engineer, PhD Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX:+4 0230 52 16 64 silvic.usv.ro [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 0e+00
Hi, Rather than a graph label to display labels as 0e+00, how do I get it to display the real value? Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 0e+00
On Fri, Mar 29, 2013 at 10:44 AM, Shane Carey careys...@gmail.com wrote: Hi, Rather than a graph label to display labels as 0e+00, how do I get it to display the real value? Hi Shane, Is 0e+00 not a real value? I'd assume it's roughly equal to zero... ;-) More seriously, could we have a reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example focusing particularly on whether you are using base, lattice, or ggplot2 graphics. Michael Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Odd graphic device behavior
Thank you Peter, that sounds pretty reasonable. Best, Tom On Friday, March 29, 2013, peter dalgaard wrote: On Mar 28, 2013, at 22:27 , Thomas Adams wrote: All, Well to my relief and embarrassment, I discovered my problem. About 5 weeks ago, I shutdown my computer and moved it. When I reconnected everything I apparently plugged my HDMI monitor into the 'wrong' output port without realizing it. So, on a whim, just now, I made the switch to the other port and presto changeo -- problem solved!! The odd thing was, besides my R graphics device window problems, everything else was fine... Out of curiosity, can anyone explain this? My best guess is that the pixel resolution was taken from the disconnected primary display and set to some safe standard value like 640x480, miscalculating the dimensions of your display, so that it ended up with huge virtual inches. The reason everything else didn't notice could be that they work in pixel units rather than physical units. (There seems to be no really perfect solution to the problem of setting default dimensions: Pixel count gives stamp-sized graphs on hi-res displays, physical dimensions are meaningless on projectors and not really what you want on a tiny screen, and percent of display area is undue imperialism if you have a large monitor, intending to overlook many windows at once.) Thanks for all the help... Tom On Thu, Mar 28, 2013 at 4:06 PM, Thomas Adams tea...@gmail.comjavascript:; wrote: Luca, Thank you for the suggestion; I do have an Nvidia graphics card and I am using the Nvida driver; still searching for a solution, quite odd... Tom On Thu, Mar 28, 2013 at 12:28 PM, Luca Nanetti luca.nane...@gmail.comjavascript:; wrote: Thomas, any chance that you could have problems with your graphic driver? For instance, if you have an Nvidia graphic card, I would recommend switching from the 'nouveau' driver to the official Nvidia one. Kind regards, luca [[alternative HTML version deleted]] __ R-help@r-project.org javascript:; mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk javascript:; Priv: pda...@gmail.com javascript:; -- Thomas E Adams, III 718 McBurney Drive Lebanon, OH 45036 1 (513) 739-9512 (cell) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 0e+00
Good one!!! :-) Im plotting a Cumulative Frequency curve, see graph attached (just using normal basic plot command), but the values come out 4e+05 etc and I dont know how to produce the number without scientific notation? Thanks On Fri, Mar 29, 2013 at 10:58 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Fri, Mar 29, 2013 at 10:44 AM, Shane Carey careys...@gmail.com wrote: Hi, Rather than a graph label to display labels as 0e+00, how do I get it to display the real value? Hi Shane, Is 0e+00 not a real value? I'd assume it's roughly equal to zero... ;-) More seriously, could we have a reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example focusing particularly on whether you are using base, lattice, or ggplot2 graphics. Michael Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Shane __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
And if you would like to be able to read the crowded axis: boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') library(plotrix) staxlab(2, at=seq(0,25,1),cex=0.8) Jim On 03/29/2013 08:36 PM, Pascal Oettli wrote: Hi, Example adapted from ?boxplot par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,2.5)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,1)) HTH, Pascal On 29/03/13 18:22, Berg, Tobias van den wrote: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Hello, You can use axis(side=2, at=c(10, 30, 50, 70, 90)) or axis(side=2, at=seq(10, 90, by = 20)) Hope this helps, Rui Barradas Em 29-03-2013 09:22, Berg, Tobias van den escreveu: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Every week, I learn something new with R-help. Pascal On 29/03/13 20:23, Jim Lemon wrote: And if you would like to be able to read the crowded axis: boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') library(plotrix) staxlab(2, at=seq(0,25,1),cex=0.8) Jim On 03/29/2013 08:36 PM, Pascal Oettli wrote: Hi, Example adapted from ?boxplot par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,2.5)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,1)) HTH, Pascal On 29/03/13 18:22, Berg, Tobias van den wrote: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
Thank you all, Guess you'll learn everyday new stuff, especially in R. Tobias -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Pascal Oettli Verzonden: vrijdag 29 maart 2013 12:33 CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Every week, I learn something new with R-help. Pascal On 29/03/13 20:23, Jim Lemon wrote: And if you would like to be able to read the crowded axis: boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') library(plotrix) staxlab(2, at=seq(0,25,1),cex=0.8) Jim On 03/29/2013 08:36 PM, Pascal Oettli wrote: Hi, Example adapted from ?boxplot par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,2.5)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,1)) HTH, Pascal On 29/03/13 18:22, Berg, Tobias van den wrote: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 0e+00
Does this help? http://stackoverflow.com/questions/5963047/do-not-want-scientific-notation-on-plot-axis John Kane Kingston ON Canada -Original Message- From: careys...@gmail.com Sent: Fri, 29 Mar 2013 10:44:16 + To: r-help@r-project.org Subject: [R] 0e+00 Hi, Rather than a graph label to display labels as 0e+00, how do I get it to display the real value? Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem with plots with short example.
yes I was also having something like this happen to me just before everything blew up. i never set a working directory, but use file.choose() or call the path directly. but the last few hours before it failed, it kept running older datasets, when i clearly called the new data set, for example, within.mod - lm(wvsAB$dem ~ wvsAB$cpi + as.factor(wvsAB$country), data=wvsAB) would yeild in the summary immediately after: (with no error called on my model!) summary(within.mod) Call: lm(formula = dat$dem ~ dat$cpi + as.factor(dat$country), data = dat) i was forced to do rm(data) more than once. no idea what's goign on. On Mar 29, 2013, at 12:58 AM, Duncan Mackay wrote: Hi Nicole My code works using source file if I put library(runjags) x = testjags(findjags(windows,look_in = c:/Program Files/JAGS)) source(G:/Sweave/Bayes.R) works ok Further developments with Sweave. Putting this in the Sweave file library(runjags) x = testjags(findjags(windows,look_in = c:/Program Files/JAGS)) x ... $JAGS.available [1] TRUE $JAGS.path [1] \c:/Program Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe\ ... If I do not setwd() everything works fine for runjags but have not tried to plot any plots as pdf Unfortunately it comes up in my default c:\Users\d mackay\Documents\ Using setwd() before Sweave(G:/Sweave/Bayes.Rnw) and in the Sweave file # \Sweave file before run.jags call x = testjags(findjags(windows,look_in = c:/Program Files/JAGS)) It returns this error in the R command window Error: chunk 7 (label = JAGS2) Error in run.jags(model = mod, monitor = p, init = list(init1, init2), : Unable to call JAGS However x shows that it is finding JAGS x ... $JAGS.available [1] TRUE $JAGS.path [1] \c:/Program Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe\ ... Latex tex file You are currently logged on as d mackay, on a windows machine You are using R version 2.15.3 (2013-03-01), with the Rgui GUI JAGS version 3.3.0 found successfully using the command c:/Program Files/JAGS/JAGS-3.3.0/i386/bin/jags-terminal.exe So do not use setwd or change directory from the gui menu and it works but things end up where your default directory is I am not sure what is going on but any assistance to fix it would be appreciated. Regards Duncan At 12:45 29/03/2013, you wrote: I was up till 4 am with this sucker trying to figure it out- I thought i lost my mind/ screwed it up somehow. I guess it's nice to know it really wasn't me. Though, I AM sad R is messing up- first time in over 3 years, so I guess it isn't so bad. But timing couldn't have been worse, as I have a conference coming up. Thanks very much, Duncan! I am going to give that a whirl tomorrow! On Mar 28, 2013, at 10:37 PM, Duncan Mackay wrote: Hi Nicole I just upgraded to 2.15.3 today I was just having similar problems with run.jags and it stopping dead in its tracks with an error message pointing to somewhere else See ?run.jags and the second paragraph of it. I then got it to run using a run.jags script using Rterm and saved the model. By accident I copied and pasted a script to R with run.jags in it and it now runs. see also ?test.jags Do not know what will happen after a reboot. HTH Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au At 10:24 29/03/2013, you wrote: To be clear everything runs with no error message... the only hint of a problem is at the end of the code: the plot will not fill out/ it is empty. if anyone has any idea why something like this might happen, i would greatly appreciate it... so i can handle it quickly. thanks in advance. On Mar 28, 2013, at 7:55 PM, Nicole Ford wrote: i am having problem running my own data. yesterday it was working just fine. today it is not. this is the code i was using as an example to follow. this code ALSO worked just fine yesterday, and is no longer working at all. i suspect it is a problem with either my computer or the software, at this point. if THIS won't even run something is wrong. i can assure you this isn't HW i know dave, but i am no longer at UW-M and i have never learned HLMs and i am learning this on my own for my own research. his code is here, along with data. it is short, quick, etc. http://www.quantoid.net/936/Lecture7.R ### R code from vignette source 'Lecture7.Rnw' ### ### code chunk number 1: opts ### options(useFancyQuotes=F) ### ### code chunk number 2: data1 ###
Re: [R] Conditional CCA and Monte Carlo - Help!
Thank you so much for your response! This clarifies the issue I was having. Cheers, Matt On Fri, Mar 29, 2013 at 2:43 AM, Jari Oksanen [via R] ml-node+s789695n4662809...@n4.nabble.com wrote: MWilson mjw029 at bucknell.edu writes: Hi All, I am using canonical correspondence analysis to compare a community composition matrix to a matrix of sample spatial relationships and environmental variables. In order to parse out how much variance is explained purely by space (S/E) or the environment (E/S) I am using a conditional (partial) CCA. I want to test significance via Monte Carlo but I can not find a way to do this with a conditional CCA. I have been using vegan for the CCA and attempting to use ade4 to run a Monte Carlo. However, these two packages conflict when it comes to CCA. If I use vegan I can run a conditional CCA, and if I use ade4 I can do a Monte Carlo - but I can't figure out how to do a conditional CCA with ade4 OR a Monte Carlo with vegan. If anyone has experience with this I would be truly grateful for your help! I am fairly new to R, and I have quickly found myself in a place where Google-ing has no longer proven useful. Below are my scripts and error messages. -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo- Help-tp4662572.html Sent from the R help mailing list archive at Nabble.com. randtest() is an ade4 function that only works with ade4 result objects. That you found the hard way. In vegan we have permutest: see ?permutest.cca. Some other similar functions are described together with permutest.cca, but permutest() is similar to randtest. ade4::randtest.cca and vegan:::permutest.cca work similarly and are comparable with basic models, but there are following differences: 1) vegan uses ter Braak's pseudo-F statistic, whereas ade4 returns the proportion constrained/all eigenvalues. These are similar to a constant multiplier in non-conditional models and with direct or reduced permutation models in vegan, but differ otherwise. The ade4 alternative is not good for partial models (but that does not matter since ade4 has no partial models). The vegan:::permutest.cca function returns items num and den (numerator and denominator) that can be used to get the proportion of ade4. 2) vegan permutes response (community) data whereas ade4 permutes constraints (environmental data). This makes only difference in partial (conditional) models or with some non-default permutation strategies in vegan. However, because of this, ade4 and vegan results are not identical with the same random number seed (with little trickery this can be fixed, but that is hardly for beginners). Permutation of community data is needed in analysis of conditional (partial) models, and in some permutation strategies. 3) We do not call it Monte Carlo, but permutation. (Monte Carlo is too expensive for me -- I prefer Menton). That may explain why Google did not find it to you. In general, you should not expect methods functions (such as ade4::randtest.cca) to work across packages. In sometimes they do, but in those cases the package authors have taken special care to make their functions to work with alien objects. Not in this case. It neither makes sense for ade4::randtest be able to handle vegan object because randtest does not know what to do with contional (partial) models. Cheers, Jari Oksanen __ [hidden email] http://user/SendEmail.jtp?type=nodenode=4662809i=0mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-Help-tp4662572p4662809.html To unsubscribe from Conditional CCA and Monte Carlo - Help!, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4662572code=bWp3MDI5QGJ1Y2tuZWxsLmVkdXw0NjYyNTcyfC0xMjYyOTcxMTM3 . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/Conditional-CCA-and-Monte-Carlo-Help-tp4662572p4662832.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide
Re: [R] 0e+00
Yup, that worked, cheers for that John On Fri, Mar 29, 2013 at 12:09 PM, John Kane jrkrid...@inbox.com wrote: Does this help? http://stackoverflow.com/questions/5963047/do-not-want-scientific-notation-on-plot-axis John Kane Kingston ON Canada -Original Message- From: careys...@gmail.com Sent: Fri, 29 Mar 2013 10:44:16 + To: r-help@r-project.org Subject: [R] 0e+00 Hi, Rather than a graph label to display labels as 0e+00, how do I get it to display the real value? Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk and most webmails -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] changing y-axis intervals in a boxplot
This can also be done without the axis() function: par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, yaxp=c(0, 25, 10), cex.axis=0.6, col = lightgray) boxplot(count ~ spray, data = InsectSprays, yaxp=c(0, 25, 25), cex.axis=0.6, col = lightgray) -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Pascal Oettli Sent: Friday, March 29, 2013 6:33 AM Cc: 'r-help@r-project.org' Subject: Re: [R] changing y-axis intervals in a boxplot Every week, I learn something new with R-help. Pascal On 29/03/13 20:23, Jim Lemon wrote: And if you would like to be able to read the crowded axis: boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') library(plotrix) staxlab(2, at=seq(0,25,1),cex=0.8) Jim On 03/29/2013 08:36 PM, Pascal Oettli wrote: Hi, Example adapted from ?boxplot par(las=1, mfrow=c(2,1)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,2.5)) boxplot(count ~ spray, data = InsectSprays, col = lightgray, yaxt='n') axis(2, at=seq(0,25,1)) HTH, Pascal On 29/03/13 18:22, Berg, Tobias van den wrote: Thank you Pascal but unfortunelately i still didn't figure out how to change the numbers presented at the y-axis. I looked up your suggestions but if I'm right, yaxt can set if the axis is presented (yaxt=s) or suppressed (yaxt=n) which does not help for changing the values on the y-axis. The 'at' argument did solve my problem but in a clumsy way. Although I'm happy that I managed, does anyone know how to do the same job in a more convenient way? This is the 'clumsy' code I used: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) axis(side=2, at=10) axis(side=2, at=30) axis(side=2, at=50) axis(side=2, at=70) axis(side=2, at=90) Kind regards, Tobias -Oorspronkelijk bericht- Van: Pascal Oettli [mailto:kri...@ymail.com] Verzonden: vrijdag 29 maart 2013 8:44 Aan: Berg, Tobias van den CC: 'r-help@r-project.org' Onderwerp: Re: [R] changing y-axis intervals in a boxplot Hello, ?par (particularly the 'yaxt' argument) ?axis ('side' and 'at' arguments) Hope this help, Pascal On 29/03/13 16:37, Berg, Tobias van den wrote: Dear R-users, I'm a bit of a rooky in R and do not know how to change the y-axis intervals of a boxplot. The y-axis in my boxplot ranges from 0 to 100 which is fine. The problem is the interval level in between. Now it increases with steps of 20 but I'd like to have it changed by steps of 5. Anyone knows how to do this in R? I used the following code for producing this boxplot: boxplot((fitted(finalfit4) *100) ~ instabilitydata2$MRI_Diag_Instab_rev, ylim=c(0,100), xlab=MRA diagnosis, ylab=Predicted probability (%)) Kind regards, Tobias __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] weird error with a lazyload .RData file in a package
I added a new data file, NLSY.RData, to a package that uses LazyData: Yes It passed R CRAN check and R CMD install worked w/o significant complaints. * installing to library 'C:/R/R-2.15.2/library' * installing *source* package 'heplots' ... ** R ** data ** moving datasets to lazyload DB ** demo ** inst ** preparing package for lazy loading Warning: package 'nnet' was built under R version 2.15.3 ** help ... Yet, when I try to use it, I get something incomprehensible: library(heplots) str(NLSY) Error in str(NLSY) : internal error -3 in R_decompress1 In addition: Warning message: In str(NLSY) : restarting interrupted promise evaluation But it works if I load directly from the file I imported into the package: load(NLSY.RData) str(NLSY) 'data.frame': 243 obs. of 6 variables: $ math: num 50 28.6 50 32.1 21.4 ... $ read: num 45.2 28.6 53.6 34.5 22.6 ... $ antisoc : int 4 0 2 0 0 1 0 1 1 4 ... $ hyperact: int 3 0 2 2 2 0 1 4 3 5 ... $ income : num 52.52 42.6 50 6.08 7.41 ... $ educ: int 14 12 12 12 14 12 12 12 12 9 ... What could cause this? -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help partimat()
Hello David, Thank you for letting me know that the partimat() function calls that function. I am kind of knew to R so I do not know exactly how to describe the structure. If I understand correctly, what I essentially need to do is pass in all the different data sets into one partimat() function and then the partimat() function will create the different plots and the way the different data sets get passed in is by describing a structure of the different data and passing it into the partimat() function. Is my thinking correct? Would it also be possible if I could be directed to a website that shows me how to describe a data structure or if someone could be so generous as to tell me how to do this? I would greatly appreciate it and thank you for the help. Thanks, Antelmo Aguilar From: David Winsemius [dwinsem...@comcast.net] Sent: Thursday, March 28, 2013 9:15 PM To: Antelmo Aguilar Cc: r-help@r-project.org Subject: Re: [R] Help partimat() On Mar 28, 2013, at 1:45 PM, Antelmo Aguilar wrote: Hello Everyone, I was wondering if anyone knows a solution to a problem I am experiencing. I have an R script that creates multiple graphs of the data in several data file using the partimat() function that is located in the klaR library. I would like to get this graphs into a single image similar to the way one can use the par() function and then the plot() function to put multiple plots side by side. The problem is that the par() function does not work with partimat() so I was wondering if there is an equivalent way of achieving the same result when using partimat(). I have searched for several hours already and I have not been able to find a solution. I would greatly appreciate any help. Attached is the script as well as the end result I would like to get after running the script. What happens is that inside the partimat.default function this line appears: opar - par(mfrow = c(nvar, nvar), mar = mar, oma = rep(3, 4), xpd = NA) So the graphics setup is being driven by the structure of the data that is being given (which you have not described.) -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help partimat()
On 29.03.2013 15:59, Antelmo Aguilar wrote: Hello David, Thank you for letting me know that the partimat() function calls that function. I am kind of knew to R so I do not know exactly how to describe the structure. If I understand correctly, what I essentially need to do is pass in all the different data sets into one partimat() function and then the partimat() function will create the different plots and the way the different data sets get passed in is by describing a structure of the different data and passing it into the partimat() function. Is my thinking correct? Would it also be possible if I could be directed to a website that shows me how to describe a data structure or if someone could be so generous as to tell me how to do this? I would greatly appreciate it and thank you for the help. partimat is intended to plot several plots for each combination of explanatory variables in a classification problem. If you want to generate such plots separately and/or combine them in another way, see the help page. It says See Also: for much more fine tuning see drawparti. The latter function allows to generate a single plot that can again be arranged within others by the user. Best, Uwe Ligges Thanks, Antelmo Aguilar From: David Winsemius [dwinsem...@comcast.net] Sent: Thursday, March 28, 2013 9:15 PM To: Antelmo Aguilar Cc: r-help@r-project.org Subject: Re: [R] Help partimat() On Mar 28, 2013, at 1:45 PM, Antelmo Aguilar wrote: Hello Everyone, I was wondering if anyone knows a solution to a problem I am experiencing. I have an R script that creates multiple graphs of the data in several data file using the partimat() function that is located in the klaR library. I would like to get this graphs into a single image similar to the way one can use the par() function and then the plot() function to put multiple plots side by side. The problem is that the par() function does not work with partimat() so I was wondering if there is an equivalent way of achieving the same result when using partimat(). I have searched for several hours already and I have not been able to find a solution. I would greatly appreciate any help. Attached is the script as well as the end result I would like to get after running the script. What happens is that inside the partimat.default function this line appears: opar - par(mfrow = c(nvar, nvar), mar = mar, oma = rep(3, 4), xpd = NA) So the graphics setup is being driven by the structure of the data that is being given (which you have not described.) -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Create values based on a table of conditions
Hi R help forum, I have a simple data frame of four columns - one of numbers (really a categorical variable), one of dates and one of data. I have over 500,000 data points to work with, spread over 40 files, each named after a different animal. These are contact data recorded by proximity loggers over two years between the animals of the file name and collars being worn by other animals. The collar may have been worn by more than one different animal in the study period. So for example... filename: RD2 And the data looks like: (I'm sorry here, dput(head(RD2, 200)) was outputting all the times, such that it was too large for the console, so I just used head() ) head(RD2, 200) encounter_id date encounter_start encounter_length 1 15 22/06/201122:21:45 20 2 10 04/07/201104:18:571 3 10 04/07/201104:23:121 4 15 08/07/201102:02:30 23 5 15 08/07/201102:03:26 264 6 15 08/07/201102:09:20 35 7 15 08/07/201102:10:25 173 8 15 08/07/201102:13:40 65 9 15 08/07/201102:15:12 47 1015 08/07/201102:17:16 65 1115 08/07/201102:39:10 54 1215 14/07/201102:20:271 1315 14/07/201102:23:356 1415 14/07/201102:25:521 1515 14/07/201102:26:17 39 1615 14/07/201102:28:36 31 1760 14/07/201102:41:561 1860 14/07/201102:42:301 1960 14/07/201102:43:30 36 2060 14/07/201102:45:381 2160 14/07/201102:46:07 15 2260 14/07/201102:46:59 11 2352 14/07/201102:57:43 97 2412 09/08/201122:13:421 2541 18/08/201102:53:181 2641 19/08/201100:57:461 2741 19/08/201101:59:171 2841 19/08/201102:06:16 21 2941 19/08/201102:08:501 3041 19/08/201102:09:26 29 3150 19/08/201102:19:311 3250 19/08/201102:20:201 3350 19/08/201102:20:541 3450 19/08/201102:21:25 25 3550 19/08/201102:22:17 20 3650 19/08/201102:23:00 10 3750 19/08/201102:25:101 3850 19/08/201102:25:541 3950 19/08/201102:26:50 75 4050 19/08/201102:29:531 4150 19/08/201102:30:416 4250 28/08/201119:32:471 4350 28/08/201119:36:38 10 4439 30/08/201122:13:141 4552 13/09/201120:04:57 17 4620 18/09/201100:32:438 4717 02/10/201109:10:18 52 4817 02/10/201109:15:491 4917 02/10/201109:17:191 5025 03/10/201117:16:206 5141 05/10/201104:04:351 5252 07/10/201122:59:57 45 5362 16/10/201118:33:036 5452 28/10/201115:19:471 5541 28/10/201119:00:248 5617 03/12/201117:38:082 5717 03/12/201117:38:49 20 5817 20/05/201219:45:17 17 5917 20/05/201219:45:58 47 6017 22/05/201223:12:541 6117 22/05/201223:15:153 6217 22/05/201223:15:407 6317 22/05/201223:16:09 40 6417 22/05/201223:36:303 6517 22/05/201223:37:29 10 6617 22/05/201223:39:171 6717 23/05/201220:44:01 15 68 6 17/07/201204:25:298 6953 17/07/201223:53:012 7053 24/07/2012
[R] gls + summary assumptions
Dear R users,I proceeded to a regression through the gls fonction (package nlme) with the following code: a1=read.table(total25.txt,header=TRUE)a1$T=factor(a1$T)m2=gls(Res~ModeF*T,a1)m2summary(m2) I used gls fonction because it deals with heteroskedasticity and I would like you to confirm that I do not have to check for it after the summary procedure. It would seem logical to me but I am not sure what to do here. Thank's for your help, Rob. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] change font size in R editor
Hi, Check these links: http://r.789695.n4.nabble.com/Change-font-size-in-Windows-td3518034.html http://r.789695.n4.nabble.com/GUI-font-size-td798626.html A.K. From: Joanna Zhang zjoanna2...@gmail.com Sent: Friday, March 29, 2013 10:01 AM Subject: change font size in R editor Hi Arun, Do you know if there is a way to change font size in R editor? The font size is so small __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error message in dredge function (MuMIn package) used with binary GLM
Hi all, I'm having trouble with the model generating 'dredge' function in the MuMIn 'Multi-model Inference' package. Here's the script: globalmodel- glm(TB~lat+protocol+tested+ streams+goats+hay+cattle+deer, family=binomial) chat- deviance(globalmodel)/59 #There we 59 residual degrees of freedom in this global model. models- dredge(globalmodel, beta=FALSE, evaluate=TRUE, rank=AICc, chat=chat, fixed=NULL, trace=FALSE) And the error message is: Error in UseMethod(logLik) : no applicable method for 'logLik' applied to an object of class logical I have trawled the literature and it seems to be ok to use a binary GLM as the global model - could this be the problem? The variables are a mix of binary and continuous data. Any thoughts? Thanks, Cat __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] FMOLS DOLS and ADL regression
Whether can any R package run Full modified OLS (Phillips and Hansen 1990 ), DOLS (Stock and Watson 1993) and ADL model (Pesaran and Shin 2001) for cointegrated VAR model? I cannot find any useful order in VAR and SVAR package. Thanks. Eric Wang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How do you graph data when you have lots of small values but few extremely large values?
I was thinking of splitting the y-axis into two? Is this possible? Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do you graph data when you have lots of small values but few extremely large values?
On Fri, 29 Mar 2013, Shane Carey wrote: I was thinking of splitting the y-axis into two? Is this possible? Shane, Does a boxplot show what you want to display? If not, what information do you wish to convey about these data? Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] weird error with a lazyload .RData file in a package
On 29.03.2013 15:24, Michael Friendly wrote: I added a new data file, NLSY.RData, to a package that uses LazyData: Yes It passed R CRAN check and R CMD install worked w/o significant complaints. * installing to library 'C:/R/R-2.15.2/library' * installing *source* package 'heplots' ... ** R ** data ** moving datasets to lazyload DB ** demo ** inst ** preparing package for lazy loading Warning: package 'nnet' was built under R version 2.15.3 ** help ... Yet, when I try to use it, I get something incomprehensible: library(heplots) str(NLSY) Error in str(NLSY) : internal error -3 in R_decompress1 In addition: Warning message: In str(NLSY) : restarting interrupted promise evaluation But it works if I load directly from the file I imported into the package: load(NLSY.RData) str(NLSY) 'data.frame': 243 obs. of 6 variables: $ math: num 50 28.6 50 32.1 21.4 ... $ read: num 45.2 28.6 53.6 34.5 22.6 ... $ antisoc : int 4 0 2 0 0 1 0 1 1 4 ... $ hyperact: int 3 0 2 2 2 0 1 4 3 5 ... $ income : num 52.52 42.6 50 6.08 7.41 ... $ educ: int 14 12 12 12 14 12 12 12 12 9 ... What could cause this? No idea. Can you make the package source (incl that Rdata file) available? Best, Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do you graph data when you have lots of small values but few extremely large values?
On Fri, 29 Mar 2013, Shane Carey wrote: Need to try show it as a bar chart or similar, Will a ln(y) transformation meet your needs? Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do you graph data when you have lots of small values but few extremely large values?
On 3/29/2013 10:52 AM, Shane Carey wrote: I was thinking of splitting the y-axis into two? Is this possible? Thanks Look at the plotrix package and see: https://stat.ethz.ch/pipermail/r-help/2011-September/290685.html -- Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] weird error with a lazyload .RData file in a package
On 29/03/2013 14:24, Michael Friendly wrote: I added a new data file, NLSY.RData, to a package that uses LazyData: Yes It passed R CRAN check and R CMD install worked w/o significant complaints. * installing to library 'C:/R/R-2.15.2/library' * installing *source* package 'heplots' ... ** R ** data ** moving datasets to lazyload DB ** demo ** inst ** preparing package for lazy loading Warning: package 'nnet' was built under R version 2.15.3 ** help ... Yet, when I try to use it, I get something incomprehensible: library(heplots) str(NLSY) Error in str(NLSY) : internal error -3 in R_decompress1 In addition: Warning message: In str(NLSY) : restarting interrupted promise evaluation That usually means that the LazyData database has been corrupted (and most likely was not created properly). As to why: we need the reproducible example the posting guide asked you to provide. But it works if I load directly from the file I imported into the package: load(NLSY.RData) str(NLSY) 'data.frame': 243 obs. of 6 variables: $ math: num 50 28.6 50 32.1 21.4 ... $ read: num 45.2 28.6 53.6 34.5 22.6 ... $ antisoc : int 4 0 2 0 0 1 0 1 1 4 ... $ hyperact: int 3 0 2 2 2 0 1 4 3 5 ... $ income : num 52.52 42.6 50 6.08 7.41 ... $ educ: int 14 12 12 12 14 12 12 12 12 9 ... What could cause this? -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] weird error with a lazyload .RData file in a package
On Mar 29, 2013, at 17:22 , Prof Brian Ripley wrote: On 29/03/2013 14:24, Michael Friendly wrote: I added a new data file, NLSY.RData, to a package that uses LazyData: Yes It passed R CRAN check and R CMD install worked w/o significant complaints. * installing to library 'C:/R/R-2.15.2/library' * installing *source* package 'heplots' ... ** R ** data ** moving datasets to lazyload DB ** demo ** inst ** preparing package for lazy loading Warning: package 'nnet' was built under R version 2.15.3 ** help ... Yet, when I try to use it, I get something incomprehensible: library(heplots) str(NLSY) Error in str(NLSY) : internal error -3 in R_decompress1 In addition: Warning message: In str(NLSY) : restarting interrupted promise evaluation That usually means that the LazyData database has been corrupted (and most likely was not created properly). As to why: we need the reproducible example the posting guide asked you to provide. I had the same symptom a couple of days ago. It went away after quitting and restarting the R session. I kind of put it down to leaving an R session running while updating R (Yeah, I know: Still nothing reproducible...). The warning about nnet from 2.15.3 while installing to R-2.15.2/library suggests that something similar could be afoot in this case. -- 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 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] Make a matrix from two lists
I am trying to write a function that makes a matrix out of two lists. As you will see run running the function below, the result is NOT a matrix but rather a list. Can anyone tell me what I am doing wrong? Thanks, John test - function(one,two) { cat(List One=,one,\n) cat(List Two=,two,\n) cat(Should be a matrix, but is not,matrix(cbind(one,two)),\n) } x - c(1,2,3) y - c(11,22,33) test(x,y) John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) head(final1) # m1 n1 x1 y1 flag #1 4 4 0 0 0 #2 4 4 0 1 0 #3 4 4 0 2 0 #4 4 4 0 3 0 #5 4 4 0 4 0 #6 4 4 1 0 1 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
Forgot: colnames(final)- c(m1,n1,x1,y1) before; final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) - Original Message - From: arun smartpink...@yahoo.com To: Joanna Zhang zjoanna2...@gmail.com Cc: R help r-help@r-project.org Sent: Friday, March 29, 2013 1:47 PM Subject: Re: if clause in data frame Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) head(final1) # m1 n1 x1 y1 flag #1 4 4 0 0 0 #2 4 4 0 1 0 #3 4 4 0 2 0 #4 4 4 0 3 0 #5 4 4 0 4 0 #6 4 4 1 0 1 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make a matrix from two lists
Hi, On Mar 29, 2013, at 1:29 PM, John Sorkin wrote: I am trying to write a function that makes a matrix out of two lists. As you will see run running the function below, the result is NOT a matrix but rather a list. Can anyone tell me what I am doing wrong? Thanks, John test - function(one,two) { cat(List One=,one,\n) cat(List Two=,two,\n) cat(Should be a matrix, but is not,matrix(cbind(one,two)),\n) } x - c(1,2,3) y - c(11,22,33) test(x,y) x - c(1,2,3) y - c(11,22,33) z - cbind(x,y) is.matrix(z) [1] TRUE As you can see above, I don't get the same result. I not sure if you want to see the matrix printed in matrix form when you have it in test(). If that were the case then you'll want to avoid cat() and use print() instead. test - function(one,two) { cat(List One=,one,\n) cat(List Two=,two,\n) z - cbind(one, two) print(z) } test(x,y) List One= 1 2 3 List Two= 11 22 33 one two [1,] 1 11 [2,] 2 22 [3,] 3 33 Cheers, Ben Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] weird error with a lazyload .RData file in a package
On 3/29/2013 12:05 PM, Uwe Ligges wrote: What could cause this? No idea. Can you make the package source (incl that Rdata file) available? It must have been something in my old session. Starting a fresh one, it went away. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Make a matrix from two lists
Ben, Thank you. When I used print I saw the matrix; the problem was as you indicated that I was using cat. Thanks, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Ben Tupper btup...@bigelow.org 3/29/2013 1:49 PM Hi, On Mar 29, 2013, at 1:29 PM, John Sorkin wrote: I am trying to write a function that makes a matrix out of two lists. As you will see run running the function below, the result is NOT a matrix but rather a list. Can anyone tell me what I am doing wrong? Thanks, John test - function(one,two) { cat(List One=,one,\n) cat(List Two=,two,\n) cat(Should be a matrix, but is not,matrix(cbind(one,two)),\n) } x - c(1,2,3) y - c(11,22,33) test(x,y) x - c(1,2,3) y - c(11,22,33) z - cbind(x,y) is.matrix(z) [1] TRUE As you can see above, I don't get the same result. I not sure if you want to see the matrix printed in matrix form when you have it in test(). If that were the case then you'll want to avoid cat() and use print() instead. test - function(one,two) { cat(List One=,one,\n) cat(List Two=,two,\n) z - cbind(one, two) print(z) } test(x,y) List One= 1 2 3 List Two= 11 22 33 one two [1,] 1 11 [2,] 2 22 [3,] 3 33 Cheers, Ben Ben Tupper Bigelow Laboratory for Ocean Sciences 60 Bigelow Drive, P.O. Box 380 East Boothbay, Maine 04544 http://www.bigelow.org Confidentiality Statement: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Installing views in R2.15.3
Hi, Please what am I doing wrong? I tried installing some views (eg MachineLearning, Multivariate) on R2.15.3, but it keeps on telling me that the package is not available for 2.15.3. Is it true? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] FMOLS DOLS and ADL regression
Whether can any R package run Full modified OLS (Phillips and Hansen 1990 ), DOLS (Stock and Watson 1993) and ADL model (Pesaran and Shin 2001) for cointegrated VAR model? I cannot find any useful order in VAR and SVAR package. Thanks. Eric Wang [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing views in R2.15.3
On Mar 29, 2013, at 10:40 AM, ugulum...@yahoo.com wrote: Hi, Please what am I doing wrong? I tried installing some views (eg MachineLearning, Multivariate) on R2.15.3, but it keeps on telling me that the package is not available for 2.15.3. Is it true? You cannot install TaskViews. You (the human) need to read the task view and decide what package you wnat to tell your machine to install. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] pairs(X,Y) analog of cor(X,Y)?
With a data frame containing some X Y variables I can get the between set correlations with cor(X,Y): cor(NLSY[,1:2], NLSY[3:6]) antisochyperact income educ math 0.043381307 -0.07581733 0.25487753 0.2876875 read -0.003735785 -0.07555683 0.09114299 0.1884101 Is there somewhere an analog of pairs(X,Y) that will produce the pairwise plots of each X against each Y? The formula method for pairs() is for a one-sided formula. As a formula, I'm looking for something like pairs(math + read ~ antisoc +hyperact + income + educ, data=NLSY) lattice::xyplot has an extended formula interface, but interprets '+' to mean superposition. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing views in R2.15.3
On 29.03.2013 19:07, David Winsemius wrote: On Mar 29, 2013, at 10:40 AM, ugulum...@yahoo.com wrote: Hi, Please what am I doing wrong? I tried installing some views (eg MachineLearning, Multivariate) on R2.15.3, but it keeps on telling me that the package is not available for 2.15.3. Is it true? You cannot install TaskViews. You (the human) need to read the task view and decide what package you wnat to tell your machine to install. Actually, you can install task views via the ctv package, nevertheless, without any reproducible code nor the actual error message it is really hard to help. Best, Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How do you graph data when you have lots of small values but few extremely large values?
The plotrix package provides a way to insert a break into a y-axis but doing so is not considered really good plotting behaviour. The split axis method actually shows the data but human perception has a hard time handling the split. I'd look at some kind of transformation as a possibility or pehaps plotting two graphs or panels (see http://stats.stackexchange.com/questions/1764/what-are-alternatives-to-broken-axes). John Kane Kingston ON Canada -Original Message- From: careys...@gmail.com Sent: Fri, 29 Mar 2013 15:52:17 + To: r-help@r-project.org Subject: [R] How do you graph data when you have lots of small values but few extremely large values? I was thinking of splitting the y-axis into two? Is this possible? Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Installing views in R2.15.3
On Fri, 29 Mar 2013, Uwe Ligges wrote: On 29.03.2013 19:07, David Winsemius wrote: On Mar 29, 2013, at 10:40 AM, ugulum...@yahoo.com wrote: Hi, Please what am I doing wrong? I tried installing some views (eg MachineLearning, Multivariate) on R2.15.3, but it keeps on telling me that the package is not available for 2.15.3. Is it true? You cannot install TaskViews. You (the human) need to read the task view and decide what package you wnat to tell your machine to install. Actually, you can install task views via the ctv package, See also the bottom of: http://CRAN.R-project.org/web/views/ nevertheless, without any reproducible code nor the actual error message it is really hard to help. Yes, true. But it may help the original poster to look at which packages could not be installed and check their corresponding CRAN web packages. Often the packages have certain system requirements and hence no binary versions are available for certain OSs etc. hth, Z Best, Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] pairs(X,Y) analog of cor(X,Y)?
There is the pairs2 function in the TeachingDemos package that works like cor(x,y) where you give it 2 matricies/data frames and it gives the pairwise plots between the 2 groups. There is currently not a formula interface. On Fri, Mar 29, 2013 at 12:16 PM, Michael Friendly frien...@yorku.cawrote: With a data frame containing some X Y variables I can get the between set correlations with cor(X,Y): cor(NLSY[,1:2], NLSY[3:6]) antisochyperact income educ math 0.043381307 -0.07581733 0.25487753 0.2876875 read -0.003735785 -0.07555683 0.09114299 0.1884101 Is there somewhere an analog of pairs(X,Y) that will produce the pairwise plots of each X against each Y? The formula method for pairs() is for a one-sided formula. As a formula, I'm looking for something like pairs(math + read ~ antisoc +hyperact + income + educ, data=NLSY) lattice::xyplot has an extended formula interface, but interprets '+' to mean superposition. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Gregory (Greg) L. Snow Ph.D. 538...@gmail.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Create values based on a table of conditions
I must be blind but I don' see any link between the two files. RD2 seems to give some kind of encounter data in length of time. allocate gives the time that an animal was wearing a collar ? If each file belongs to a specific animal (am I reading this correctly) what does it matter what the collar was? Or is there something in the RD2 file that gives a clue to other collars ? I must be missing the point completely but I don't understand why you want to know who was wearing what at what time from the data you have presented. BTW , nice presentation of the sample data however dput (head(RD2, 200)) would have been even better than head(RD2, 200). John Kane Kingston ON Canada -Original Message- From: cat.e.co...@gmail.com Sent: Fri, 29 Mar 2013 18:49:45 +0800 To: r-help@r-project.org Subject: [R] Create values based on a table of conditions Hi R help forum, I have a simple data frame of four columns - one of numbers (really a categorical variable), one of dates and one of data. I have over 500,000 data points to work with, spread over 40 files, each named after a different animal. These are contact data recorded by proximity loggers over two years between the animals of the file name and collars being worn by other animals. The collar may have been worn by more than one different animal in the study period. So for example... filename: RD2 And the data looks like: (I'm sorry here, dput(head(RD2, 200)) was outputting all the times, such that it was too large for the console, so I just used head() ) head(RD2, 200) encounter_id date encounter_start encounter_length 1 15 22/06/201122:21:45 20 2 10 04/07/201104:18:571 3 10 04/07/201104:23:121 4 15 08/07/201102:02:30 23 5 15 08/07/201102:03:26 264 6 15 08/07/201102:09:20 35 7 15 08/07/201102:10:25 173 8 15 08/07/201102:13:40 65 9 15 08/07/201102:15:12 47 1015 08/07/201102:17:16 65 1115 08/07/201102:39:10 54 1215 14/07/201102:20:271 1315 14/07/201102:23:356 1415 14/07/201102:25:521 1515 14/07/201102:26:17 39 1615 14/07/201102:28:36 31 1760 14/07/201102:41:561 1860 14/07/201102:42:301 1960 14/07/201102:43:30 36 2060 14/07/201102:45:381 2160 14/07/201102:46:07 15 2260 14/07/201102:46:59 11 2352 14/07/201102:57:43 97 2412 09/08/201122:13:421 2541 18/08/201102:53:181 2641 19/08/201100:57:461 2741 19/08/201101:59:171 2841 19/08/201102:06:16 21 2941 19/08/201102:08:501 3041 19/08/201102:09:26 29 3150 19/08/201102:19:311 3250 19/08/201102:20:201 3350 19/08/201102:20:541 3450 19/08/201102:21:25 25 3550 19/08/201102:22:17 20 3650 19/08/201102:23:00 10 3750 19/08/201102:25:101 3850 19/08/201102:25:541 3950 19/08/201102:26:50 75 4050 19/08/201102:29:531 4150 19/08/201102:30:416 4250 28/08/201119:32:471 4350 28/08/201119:36:38 10 4439 30/08/201122:13:141 4552 13/09/201120:04:57 17 4620 18/09/201100:32:438 4717 02/10/201109:10:18 52 4817 02/10/201109:15:491 4917 02/10/201109:17:191 5025 03/10/201117:16:206 5141 05/10/201104:04:351 5252 07/10/201122:59:57 45 5362 16/10/201118:33:036 5452 28/10/201115:19:47
Re: [R] Installing views in R2.15.3
On Mar 29, 2013, at 11:19 AM, Uwe Ligges wrote: On 29.03.2013 19:07, David Winsemius wrote: On Mar 29, 2013, at 10:40 AM, ugulum...@yahoo.com wrote: Hi, Please what am I doing wrong? I tried installing some views (eg MachineLearning, Multivariate) on R2.15.3, but it keeps on telling me that the package is not available for 2.15.3. Is it true? You cannot install TaskViews. You (the human) need to read the task view and decide what package you wnat to tell your machine to install. Actually, you can install task views via the ctv package, nevertheless, without any reproducible code nor the actual error message it is really hard to help. My apologies for the incorrect information. You can install the packages in the TaskViews with ctv package. I can see some problems when I try to install the MachineLearning core packages, but this may be due to the fact that I am ahead of the curve. My R 3.0.0 beta installation under MacOS 10.6.8 already had most if not all of those packages installed but they were at higher version numbers than the ctv installation was requesting from the binary repository. Got limited success (two packages installed) but several errors relating to 'missing packages' I think because there was a mismatch for ctv's requests for 3.0.0 beta with this command: install.packages(ctv) library(ctv) install.views(MachineLearning, coreOnly = TRUE) This did run without error: install.views(MachineLearning, coreOnly = TRUE, type=source) ( Probably needs the XCode to be properly installed if on a Mac or RTools if on Windows.) Best, Uwe Ligges David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
On Mar 29, 2013, at 10:47 AM, arun wrote: Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) That looks likely to be extremely slow. 'rbind.data.frame' is notoriously slow when applied iteratively in loops. Couldn't this just be: dat - expand.grid(m1 = 4:10, n1 = 4:10, x1 = 0: m1, y1 = 0: n1) final= within(dat, flag=as.numeric( x1/m1y1/n1) ) -- David. head(final1) # m1 n1 x1 y1 flag #1 4 4 0 00 #2 4 4 0 10 #3 4 4 0 20 #4 4 4 0 30 #5 4 4 0 40 #6 4 4 1 01 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
Yes, that is better. I just copied the same function that the OP used. A.K. From: David Winsemius dwinsem...@comcast.net To: arun smartpink...@yahoo.com Cc: Joanna Zhang zjoanna2...@gmail.com; R help r-help@r-project.org Sent: Friday, March 29, 2013 4:46 PM Subject: Re: [R] if clause in data frame On Mar 29, 2013, at 10:47 AM, arun wrote: Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) That looks likely to be extremely slow. 'rbind.data.frame' is notoriously slow when applied iteratively in loops. Couldn't this just be: dat - expand.grid(m1 = 4:10, n1 = 4:10, x1 = 0: m1, y1 = 0: n1) final= within(dat, flag=as.numeric( x1/m1y1/n1) ) -- David. head(final1) # m1 n1 x1 y1 flag #1 4 4 0 0 0 #2 4 4 0 1 0 #3 4 4 0 2 0 #4 4 4 0 3 0 #5 4 4 0 4 0 #6 4 4 1 0 1 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
On Mar 29, 2013, at 1:48 PM, arun wrote: Yes, that is better. I just copied the same function that the OP used. A.K. From: David Winsemius dwinsem...@comcast.net To: arun smartpink...@yahoo.com Cc: Joanna Zhang zjoanna2...@gmail.com; R help r-help@r-project.org Sent: Friday, March 29, 2013 4:46 PM Subject: Re: [R] if clause in data frame On Mar 29, 2013, at 10:47 AM, arun wrote: Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) That looks likely to be extremely slow. 'rbind.data.frame' is notoriously slow when applied iteratively in loops. Couldn't this just be: dat - expand.grid(m1 = 4:10, n1 = 4:10, x1 = 0: m1, y1 = 0: n1) final= within(dat, flag=as.numeric( x1/m1y1/n1) ) This may be one of those instances where = is not an acceptable replacement for -. I get an error with that code whereas I get the desired result with: final= within(dat, flag - as.numeric( x1/m1y1/n1) ) -- David. head(final1) # m1 n1 x1 y1 flag #1 4 4 0 00 #2 4 4 0 10 #3 4 4 0 20 #4 4 4 0 30 #5 4 4 0 40 #6 4 4 1 01 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multiple plots and looping assistance requested (single plot)
HI Irucka, Please check this: temp- structure(list(`:Bostoncitydata` = structure(list(Month = c(1L, 2L, 3L, NA), Data1 = c(1.5, 12.3, 11.4, NA), Data2 = c(9.1342, 12.31, 3.5, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -4L)), `:Chicagocitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, NA), Data1 = c(1.52, 12.63, 20.34, 12.83, 3.34, NA ), Data2 = c(19.41342, 13.031, 0.80021, 12.63104, 19.20021, NA )), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -6L)), `:NewYorkcitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, NA), Data1 = c(NA, NA, NA, NA, NA, NA, NA, NA), Data2 = c(3.1342, 1.31, 13.5, 1.31, 2.40021, 0.25, 26.3, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -8L)), `:Philadelphiacitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, NA), Data1 = c(1.65, 11.63, 5.0434, 13.73, 3.0234, 34.209, NA), Data2 = c(2.61342, 16.331, 19.040021, 17.831, 10.1010021, 3.80742, NA)), .Names = c(Month, Data1, Data2 ), class = data.frame, row.names = c(NA, -7L)), `:Atlantacitydata` = structure(list( Month = c(1L, 2L, 3L, NA), Data1 = c(NA, NA, NA, NA), Data2 = c(NA, NA, NA, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -4L)), `:Baltimorecitydata` = structure(list(Month = 1:2, Data1 = c(11.325, 32.433), Data2 = c(49.71342, 52.4031)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -2L))), .Names = c(:Bostoncitydata, :Chicagocitydata, :NewYorkcitydata, :Philadelphiacitydata, :Atlantacitydata, :Baltimorecitydata)) temp1-lapply(temp,function(x) {x1-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) x1[complete.cases(x1),] else x1[complete.cases(x1)] }) # temp1-lapply(temp1,function(x) x[is.data.frame(x)]) #3 columns subset temp3-temp1[lapply(temp1,length)==3] temp3New-temp3[sapply(temp3,is.data.frame)] pdf(Irucka.pdf) lapply(names(temp3New),function(i) {x-temp3New[[i]]; matplot(x[,1],x[,-1],type=n,lty=1,sub=i,main=Seasonal Flux Sum, xlab=Calendar Year Timesteps,ylab=Total Flux (kg/season)); matlines(x[,1],x[,-1],type=l,lty=1:2,lwd=1,col=1:2)}) dev.off() A.K. From: Irucka Embry iruc...@mail2world.com To: smartpink...@yahoo.com Sent: Friday, March 29, 2013 5:41 PM Subject: Re: [R] multiple plots and looping assistance requested (single plot) Hi Arun, I'm sorry about the data not being read correctly. OK, thank you so much! Irucka -Original Message- From: arun [smartpink...@yahoo.com] Sent: 3/29/2013 3:36:21 PM To: iruc...@mail2world.com Subject: Re: [R] multiple plots and looping assistance requested (single plot) HI Irucka, No problem. Thanks for the dput(data), but it seems like the data is not read correctly. It still has comma as separator. str(temp) List of 5 $ 02143500,,:'data.frame':17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,,4202.7437226,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02169000,,:'data.frame':17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,,227675.73764,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02169500,,:'data.frame':17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,,414312.49534,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02169570,,:'data.frame':17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,2897.79043403356,5155.6776796,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02172300,,:'data.frame':12 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 12 levels 2001.875,,899.46439731,..: 1 2 3 4 5 6 7 8 9 10 ... I actually found the dataset containing Bostoncitydata, etc.. I will work on that. From: Irucka Embry iruc...@mail2world.com To: smartpink...@yahoo.com Sent: Friday, March 29, 2013 1:35 PM Subject: Re: [R] multiple plots and looping assistance requested (single plot) Hi Arun, that is fine. I want to thank you in advance for your assistance. Irucka -Original Message- From: arun [smartpink...@yahoo.com] Sent: 3/29/2013 10:02:35 AM To: iruc...@mail2world.com Subject: Re: [R] multiple plots and looping assistance requested (single plot) Will look into it later. From: Irucka Embry iruc...@mail2world.com To: smartpink...@yahoo.com Sent: Friday, March 29, 2013 11:02 AM Subject: Re: [R] multiple plots and looping assistance requested (single plot) Hi Arun, how are you? Thank you for the response. Yes, I would like to have the xy scatter plot with connecting lines for both columns to be in the same plot window. I'm sorry that I forgot the data, but it is included below. dput(temp) structure(list(`02143500,,` = structure(list(CYEAR_Decimal.load_00600_W.load_00600_F = structure(c(2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 1L),
Re: [R] multiple plots and looping assistance requested (single plot)
Hi Arun, thank you very much. That code worked perfectly. Below is the full version of the code with the addition of a legend. Irucka rm(list=ls()) source(read.funkyfile.R) temp = read.funkyfile(seasonalFluxComparisonDataSet.csv, station_id, header=TRUE, sep=\t) temp1-lapply(temp,function(x) {x1-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) x1[complete.cases(x1),] else x1[complete.cases(x1)] }) # temp1-lapply(temp1,function(x) x[is.data.frame(x)]) #3 columns subset temp3-temp1[lapply(temp1,length)==3] temp3New-temp3[sapply(temp3,is.data.frame)] pdf(Calibration_Results/Nitrogen/Graphics/seasonalFluxComparisonDataSet full.pdf) lapply(names(temp3New),function(i) {x-temp3New[[i]]; matplot(x[,1],x[,-1],type=n,lty=1,sub=i,main=Seasonal Flux Sum, xlab=Calendar Year Timesteps,ylab=Total Flux (kg/season)); matlines(x[,1],x[,-1],type=l,lty=1:2,lwd=1,col=1:2); legend(topright, inset=.05, title=Seasonal Flux Methods, lty=c(1,1), col= c(black, red), c(EGRET/WRTDS,Fluxmaster), horiz=TRUE)}) dev.off() #2 columns subset temp2-temp1[lapply(temp1,length)==2] temp2New-lapply(temp2,function(x) lapply(names(x)[-1], function(i) {x1-cbind(x[,1],x[,i]);colnames(x1)- c(Month,i);x1} )) pdf(Calibration_Results/Nitrogen/Graphics/seasonalFluxComparisonDataSet partial.pdf) par(mfrow=c(1,1)) lapply(names(temp2New),function(i) lapply(temp2New[[i]],function(x) {plot(x[,1],x[,2],main=Seasonal Flux Sum,sub=paste(i,colnames(x)[2],sep= ),xlab=Calendar Year Timesteps,ylab=Total Flux (kg/season));lines(x[,1],x[,2])})) dev.off() -Original Message- From: arun [smartpink...@yahoo.com] Sent: 3/29/2013 4:47:57 PM To: iruc...@mail2world.com Cc: r-help@r-project.org Subject: Re: [R] multiple plots and looping assistance requested (single plot) HI Irucka, Please check this: temp- structure(list(`:Bostoncitydata` = structure(list(Month = c(1L, 2L, 3L, NA), Data1 = c(1.5, 12.3, 11.4, NA), Data2 = c(9.1342, 12.31, 3.5, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -4L)), `:Chicagocitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, NA), Data1 = c(1.52, 12.63, 20.34, 12.83, 3.34, NA ), Data2 = c(19.41342, 13.031, 0.80021, 12.63104, 19.20021, NA )), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -6L)), `:NewYorkcitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, NA), Data1 = c(NA, NA, NA, NA, NA, NA, NA, NA), Data2 = c(3.1342, 1.31, 13.5, 1.31, 2.40021, 0.25, 26.3, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -8L)), `:Philadelphiacitydata` = structure(list(Month = c(1L, 2L, 3L, 4L, 5L, 6L, NA), Data1 = c(1.65, 11.63, 5.0434, 13.73, 3.0234, 34.209, NA), Data2 = c(2.61342, 16.331, 19.040021, 17.831, 10.1010021, 3.80742, NA)), .Names = c(Month, Data1, Data2 ), class = data.frame, row.names = c(NA, -7L)), `:Atlantacitydata` = structure(list( Month = c(1L, 2L, 3L, NA), Data1 = c(NA, NA, NA, NA), Data2 = c(NA, NA, NA, NA)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -4L)), `:Baltimorecitydata` = structure(list(Month = 1:2, Data1 = c(11.325, 32.433), Data2 = c(49.71342, 52.4031)), .Names = c(Month, Data1, Data2), class = data.frame, row.names = c(NA, -2L))), .Names = c(:Bostoncitydata, :Chicagocitydata, :NewYorkcitydata, :Philadelphiacitydata, :Atlantacitydata, :Baltimorecitydata)) temp1-lapply(temp,function(x) {x1-x[,colSums(is.na(x))!=nrow(x)]; if(is.data.frame(x1)) x1[complete.cases(x1),] else x1[complete.cases(x1)] }) # temp1-lapply(temp1,function(x) x[is.data.frame(x)]) #3 columns subset temp3-temp1[lapply(temp1,length)==3] temp3New-temp3[sapply(temp3,is.data.frame)] pdf(Irucka.pdf) lapply(names(temp3New),function(i) {x-temp3New[[i]]; matplot(x[,1],x[,- 1],type=n,lty=1,sub=i,main=Seasonal Flux Sum, xlab=Calendar Year Timesteps,ylab=Total Flux (kg/season)); matlines(x[,1],x[,-1],type=l,lty=1:2,lwd=1,col=1:2)}) dev.off() A.K. From: Irucka Embry iruc...@mail2world.com To: smartpink...@yahoo.com Sent: Friday, March 29, 2013 5:41 PM Subject: Re: [R] multiple plots and looping assistance requested (single plot) Hi Arun, I'm sorry about the data not being read correctly. OK, thank you so much! Irucka -Original Message- From: arun [smartpink...@yahoo.com] Sent: 3/29/2013 3:36:21 PM To: iruc...@mail2world.com Subject: Re: [R] multiple plots and looping assistance requested (single plot) HI Irucka, No problem. Thanks for the dput(data), but it seems like the data is not read correctly. It still has comma as separator. str(temp) List of 5 $ 02143500,,:'data.frame': 17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,,4202.7437226,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02169000,,:'data.frame': 17 obs. of 1 variable: ..$ CYEAR_Decimal.load_00600_W.load_00600_F: Factor w/ 17 levels ,,,2000.875,,227675.73764,..: 2 3 4 5 6 7 8 9 10 11 ... $ 02169500,,:'data.frame': 17 obs. of 1 variable: ..$
Re: [R] Error message in dredge function (MuMIn package) used with binary GLM
'rank' should be QAICc. AICc does not have argument 'chat', hence the error. kamil CatCowie wrote Hi all, I'm having trouble with the model generating 'dredge' function in the MuMIn 'Multi-model Inference' package. Here's the script: globalmodel- glm(TB~lat+protocol+tested+ streams+goats+hay+cattle+deer, family=binomial) chat- deviance(globalmodel)/59 #There we 59 residual degrees of freedom in this global model. models- dredge(globalmodel, beta=FALSE, evaluate=TRUE, rank=AICc, chat=chat, fixed=NULL, trace=FALSE) And the error message is: Error in UseMethod(logLik) : no applicable method for 'logLik' applied to an object of class logical I have trawled the literature and it seems to be ok to use a binary GLM as the global model - could this be the problem? The variables are a mix of binary and continuous data. Any thoughts? Thanks, Cat -- View this message in context: http://r.789695.n4.nabble.com/Error-message-in-dredge-function-MuMIn-package-used-with-binary-GLM-tp4662842p4662881.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] hierarchical clustering with pearson's coefficient
Anyone for that question? 2013/3/28 Pierre Antoine DuBoDeNa pad...@gmail.com Hello, I want to use pearson's correlation as distance between observations and then use any centroid based linkage distance (ex. Ward's distance) When linkage distances are formed as the Lance-Williams recursive formulation, they just require the initial distance between observations. See here: http://en.wikipedia.org/wiki/Ward%27s_method It is said that you have to use euclidean distance between the initial observations. However i have found this: http://research.stowers-institute.org/efg/R/Visualization/cor-cluster/ where they use pearson's correlation for hierarchical clustering. Any idea if anything is violated in case pearson's correlation is used with Ward's linkage function? the dissimilarity of pearson's correlation can be defined as d = sqrt(1-pearsonsimilarity^2). can that be considered as norm1 distance? and thus norm2 if we square it? so that the wikipedia's statement To apply a recursive algorithm under this objective function, the initial distance between individual objects must be (proportional to) squared Euclidean distance. is valid? Best, Pierre [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] if clause in data frame
HI, I am not sure I understand it correctly. Should this (m1*x1/m1) +n1*y1/n1) /(m1+n1) be (x1+y1)/(m1+n1)? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) colnames(final)- c(m1,n1,x1,y1) final1- within(final,{flag- as.numeric((x1/m1)(y1/n1));p11-ifelse(flag==1, (x1+y1)/(m1+n1),x1/m1);p12- ifelse(flag==1,(x1+y1)/(m1+n1),y1/n1)}) If you meant four new variables p11, p12, P11, P12, then: finalNew-within(final,{flag- as.numeric((x1/m1)(y1/n1))}) lst1-lapply(split(finalNew,finalNew$flag),function(x) {xNew-x;if(all(xNew$flag==0)) within(xNew,{P11-x1/m1;P12- y1/n1}) else within(xNew,{p11- (x1+y1)/(m1+n1); p12- p11})}) library(plyr) join_all(lst1,type=full) head(join_all(lst1,type=full)) # m1 n1 x1 y1 flag P12 P11 p12 p11 #1 4 4 0 0 0 0.00 0.00 NA NA #2 4 4 0 1 0 0.25 0.00 NA NA #3 4 4 0 2 0 0.50 0.00 NA NA #4 4 4 0 3 0 0.75 0.00 NA NA #5 4 4 0 4 0 1.00 0.00 NA NA #6 4 4 1 1 0 0.25 0.25 NA NA A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 2:58 PM Subject: Re: if clause in data frame thanks! What if I need to put more statement in if and else braces, like if ((x1/m1) (y1/n1)) { p11-(m1*x1/m1 + n1*y1/n1)/(m1+n1) p12-p11 } else { P11- x1/m1 P12- y1/n1 } On Fri, Mar 29, 2013 at 12:47 PM, arun smartpink...@yahoo.com wrote: Hi, final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { final- rbind(final,c(m1,n1,x1,y1)) res final1-within(final,{flag-ifelse(x1/m1y1/n1, 1,0)}) head(final1) # m1 n1 x1 y1 flag #1 4 4 0 0 0 #2 4 4 0 1 0 #3 4 4 0 2 0 #4 4 4 0 3 0 #5 4 4 0 4 0 #6 4 4 1 0 1 Also, just by looking at your code, you have flag and flap. A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Friday, March 29, 2013 10:56 AM Subject: if clause in data frame Why the if clause code not working here? final-data.frame() for (m1 in 4:10) { for (n1 in 4:10){ for (x1 in 0: m1) { for (y1 in 0: n1) { if (x1/m1y1/n1) { flag-1} else {flap-0} final-rbind(final, c(m1,n1,flag, x1,y1)) }} }} colnames(final)-c(m1,n1,flag,x1,y1) final __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] hierarchical clustering with pearson's coefficient
I am not sure about your question but i did find this: http://research.med.helsinki.fi/corefacilities/proteinchem/hierarchical_clustering_basics.pdf it seems to address all three topics so perhaps the answer is in there?? On Mar 28, 2013, at 6:16 PM, Pierre Antoine DuBoDeNa wrote: Hello, I want to use pearson's correlation as distance between observations and then use any centroid based linkage distance (ex. Ward's distance) When linkage distances are formed as the Lance-Williams recursive formulation, they just require the initial distance between observations. See here: http://en.wikipedia.org/wiki/Ward%27s_method It is said that you have to use euclidean distance between the initial observations. However i have found this: http://research.stowers-institute.org/efg/R/Visualization/cor-cluster/ where they use pearson's correlation for hierarchical clustering. Any idea if anything is violated in case pearson's correlation is used with Ward's linkage function? the dissimilarity of pearson's correlation can be defined as d = sqrt(1-pearsonsimilarity^2). can that be considered as norm1 distance? and thus norm2 if we square it? so that the wikipedia's statement To apply a recursive algorithm under this objective function, the initial distance between individual objects must be (proportional to) squared Euclidean distance. is valid? Best, Pierre [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.