Re: [R] a question about 'read.table' with or without 'read.table'.(urgent)
Great! Thank you -- View this message in context: http://r.789695.n4.nabble.com/a-question-about-read-table-with-or-without-read-table-urgent-tp2314423p2314450.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] Finding the right url for RCurl
Hi all, I am using RCurl to try and download data from a website, but I'm having trouble finding out what URL to use. Here is the site: http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX See how in the upper right, above the displayed sheet, there's a link to download the data as a .csv file? When I hit copy url and paste into getURL in R, it doesn't work. That's no surprise because there isn't a URL in what gets pasted. I was just wondering if there's any way around this. Thanks in advance, Andrew -- View this message in context: http://r.789695.n4.nabble.com/Finding-the-right-url-for-RCurl-tp2314163p2314163.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] questions about string handling
Hi, I have a question about the data handling. I have a dataset as following: ID snp1snp2 snp3 1001 0/0 1/11/1 1002 2/2 3/31/1 1003 4/4 3/32/2 I want to convert the dataset to the following format: IDsnp1 snp2 snp3 1001 00AA AA 1002 GGCCAA 1003 TTCCGG thing to be done: 1) take the '/' off 2) replace the numbers with letters, 0 not change. 1=A, 2=G, 3=C, 4=T what is the most efficient way to do it? thanks you very much, karena -- View this message in context: http://r.789695.n4.nabble.com/questions-about-string-handling-tp2314335p2314335.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] error with ReadAffy()
I don't know if it has anything to do with these installation warnings: * installing to library ‘/home/mandova/R/i486-pc-linux-gnu-library/2.11’ * installing *source* package ‘affy’ ... creating cache ./config.cache checking how to run the C preprocessor... cc -E checking for main in -lz... yes checking for zlib.h... yes checking if zlib version = 1.1.3... yes updating cache ./config.cache creating ./config.status creating src/Makevars ** libs gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c chipbackground.c -o chipbackground.o gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c getall_locations.c -o getall_locations.o gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c mas5calls.c -o mas5calls.o gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c qnorm.c -o qnorm.o gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c rma2.c -o rma2.o rma2.c: In function ‘rma_c_call’: rma2.c:499: warning: assignment discards qualifiers from pointer target type gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c rma_background2.c -o rma_background2.o gcc -std=gnu99 -I/usr/share/R/include -DHAVE_ZLIB=1 -fpic -g -O2 -c rma_common.c -o rma_common.o gcc -std=gnu99 -shared -o affy.so chipbackground.o getall_locations.o mas5calls.o qnorm.o rma2.o rma_background2.o rma_common.o -lz -L/usr/lib/R/lib -lR installing to /home/mandova/R/i486-pc-linux-gnu-library/2.11/affy/libs ** R ** data ** demo ** inst Warning: field 'SaveImage' is defunct: please remove it ** preparing package for lazy loading Welcome to Bioconductor Vignettes contain introductory material. To view, type 'openVignette()'. To cite Bioconductor, see 'citation(Biobase)' and for packages 'citation(pkgname)'. Creating a new generic function for open in affy Creating a new generic function for update in affy Creating a new generic function for close in affy ** help Warning: ./man/AffyBatch-class.Rd:121: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:124: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:127: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:131: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:133: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:135: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:137: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:151: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:153: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:155: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:157: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:159: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:161: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:162: unknown macro '\item' Warning: ./man/AffyBatch-class.Rd:164: unknown macro '\item' Warning: ./man/ProbeSet-class.Rd:17: unexpected '}' Warning: ./man/SpikeIn.Rd:17: unknown macro '\it' Warning: ./man/SpikeIn.Rd:18: unknown macro '\it' Warning: ./man/SpikeIn.Rd:20: unknown macro '\it' Warning: ./man/SpikeIn.Rd:24: unknown macro '\mu' Warning: ./man/affy-options.Rd:10: unknown macro '\begin' Warning: ./man/affy-options.Rd:11: unknown macro '\item' Warning: ./man/affy-options.Rd:13: unknown macro '\item' Warning: ./man/affy-options.Rd:14: unknown macro '\item' Warning: ./man/affy-options.Rd:15: unknown macro '\item' Warning: ./man/affy-options.Rd:16: unknown macro '\it' Warning: ./man/affy-options.Rd:16: unknown macro '\it' Warning: ./man/affy-options.Rd:19: unknown macro '\it' Warning: ./man/affy-options.Rd:19: unknown macro '\it' Warning: ./man/affy-options.Rd:20: unknown macro '\it' Warning: ./man/affy-options.Rd:21: unknown macro '\it' Warning: ./man/affy-options.Rd:21: unknown macro '\it' Warning: ./man/affy-options.Rd:21: unknown macro '\it' Warning: ./man/affy-options.Rd:21: unknown macro '\it' Warning: ./man/affy-options.Rd:22: unknown macro '\it' Warning: ./man/affy-options.Rd:23: unknown macro '\begin' Warning: ./man/affy-options.Rd:24: unknown macro '\item' Warning: ./man/affy-options.Rd:24: unknown macro '\it' Warning: ./man/affy-options.Rd:26: unknown macro '\item' Warning: ./man/affy-options.Rd:26: unknown macro '\it' Warning: ./man/affy-options.Rd:29: unknown macro '\item' Warning: ./man/affy-options.Rd:29: unknown macro '\it' Warning: ./man/affy-options.Rd:31: unknown macro '\end' Warning: ./man/affy-options.Rd:32: unknown macro '\end' Warning: ./man/bgc.Rd:33: unknown macro '\begin' Warning: ./man/bgc.Rd:34: unknown macro '\item' Warning: ./man/bgc.Rd:35: unknown macro '\item' Warning: ./man/bgc.Rd:37: unknown macro '\item' Warning: ./man/bgc.Rd:39: unknown macro '\end' Warning: ./man/fit.li.wong.Rd:8: unexpected '}' Warning: ./man/generateExprVal.method.playerout.Rd:31: unknown macro '\item' Warning: ./man/maffy.normalise.Rd:22: unexpected '}' Warning: ./man/maffy.subset.Rd:20: unexpected '}' Warning: ./man/maffy.subset.Rd:25:
[R] a question about 'read.table' with or without 'read.table'.(urgent)
Hi, I've got a quite tricky question. I have a txt file, named 'temp.txt', as the following: snp1snp2snp3 AA 00 00 GG GG 00 00 AA 00 I want to read the file into R. 1) when I use 'read.table' without 'header=T' option, temp - read.table('temp.txt') # I got temp V1 V2 V3 1 snp1 snp2 snp3 2 AA 00 00 3 GG GG 00 4 00 AA 00 2) If I include the 'header=T' option, temp - read.table('temp.txt', header=T, as.is=T) # I got temp snp1 snp2 snp3 1 AA 000 2 GG GG0 3 00 AA0 The difference is for 'snp3', we can see, in 1) the values for snp3 are all '00', while in 2) the values are all '0'. How can I keep the original values for snp3 as '00', meanwhile get the 'headers' or say the colnames as 'snp1snp2snp3'? thank you very much, karena -- View this message in context: http://r.789695.n4.nabble.com/a-question-about-read-table-with-or-without-read-table-urgent-tp2314423p2314423.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] questions about string handling
Tena koe Karena See ?sub and ?gsub HTH ... Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of karena Sent: Thursday, 5 August 2010 12:56 p.m. To: r-help@r-project.org Subject: [R] questions about string handling Hi, I have a question about the data handling. I have a dataset as following: ID snp1snp2 snp3 1001 0/0 1/11/1 1002 2/2 3/31/1 1003 4/4 3/32/2 I want to convert the dataset to the following format: IDsnp1 snp2 snp3 1001 00AA AA 1002 GGCCAA 1003 TTCCGG thing to be done: 1) take the '/' off 2) replace the numbers with letters, 0 not change. 1=A, 2=G, 3=C, 4=T what is the most efficient way to do it? thanks you very much, karena -- View this message in context: http://r.789695.n4.nabble.com/questions- about-string-handling-tp2314335p2314335.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] split / lapply over multiple columns
Ralf B wrote: Besides beauty, is there an actual advantage in terms of run-time and/or memory use? If you look at the actual definition of tapply, I'm sure you realize that the answer is no: ans - lapply(split(X, group), FUN, ...) inbetween 40-odd lines of red tape is something of a giveaway... -- Peter Dalgaard Center for Statistics, Copenhagen Business School 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] questions about string handling
How about this (df is your input data.frame) data.frame(ID=df[,1], apply(df[,2:4], 2, function(x) c(00, AA, GG, CC, TT)[match(x, c(0/0, 1/1, 2/2, 3/3, 4/4))])) Michael On 5 August 2010 10:55, karena dr.jz...@gmail.com wrote: Hi, I have a question about the data handling. I have a dataset as following: ID snp1 snp2 snp3 1001 0/0 1/1 1/1 1002 2/2 3/3 1/1 1003 4/4 3/3 2/2 I want to convert the dataset to the following format: ID snp1 snp2 snp3 1001 00 AA AA 1002 GG CC AA 1003 TT CC GG thing to be done: 1) take the '/' off 2) replace the numbers with letters, 0 not change. 1=A, 2=G, 3=C, 4=T what is the most efficient way to do it? thanks you very much, karena -- View this message in context: http://r.789695.n4.nabble.com/questions-about-string-handling-tp2314335p2314335.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.
[R] PageUp/Down in gnome-terminal
Dear all, I am using gnome-terminal to run R, and I noticed that standard PageUp/Down do not work but they do work for other programs within the same terminal window (e.g. irssi). Scroll bar does not work either. I run R using GNU-screen, but it doesn't seem to make any difference. Many thanks Olga -- R version 2.11.1 (2010-05-31) 2010 x86_64 GNU/Linux Ubuntu 10.04.1 LTS __ 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] applying strsplit to a whole column
Hi r-help-boun...@r-project.org napsal dne 04.08.2010 21:03:10: I am sorry, someone said that strsplit automatically works on a column. How exactly does it work? For example, if I want to grab just the first (or the second) part of the string in nam1 that should be split based on .. x-data.frame(nam1=c(bbb..aba,ccc..abb,ddd..abc,eee..abd), stringsAsFactors=FALSE) str(x) strsplit(x[[1]],split=\\..) str(strsplit(x[[1]],split=\\..)) I am getting a list - hence, it looks like I have to go in a loop...? Not necessarily, e.g. sapply(strsplit(as.vector(x[,1]),split=\\..), unlist) Regards Petr Thank you! Dimitri On Wed, Aug 4, 2010 at 2:39 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Thank you very much, everyone! Dimitri On Wed, Aug 4, 2010 at 2:10 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 1:42 PM, Dimitri Liakhovitski wrote: I am sorry, I'd like to split my column (names) such that all the beginning of a string (X..) is gone and only the rest of the text is left. I could not tell whether it was the string X.. or the pattern X.. that was your goal for matching and removal. x-data.frame(names=c(X..aba,X..abb,X..abc,X..abd)) x$names-as.character(x$names) a) Instead of names which is heavily used function name, use something more specific. Otherwise you get: names(x) names # and thereby avoid list comments about canines. b) Instead of coercing a character vector back to a character vector, use stringsAsFactors = FALSE. x-data.frame(nam1=c(X..aba,X..abb,X..abc,X..abd), stringsAsFactors=FALSE) #Thus is the pattern version: x$nam1 - gsub(X..,'', x$nam1) x nam1 1 aba 2 abb 3 abc 4 abd This is the string version: x-data.frame(nam1=c(X..aba,X.y.abb,X..abc,X..abd), stringsAsFactors=FALSE) x$nam1 - gsub(X\\.+,'', x$nam1) x nam1 1 aba 2 y.abb 3 abc 4 abd (x) str(x) Can't figure out how to apply strsplit in this situation - without using a loop. I hope it's possible to do it without a loop - is it? -- David Winsemius, MD West Hartford, CT -- Dimitri Liakhovitski Ninah Consulting www.ninah.com -- Dimitri Liakhovitski Ninah Consulting www.ninah.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.
[R] Error: cannot allocate vector of size xxx Mb
I am dealing with very large data frames, artificially created with the following code, that are combined using rbind. a - rnorm(500) b - rnorm(500) c - rnorm(500) d - rnorm(500) first - data.frame(one=a, two=b, three=c, four=d) second - data.frame(one=d, two=c, three=b, four=a) rbind(first, second) which results in the following error for each of the statements: a - rnorm(500) Error: cannot allocate vector of size 38.1 Mb b - rnorm(500) Error: cannot allocate vector of size 38.1 Mb c - rnorm(500) Error: cannot allocate vector of size 38.1 Mb d - rnorm(500) Error: cannot allocate vector of size 38.1 Mb first - data.frame(one=a, two=b, three=c, four=d) Error: cannot allocate vector of size 38.1 Mb second - data.frame(one=d, two=c, three=b, four=a) Error: cannot allocate vector of size 38.1 Mb rbind(first, second) When running memory.limit() I am getting this: memory.limit() [1] 2047 Which shows me that I have 2 GB of memory available. What is wrong? Shouldn't 38 MB be very feasible? Best, Ralf __ 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] offlist comment Re: KS Test question (2)
This is unbelievable. Now people like yourself start doing background searches on one and accusing one of not being professional plus posting cheeky R code. The reason why I submitted the questions I have submitted was that these answers did not satisfy my particular problem (or perhaps I mistakenly thought so). The point here is that the forum should be a forum where one should be allowed to ask questions without first studying the history of the the entire forum in fear that someone might have asked it before. I was hoping that I could find clearer answers then what I was able to read. I do know how to search in Google. But I am not an expert in statistics, as you already found in your background check. If I would be fluent in stastitsics and R and if past answers would have exactly satisfied my problem I would not post here and I certainly would not have occupied your expensive attention. On Wed, Aug 4, 2010 at 6:16 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 5:49 PM, Ralf B wrote: Hi R Users, I have two vectors, x and y, of equal length representing two types of data from two studies. I would like to test if they are similar enough to use them interchangeably. No assumptions about distributions can be made (initial tests clearly show that they are not normal). Here some result: Two-sample Kolmogorov-Smirnov test data: x and y D = 0.1091, p-value 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(x[1:nx], y[1:nx], exact = FALSE) : cannot compute correct p-values with ties Here some questions: a) What does the error message means and what does it imply? b) The data is very noisy and the initial result shows that there is no relation between x and y. Is there a way to calculate and effect size? c) Can the p-value be used, when running tests over a large amount of different data sets, as a metric for ranking similarity between x and y data sets? There has been quite a bit of discussion on this list over the years about why KS test is not good in this situation. If I read the results of a search on your name correctly, you are in a department of Information Sciences. I would have thought that the first reaction of someone in that field would be do do a search on a question. Why are you filling up the archives with questions that have been repeatedly asked and answered? Do you need help in this area? rhelpSearch - function(string, restrict = c(Rhelp10, Rhelp08, Rhelp02, functions ), matchesPerPage = 100, ...) RSiteSearch(string=string, restrict = restrict, matchesPerPage = matchesPerPage, ...) rhelpSearch(KS.test ties p-value) Best R. __ 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. David Winsemius, MD West Hartford, CT __ 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] Error: cannot allocate vector of size xxx Mb
On Thu, Aug 05, 2010 at 03:53:21AM -0400, Ralf B wrote: a - rnorm(500) Error: cannot allocate vector of size 38.1 Mb When running memory.limit() I am getting this: memory.limit() [1] 2047 Which shows me that I have 2 GB of memory available. What is wrong? Shouldn't 38 MB be very feasible? From what I gather fomr ?memory.limit it does not tell you how much memory it currently available. So my guess is that you have som rather large objects in your workspace already and thus there is not enough space left for you vectors. cu Philipp -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihenstephan Maximus-von-Imhof-Forum 3 85354 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/ __ 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] Odp: Error: cannot allocate vector of size xxx Mb
Hi r-help-boun...@r-project.org napsal dne 05.08.2010 09:53:21: I am dealing with very large data frames, artificially created with the following code, that are combined using rbind. a - rnorm(500) b - rnorm(500) c - rnorm(500) d - rnorm(500) first - data.frame(one=a, two=b, three=c, four=d) second - data.frame(one=d, two=c, three=b, four=a) Up to this point there is no error on my system version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Under development (unstable) major 2 minor 12.0 year 2010 month 05 day31 svn rev52164 language R version.string R version 2.12.0 Under development (unstable) (2010-05-31 r52164) sessionInfo() R version 2.12.0 Under development (unstable) (2010-05-31 r52164) Platform: i386-pc-mingw32/i386 (32-bit) attached base packages: [1] stats grDevices datasets utils graphics methods base other attached packages: [1] lattice_0.18-8 fun_1.0 loaded via a namespace (and not attached): [1] grid_2.12.0 tools_2.12.0 rbind(first, second) Although size of first and second is only roughly 160 MB their concatenation probably consumes all remaining memory space as you already have a-d first and second in memory. Regards Petr which results in the following error for each of the statements: a - rnorm(500) Error: cannot allocate vector of size 38.1 Mb b - rnorm(500) Error: cannot allocate vector of size 38.1 Mb c - rnorm(500) Error: cannot allocate vector of size 38.1 Mb d - rnorm(500) Error: cannot allocate vector of size 38.1 Mb first - data.frame(one=a, two=b, three=c, four=d) Error: cannot allocate vector of size 38.1 Mb second - data.frame(one=d, two=c, three=b, four=a) Error: cannot allocate vector of size 38.1 Mb rbind(first, second) When running memory.limit() I am getting this: memory.limit() [1] 2047 Which shows me that I have 2 GB of memory available. What is wrong? Shouldn't 38 MB be very feasible? Best, Ralf __ 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] offlist comment Re: KS Test question (2)
Just my $0.02... There have been a number of postings and questions on the list in the last couple of weeks (that is, there seems to be a larger percentage of such mail than usual...). Maybe a happy monthly reminder could be sent out with the posting guide? And maybe there could be something like Write a sentence on where you've searched for answers so that responses such as the one below may be avoided. I don't post a lot, as I prefer replying offlist and don't really have any specific questions, but it seems that there is an increasing amount of posts where newbie hasn't read the posting guides or someone's homework needs to be done (forgive me if I'm mistaken, but I thought this list didn't do kids' homework?). Anyhows, not meant to annoy, just a couple of thoughts. Siri. Siterer Ralf B ralf.bie...@gmail.com: This is unbelievable. Now people like yourself start doing background searches on one and accusing one of not being professional plus posting cheeky R code. The reason why I submitted the questions I have submitted was that these answers did not satisfy my particular problem (or perhaps I mistakenly thought so). The point here is that the forum should be a forum where one should be allowed to ask questions without first studying the history of the the entire forum in fear that someone might have asked it before. I was hoping that I could find clearer answers then what I was able to read. I do know how to search in Google. But I am not an expert in statistics, as you already found in your background check. If I would be fluent in stastitsics and R and if past answers would have exactly satisfied my problem I would not post here and I certainly would not have occupied your expensive attention. On Wed, Aug 4, 2010 at 6:16 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 5:49 PM, Ralf B wrote: Hi R Users, I have two vectors, x and y, of equal length representing two types of data from two studies. I would like to test if they are similar enough to use them interchangeably. No assumptions about distributions can be made (initial tests clearly show that they are not normal). Here some result: Two-sample Kolmogorov-Smirnov test data: x and y D = 0.1091, p-value 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(x[1:nx], y[1:nx], exact = FALSE) : cannot compute correct p-values with ties Here some questions: a) What does the error message means and what does it imply? b) The data is very noisy and the initial result shows that there is no relation between x and y. Is there a way to calculate and effect size? c) Can the p-value be used, when running tests over a large amount of different data sets, as a metric for ranking similarity between x and y data sets? There has been quite a bit of discussion on this list over the years about why KS test is not good in this situation. If I read the results of a search on your name correctly, you are in a department of Information Sciences. I would have thought that the first reaction of someone in that field would be do do a search on a question. Why are you filling up the archives with questions that have been repeatedly asked and answered? Do you need help in this area? rhelpSearch - function(string, restrict = c(Rhelp10, Rhelp08, Rhelp02, functions ), matchesPerPage = 100, ...) RSiteSearch(string=string, restrict = restrict, matchesPerPage = matchesPerPage, ...) rhelpSearch(KS.test ties p-value) Best R. __ 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. David Winsemius, MD West Hartford, CT __ 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] PageUp/Down in gnome-terminal
On Thu, 05 Aug 2010 08:56:30 +0200 Olga Lyashevska o...@herenstraat.nl wrote: I am using gnome-terminal to run R, and I noticed that standard PageUp/Down do not work but they do work for other programs within the same terminal window (e.g. irssi). Scroll bar does not work either. Try shift+pageup/pagedown. If this fails, try a different gtk terminal such as xfce4-terminal. Liviu __ 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] PageUp/Down in gnome-terminal
Thanks Liviu, On Thu, 2010-08-05 at 09:51 +0100, Liviu Andronic wrote: On Thu, 05 Aug 2010 08:56:30 +0200 Olga Lyashevska o...@herenstraat.nl wrote: I am using gnome-terminal to run R, and I noticed that standard PageUp/Down do not work but they do work for other programs within the same terminal window (e.g. irssi). Scroll bar does not work either. Try shift+pageup/pagedown. If this fails, try a different gtk terminal such as xfce4-terminal. Liviu shift+pagep/pagedown doesnt work either. xfce is a desktop environment similar to gnome or kde, right? I do not have any desktop environment (running R on a server), can I still try xfce? Thanks Olga __ 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] Error: cannot allocate vector of size xxx Mb
Thank you for such a careful and thorough analysis of the problem and your comparison with your configuration. I very much appreciate. For completeness and (perhaps) further comparison, I have executed 'version' and sessionInfo() as well: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status RC major 2 minor 10.0 year 2009 month 10 day25 svn rev50206 language R version.string R version 2.10.0 RC (2009-10-25 r50206) sessionInfo() R version 2.10.0 RC (2009-10-25 r50206) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] splines stats4grid stats graphics grDevices utils [8] datasets methods base other attached packages: [1] flexmix_2.2-7 multcomp_1.1-7survival_2.35-8 mvtnorm_0.9-9 [5] modeltools_0.2-16 lattice_0.18-3car_1.2-16psych_1.0-88 [9] nortest_1.0 gplots_2.8.0 caTools_1.10 bitops_1.0-4.1 [13] gdata_2.8.0 gtools_2.6.2 ggplot2_0.8.7 digest_0.4.2 [17] reshape_0.8.3 plyr_0.1.9proto_0.3-8 RJDBC_0.1-5 [21] rJava_0.8-2 DBI_0.2-5 loaded via a namespace (and not attached): [1] tools_2.10.0 memory.limit() [1] 2047 Also, the example i presented was a simplified reproduction of the real data structure. My real data structure does not have reused vectors. I merely wanted to show the error occurring when processing large vectors into data frames and then binding these data frames together. I hope this additional information helps. I might add that I am running this in StatET under Eclipse with 512 MB of allocated RAM in the environment. Besides adding more memory, can you spot simple ways of how memory use can be improved? I know that I am running quite a bit of baggage. Unfortunately my script is rather comprehensive and my example is really just a simplified part that I created to reproduce the problem. Thanks, Ralf On Thu, Aug 5, 2010 at 4:44 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 05.08.2010 09:53:21: I am dealing with very large data frames, artificially created with the following code, that are combined using rbind. a - rnorm(500) b - rnorm(500) c - rnorm(500) d - rnorm(500) first - data.frame(one=a, two=b, three=c, four=d) second - data.frame(one=d, two=c, three=b, four=a) Up to this point there is no error on my system version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Under development (unstable) major 2 minor 12.0 year 2010 month 05 day 31 svn rev 52164 language R version.string R version 2.12.0 Under development (unstable) (2010-05-31 r52164) sessionInfo() R version 2.12.0 Under development (unstable) (2010-05-31 r52164) Platform: i386-pc-mingw32/i386 (32-bit) attached base packages: [1] stats grDevices datasets utils graphics methods base other attached packages: [1] lattice_0.18-8 fun_1.0 loaded via a namespace (and not attached): [1] grid_2.12.0 tools_2.12.0 rbind(first, second) Although size of first and second is only roughly 160 MB their concatenation probably consumes all remaining memory space as you already have a-d first and second in memory. Regards Petr which results in the following error for each of the statements: a - rnorm(500) Error: cannot allocate vector of size 38.1 Mb b - rnorm(500) Error: cannot allocate vector of size 38.1 Mb c - rnorm(500) Error: cannot allocate vector of size 38.1 Mb d - rnorm(500) Error: cannot allocate vector of size 38.1 Mb first - data.frame(one=a, two=b, three=c, four=d) Error: cannot allocate vector of size 38.1 Mb second - data.frame(one=d, two=c, three=b, four=a) Error: cannot allocate vector of size 38.1 Mb rbind(first, second) When running memory.limit() I am getting this: memory.limit() [1] 2047 Which shows me that I have 2 GB of memory available. What is wrong? Shouldn't 38 MB be very feasible? Best, Ralf __ 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] Installing packages and passing parameters
Hello I am trying to install the RandomFields package by using install.packages(RandomFields) but the process fails. I think that if I pass to the g++ compiler the -lgfortran option might work. Could you please help me do this? I would like to thank you in advance for your help Best Regards Alex [[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] applying strsplit to a whole column
Maybe I'm completely wrong, but I get sometimes names like X..123 when I import data through read.delim, read.table, ... When it's necessary I avoid the X..123 by adding read.delim(xxx, check.names=F) HTH Bart -- View this message in context: http://r.789695.n4.nabble.com/applying-strsplit-to-a-whole-column-tp2313915p2314619.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] ticks label of plot
On 08/05/2010 07:14 AM, yan liu wrote: Hello, I had a question about how to label a axis of a plot. for example, my plot is plot(1:100, axes=F) box() axis(1) then, I want my y-axis has six ticks ( at=seq(0,100,10)) , but I don't want to label all the 11 ticks, I only want to label the 1st, 3rd, 5th, 7th and 11th ticks. But the code axis(), always need the length of the labels and at be equal, and not allow label partially. Hi Yan, I think you mean that you want to label 6 of the 11 ticks. Try this: axis(1,at=seq(0,100,10), labels=c(1,,3,,5,,7,,9,,11)) Sneakiness is its own reward. Jim __ 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 packages and passing parameters
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This suggests to tell us: OS? R version? Output you got so far? Best, Uwe Ligges On 05.08.2010 11:16, Alaios wrote: Hello I am trying to install the RandomFields package by using install.packages(RandomFields) but the process fails. I think that if I pass to the g++ compiler the -lgfortran option might work. Could you please help me do this? I would like to thank you in advance for your help Best Regards Alex [[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] question about SVM in e1071
Jack, sorry for the late answer. I agree that my last post is misleading. Here a new try: * * Increasing the value of *C* (...) forces the creation of a more accurate model, that may not generalise well.(Try to imagine the feature space with the two mapped sets very far from each other ) A model that fits better the training data is done by adding more SV ( till we get a convex hull of the data ), this is done reducing the soft margin (i.e. decreasing C ) ( and again that may not generalise well, maybe you can do a program witch cross-validation ) Here is another question: is the complexity of the boundary determined by number of total SVs (bounded SV + free SV) or free SVs only? What do you mean by complexity of the boundary ? Regards Pau 2010/7/28 Jack Luo jluo.rh...@gmail.com Pau, Sorry for getting back to you for this again. I am getting confused about your interpretation of 3). It is obvious from your code that increasing C results in* smaller *number of SVs, this seems to contradict with your interpretation * Increasing the value of C (...) forces the creation of a more accurate model.* A more accurate model is done my adding more SV. In addition, I got to know that the number of SVs increases with C decreasing is because there are many bounded SVs (whose alpha = C, remember 0 alpha = C), those SVs with alpha smaller than C is called free SVs. Here is another question: is the complexity of the boundary determined by number of total SVs (bounded SV + free SV) or free SVs only? Thanks a bunch, -Jack On Thu, Jul 15, 2010 at 4:17 AM, Pau Carrio Gaspar paucar...@gmail.comwrote: Hi Jack, to 1) and 2) there are telling you the same. I recommend you to read the first sections of the article it is very well writen and clear. There you will read about duality. to 3) I interpret the scatter plot so: * Increasing the value of C (...) forces the creation of a more accurate model.* A more accurate model is done my adding more SV ( till we get a convex hull of the data ) hope it helps Regards Pau 2010/7/14 Jack Luo jluo.rh...@gmail.com Pau, Thanks a lot for your email, I found it very helpful. Please see below for my reply, thanks. -Jack On Wed, Jul 14, 2010 at 10:36 AM, Pau Carrio Gaspar paucar...@gmail.com wrote: Hello Jack, 1 ) why do you thought that larger C is prone to overfitting than smaller C ? *There is some statement in the link http://www.dtreg.com/svm.htm To allow some flexibility in separating the categories, SVM models have a cost parameter, C, that controls the trade off between allowing training errors and forcing rigid margins. It creates a soft marginthat permits some misclassifications. Increasing the value of C increases the cost of misclassifying points and forces the creation of a more accurate model that may not generalize well. My understanding is that this means larger C may not generalize well (prone to overfitting). * 2 ) if you look at the formulation of the quadratic program problem you will see that C rules the error of the cutting plane ( and overfitting ). Therfore for hight C you allow that the cutting plane cuts worse the set, so SVM needs less points to build it. a proper explanation is in Kristin P. Bennett and Colin Campbell, Support Vector Machines: Hype or Hallelujah?, SIGKDD Explorations, 2,2, 2000, 1-13. http://www.idi.ntnu.no/emner/it3704/lectures/papers/Bennett_2000_Support.pdf *Could you be more specific about this? I don't quite understand. * 3) you might find usefull this plots: library(e1071) m1 - matrix( c( 0,0,0,1,1,2, 1, 2,3,2,3, 3, 0, 1,2,3,0, 1, 2, 3, 1,2,3,2,3,3, 0, 0,0,1, 1, 2, 4, 4,4,4,0, 1, 2, 3, 1,1,1,1,1,1,-1,-1, -1,-1,-1,-1, 1 ,1,1,1, 1, 1,-1,-1 ), ncol = 3 ) Y = m1[,3] X = m1[,1:2] df = data.frame( X , Y ) par(mfcol=c(4,2)) for( cost in c( 1e-3 ,1e-2 ,1e-1, 1e0, 1e+1, 1e+2 ,1e+3)) { #cost - 1 model.svm - svm( Y ~ . , data = df , type = C-classification , kernel = linear, cost = cost, scale =FALSE ) #print(model.svm$SV) plot(x=0,ylim=c(0,5), xlim=c(0,3),main= paste( cost: ,cost, #SV: , nrow(model.svm$SV) )) points(m1[m1[,3]0,1], m1[m1[,3]0,2], pch=3, col=green) points(m1[m1[,3]0,1], m1[m1[,3]0,2], pch=4, col=blue) points(model.svm$SV[,1],model.svm$SV[,2], pch=18 , col = red) } * * *Thanks a lot for the code, I really appreciate it. I've run it, but I am not sure how should I interpret the scatter plot, although it is obvious that number of SVs decreases with cost increasing. * Regards Pau 2010/7/14 Jack Luo jluo.rh...@gmail.com Hi, I have a question about the parameter C (cost) in svm function in e1071. I thought larger C is prone to overfitting than smaller C, and hence leads to more support vectors. However, using the Wisconsin breast cancer example on the link:
[R] Error in as.environment(pos): using 'as.environment(NULL)' is defunct
Hello, Im using R 2.11.1 with Tinn-R 1.17.2.4. I hope the given informations are enough (its my first entry here) The as.environment(pos) error appears in using the following code which should open a function in an other R-file. Here some extractions of the code: HZ-tclVar(seq(length=a,from=1,by=0))#(a is defined by a tkentry-element) VZ-tclVar(seq(length=a,from=1,by=0)) Aktivität-tclVar(seq(length=a,from=1,by=0)) VKG-tclVar(3) Zugehörigkeit is a matrix. #The values can be changed by a tkentry-element. handler.Berechnung-function() { tkconfigure(Ergebnisfenster, textvariable=tclVar(test2(as.numeric(tclObj(VKG)),as.numeric(tclObj(HZ)) ,as.numeric(tclObj(VZ)),as.numeric(tclObj(Aktivität)),as.numeric(tclObj( tclArray1) } test2 - local({source(C:/Berechnung_Funktion.R, local = TRUE) environment(Berechnung) - .GlobalEnv Berechnung }) and: Button-tkframe(InputOutputfenster) tkpack(Button, side='top') tkpack(tkbutton(Button, text='compute optimal solution',command=handler.Berechnung)) and the function in the other R-file: Berechnung-function(a,b,c,d,e) { } Thanks! __ 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] Output (graphics and table/text)
On Wed, 4 Aug 2010 18:02:41 -0400 Ralf B ralf.bie...@gmail.com wrote: b) the output is actually presented as a little table without the need to use a LaTeX solution? If it's not imperative to have the ks.test output in the graphic, why not copy/paste and use some monospace font? Liviu __ 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] PageUp/Down in gnome-terminal
On Thu, 05 Aug 2010 11:13:00 +0200 Olga Lyashevska o...@herenstraat.nl wrote: shift+pagep/pagedown doesnt work either. xfce is a desktop environment similar to gnome or kde, right? Yes, with less dependencies and less hungry on resources. I do not have any desktop environment (running R on a server), can I still try xfce? I am not very sure. If you are running gnome-terminal, I assume that you have a running X session and some sort of graphical environment. If this is so, installing and running xfce4-terminal should be straightforward (on Debian/Ubuntu [1] use apt-get) since it requires very few Xfce dependencies. Regards Liviu [1] http://packages.debian.org/squeeze/xfce4-terminal __ 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] Output (graphics and table/text)
Hi, To add tables, the gplots package has a textplot() function, and for Grid graphics there is a grid.table() function in gridExtra. HTH, baptiste On 5 August 2010 00:02, Ralf B ralf.bie...@gmail.com wrote: Hi R Users, I need to produce a simple report consisting of some graphs and a statistic. Here simplification of it: # graphics output test a - c(1,3,2,1,4) b - c(2,1,1,1,2) c - c(4,7,2,4,5) d - rnorm(500) e - rnorm(600) op - par(mfrow=c(3,2)) pie(a) pie(b) pie(c) text(ks.test(d,e)) obviously, the ks.test does not make it to the output. How can this be archived by a) simply dumpting the text into the fourth quad so that coordination is relative to the quarter? b) the output is actually presented as a little table without the need to use a LaTeX solution? Thanks a lot, Ralf __ 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] Error: cannot allocate vector of size xxx Mb
Hi I am not an expert in such issues (never really run into problems with memory size). From what I have read in previous posts on this topic (and there are numerous) the simplest way would be to go to 64 byte system (Linux, W Vista, 7), where size of objects is limited by amount of memory only. There are some packages dealing with big data (biglm, ...) or database approach (sqldf) Your version is a bit obsolete so upgrading could help but not with your final operation. Sometimes it can help to rethink why do you need such a huge amount of data together in memory and if you can not use only sampled data for further study. Regards Petr Ralf B ralf.bie...@gmail.com napsal dne 05.08.2010 11:13:40: Thank you for such a careful and thorough analysis of the problem and your comparison with your configuration. I very much appreciate. For completeness and (perhaps) further comparison, I have executed 'version' and sessionInfo() as well: version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status RC major 2 minor 10.0 year 2009 month 10 day25 svn rev50206 language R version.string R version 2.10.0 RC (2009-10-25 r50206) sessionInfo() R version 2.10.0 RC (2009-10-25 r50206) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] splines stats4grid stats graphics grDevices utils [8] datasets methods base other attached packages: [1] flexmix_2.2-7 multcomp_1.1-7survival_2.35-8 mvtnorm_0.9-9 [5] modeltools_0.2-16 lattice_0.18-3car_1.2-16psych_1.0-88 [9] nortest_1.0 gplots_2.8.0 caTools_1.10 bitops_1.0-4.1 [13] gdata_2.8.0 gtools_2.6.2 ggplot2_0.8.7 digest_0.4.2 [17] reshape_0.8.3 plyr_0.1.9proto_0.3-8 RJDBC_0.1-5 [21] rJava_0.8-2 DBI_0.2-5 loaded via a namespace (and not attached): [1] tools_2.10.0 memory.limit() [1] 2047 Also, the example i presented was a simplified reproduction of the real data structure. My real data structure does not have reused vectors. I merely wanted to show the error occurring when processing large vectors into data frames and then binding these data frames together. I hope this additional information helps. I might add that I am running this in StatET under Eclipse with 512 MB of allocated RAM in the environment. Besides adding more memory, can you spot simple ways of how memory use can be improved? I know that I am running quite a bit of baggage. Unfortunately my script is rather comprehensive and my example is really just a simplified part that I created to reproduce the problem. Thanks, Ralf On Thu, Aug 5, 2010 at 4:44 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 05.08.2010 09:53:21: I am dealing with very large data frames, artificially created with the following code, that are combined using rbind. a - rnorm(500) b - rnorm(500) c - rnorm(500) d - rnorm(500) first - data.frame(one=a, two=b, three=c, four=d) second - data.frame(one=d, two=c, three=b, four=a) Up to this point there is no error on my system version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Under development (unstable) major 2 minor 12.0 year 2010 month 05 day31 svn rev52164 language R version.string R version 2.12.0 Under development (unstable) (2010-05-31 r52164) sessionInfo() R version 2.12.0 Under development (unstable) (2010-05-31 r52164) Platform: i386-pc-mingw32/i386 (32-bit) attached base packages: [1] stats grDevices datasets utils graphics methods base other attached packages: [1] lattice_0.18-8 fun_1.0 loaded via a namespace (and not attached): [1] grid_2.12.0 tools_2.12.0 rbind(first, second) Although size of first and second is only roughly 160 MB their concatenation probably consumes all remaining memory space as you already have a-d first and second in memory. Regards Petr which results in the following error for each of the statements: a - rnorm(500) Error: cannot allocate vector of size 38.1 Mb b - rnorm(500) Error: cannot allocate vector of size 38.1 Mb c - rnorm(500) Error: cannot allocate vector of size 38.1 Mb d - rnorm(500) Error: cannot allocate vector of size 38.1 Mb first - data.frame(one=a, two=b, three=c, four=d) Error: cannot allocate vector of size 38.1 Mb second - data.frame(one=d, two=c,
Re: [R] offlist comment Re: KS Test question (2)
On Aug 5, 2010, at 4:10 AM, Ralf B wrote: This is unbelievable. Now people like yourself start doing background searches on one and accusing one of not being professional Your words, not mine. plus posting cheeky R code. It appeared that you were having problems and did not have an efficient strategy for searching the archives, so I shared with you code that I developed and have put in my .Rprofile setup file. I do no see where that is posting cheeky R code. I saw it as trying to be constructive. Using it would only be part of the recommended actions to take before posting The reason why I submitted the questions I have submitted was that these answers did not satisfy my particular problem (or perhaps I mistakenly thought so). The point here is that the forum should be a forum where one should be allowed to ask questions without first studying the history of the the entire forum in fear that someone might have asked it before. If you read the Posting Guide I think you will find precisely the opposite expectation explicitly presented. Using my cheeky code would only be part of the recommended actions to take before posting if you follow the recommendations of the Do your homework before posting: section. This list was not set up to be a chat room or a tutoring center for general questions in statistics. While you are reading the Posting Guide, please note that it expresses this advice regarding posting messages that were sent privately: Take care when you quote other people's comments to respect their rights, e.g., as summarized here. In particular • Private messages should never be quoted without permission, I was hoping that I could find clearer answers then what I was able to read. I do know how to search in Google. But I am not an expert in statistics, as you already found in your background check. If I would be fluent in stastitsics and R and if past answers would have exactly satisfied my problem I would not post here and I certainly would not have occupied your expensive attention. On Wed, Aug 4, 2010 at 6:16 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 5:49 PM, Ralf B wrote: Hi R Users, I have two vectors, x and y, of equal length representing two types of data from two studies. I would like to test if they are similar enough to use them interchangeably. No assumptions about distributions can be made (initial tests clearly show that they are not normal). Here some result: Two-sample Kolmogorov-Smirnov test data: x and y D = 0.1091, p-value 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(x[1:nx], y[1:nx], exact = FALSE) : cannot compute correct p-values with ties Here some questions: a) What does the error message means and what does it imply? b) The data is very noisy and the initial result shows that there is no relation between x and y. Is there a way to calculate and effect size? c) Can the p-value be used, when running tests over a large amount of different data sets, as a metric for ranking similarity between x and y data sets? There has been quite a bit of discussion on this list over the years about why KS test is not good in this situation. If I read the results of a search on your name correctly, you are in a department of Information Sciences. I would have thought that the first reaction of someone in that field would be do do a search on a question. Why are you filling up the archives with questions that have been repeatedly asked and answered? Do you need help in this area? rhelpSearch - function(string, restrict = c(Rhelp10, Rhelp08, Rhelp02, functions ), matchesPerPage = 100, ...) RSiteSearch(string=string, restrict = restrict, matchesPerPage = matchesPerPage, ...) rhelpSearch(KS.test ties p-value) Best R. -- David Winsemius, MD West Hartford, CT __ 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] Extracting future and past workday dates
Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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] Error: cannot allocate vector of size xxx Mb
On Aug 5, 2010, at 3:53 AM, Ralf B wrote: I am dealing with very large data frames, artificially created with the following code, that are combined using rbind. snipped When running memory.limit() I am getting this: memory.limit() [1] 2047 Which shows me that I have 2 GB of memory available. What is wrong? Shouldn't 38 MB be very feasible? No. This suggests very strongly that you have not taken the time to read the RW-FAQ. R has become sufficiently popular that a Google search bring it up as the first hit to a search on: RW FAQ http://cran.r-project.org/bin/windows/base/rw-FAQ.html Best, Ralf __ 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. David Winsemius, MD West Hartford, CT __ 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] Extracting future and past workday dates
Try this: c(Sys.Date() + 0:3, Sys.Date() - 0:3) or 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date() On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] multiple comparisons after glm
Dear list members, I have a question concerning multiple comparisons after using glm. My response variable is days until emergence of an insect species. The explanatory variables are sex (two levels), parasitoids added (two levels) and populations (34 levels). I would like to know now which populations are different in days until insect emergence. For this I used multiple comparisons as followed: model-glm( daysuntilemergence ~ sex + parasitoidsadded + population, quasipoisson ) glht(model, linfct = mcp(population = Tukey)) summary (glht(model, linfct = mcp(population = Tukey)) ) I am not sure now if the obtained p-values are for differences in days until emergence for the bean populations or if also the other factors : sex and parasitoidsadded are taken into account? Thank you for answering! Isabelle Zaugg, PhD Student University of Fribourg Department of Biology Unit of Ecology Evolution Chemin du Musée 10 CH-1700 Fribourg Switzerland Phone: +41 (0)26 300 88 67 E-mail: isabelle.za...@unifr.chmailto:isabelle.za...@unifr.ch [[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] Extracting future and past workday dates
Hi, Henrique Thank you for trying, but that is not what I want. You get WEEKdays, I need WORKdays, and preferably sorted in order from future to the past. Best, Sergey On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna www...@gmail.com wrote: Try this: c(Sys.Date() + 0:3, Sys.Date() - 0:3) or 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date() On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Kniven skärpes bara mot stenen. __ 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] Extracting future and past workday dates
On Aug 5, 2010, at 8:09 AM, Sergey Goriatchev wrote: Hi, Henrique Thank you for trying, but that is not what I want. You get WEEKdays, I need WORKdays, and preferably sorted in order from future to the past. Perhaps you would be pleased to know that there is an is.holiday function in chron: http://finzi.psych.upenn.edu/R/library/chron/html/is.holiday.html -- David. Best, Sergey On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna www...@gmail.com wrote: Try this: c(Sys.Date() + 0:3, Sys.Date() - 0:3) or 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date() On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Kniven skärpes bara mot stenen. __ 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. David Winsemius, MD West Hartford, CT __ 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] Extracting future and past workday dates
Thank you David, will check it out, as I use chron and zoo! Regards, Sergey On Thu, Aug 5, 2010 at 14:29, David Winsemius dwinsem...@comcast.net wrote: On Aug 5, 2010, at 8:09 AM, Sergey Goriatchev wrote: Hi, Henrique Thank you for trying, but that is not what I want. You get WEEKdays, I need WORKdays, and preferably sorted in order from future to the past. Perhaps you would be pleased to know that there is an is.holiday function in chron: http://finzi.psych.upenn.edu/R/library/chron/html/is.holiday.html -- David. Best, Sergey On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna www...@gmail.com wrote: Try this: c(Sys.Date() + 0:3, Sys.Date() - 0:3) or 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date() On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Kniven skärpes bara mot stenen. __ 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. David Winsemius, MD West Hartford, CT -- Kniven skärpes bara mot stenen. __ 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] Extracting future and past workday dates
Try this: n - 3 w - as.numeric(format(Sys.Date(), '%w')) fut - c(Sys.Date() - 0:(n + ifelse(w - n 6, (w - n) - 6, 0)), Sys.Date() + 1:(n + 1 + ifelse(w + n 6, (w + n) - 6, 0))) sort(fut[!format(fut, '%w') %in% c(6, 0)]) On Thu, Aug 5, 2010 at 9:09 AM, Sergey Goriatchev serg...@gmail.com wrote: Hi, Henrique Thank you for trying, but that is not what I want. You get WEEKdays, I need WORKdays, and preferably sorted in order from future to the past. Best, Sergey On Thu, Aug 5, 2010 at 14:06, Henrique Dallazuanna www...@gmail.com wrote: Try this: c(Sys.Date() + 0:3, Sys.Date() - 0:3) or 0:3 %*% matrix(c(1, -1), ncol = 2) + Sys.Date() On Thu, Aug 5, 2010 at 8:36 AM, Sergey Goriatchev serg...@gmail.com wrote: Hello everyone I need to extract a vector of (t-3) to (t+3) dates, only working days. How can I do that? For today I need a vector: 10.08.210 09.08.2010 06.08.2010 05.08.2010 04.08.2010 03.08.2010 02.08.2010 Regards, Sergey -- Kniven skärpes bara mot stenen. __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- Kniven skärpes bara mot stenen. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] colour of label points on a boxplot
Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and contig_type as below: AssemViral_ContigsLen-merge(Assem_ContigsLen,allViral_contigs,by.x=contig_id,by.y=X.Contid.ID,all.x=FALSE) Below is a boxplot for boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main=100species_rep2,ylab=Contig_length) All of the longer contigs in the sixth data set are allViral. How can I colour or label these? I tried overlaying 2 boxplots of different colours (using add=TRUE), but the individual points of the whiskers aren't coloured (and I can't figure out how to do so) I experimented with using points, but there isn't a general function that I can apply to all 6 datasets to identify the allViral contigs. specific questions; 1 -how can I color the data points that represent the whiskers in a boxplot? 2 - Can I identify and colour subsets of datapoints within a boxplot? 3- any other suggestions? Thank you, Alison __ 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] linear model with similar response predictor
Hi, can somebody tell me why R is not able to calculate a linear model written in this way? lm (seq(1:100)~seq(1:100)) Call: lm(formula = seq(1:100) ~ seq(1:100)) Coefficients: (Intercept) 50.5 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(mt, mf, contrasts) : problem with term 1 in model.matrix: no columns are assigned Seems that is not able to dealing with similar number and so with very small numbers for calculating the coefficients. Moreover also Intercepts is wrong it should be equal to 0. I compile the R 2.11.1 in the Fedora 13. Should i download a library? Some configure options are missing during the installation? or is a bug? Thanks in advance Giuseppe Amatulli __ 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] For Loop
I have some code that is working. The code calculates the error from the real vale when it does a run. The error in metres in called errorxy I want to do 10 runs of the code and everytime it does a run I want to an output of the errorxy, so that it can form an array. I am guessing I should use a for loop around the entire set of code? Any help? -- View this message in context: http://r.789695.n4.nabble.com/For-Loop-tp2314593p2314593.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] Reshape? I need it?
Dear all, I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic because I have this situation: TIPO Avariato A 0.05 B 0.09 A 9 B 8 A 9 B 3 and this is what I would like to do: AvariatoA B Avariato0.050.09 Avariato9 8 Avariato9 3 I don't know how to do it. I need to use reshape? how? thanks for your reply. Spigo -- View this message in context: http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.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] For Loop
Hello, Please read the posting guide found at the bottom of every post to this list. We need to be able to see a small, reproducible example of code that illustrates your question. It sounds like you might be looking for ?replicate. On 08/05/2010 03:47 AM, Turn Fall wrote: I have some code that is working. The code calculates the error from the real vale when it does a run. The error in metres in called errorxy I want to do 10 runs of the code and everytime it does a run I want to an output of the errorxy, so that it can form an array. I am guessing I should use a for loop around the entire set of code? Any help? __ 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] offlist comment Re: KS Test question (2)
On 木, 2010-08-05 at 07:32 -0400, David Winsemius wrote: I do no see where that is posting cheeky R code. I saw it as trying to be constructive. Using it would only be part of the recommended actions to take before posting Ralf B., Dr. Wisemius is one of the most prolific, unselfish, and helpful contributors to this list. I often wonder how he finds time to post all these enlightening comments and do his own work. You would be better off to take advantage off his advice, and not spurn it. -- Stuart Luppescu -=- slu .at. ccsr.uchicago.edu University of Chicago -=- CCSR 才文と智奈美の父 -=-Kernel 2.6.33-gentoo-r2 Nothing exceeds like Excel.-- Roger Koenker (in reply to a question why it takes so long to paste 19,000 lines of R code from Excel into R) R-help (October 2008) __ 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] colour of label points on a boxplot
It would really help if you could reduce the information below to a small reproducible example, that is, some small bit of code that a reader can paste into R and poke around at. For sending a small sample dataset have a look at ?dput I believe that this problem has been discussed on the R-help list before and you might find something about it with a search (RSiteSearch()) or using Google but it is hard to tell without an example. --- On Thu, 8/5/10, alison waller alison.wal...@embl.de wrote: From: alison waller alison.wal...@embl.de Subject: [R] colour of label points on a boxplot To: r-help@r-project.org Received: Thursday, August 5, 2010, 7:36 AM Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and contig_type as below: AssemViral_ContigsLen-merge(Assem_ContigsLen,allViral_contigs,by.x=contig_id,by.y=X.Contid.ID,all.x=FALSE) Below is a boxplot for boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main=100species_rep2,ylab=Contig_length) All of the longer contigs in the sixth data set are allViral. How can I colour or label these? I tried overlaying 2 boxplots of different colours (using add=TRUE), but the individual points of the whiskers aren't coloured (and I can't figure out how to do so) I experimented with using points, but there isn't a general function that I can apply to all 6 datasets to identify the allViral contigs. specific questions; 1 -how can I color the data points that represent the whiskers in a boxplot? 2 - Can I identify and colour subsets of datapoints within a boxplot? 3- any other suggestions? Thank you, Alison __ 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] linear model with similar response predictor
On 08/05/2010 05:50 AM, Giuseppe Amatulli wrote: Hi, can somebody tell me why R is not able to calculate a linear model written in this way? lm (seq(1:100)~seq(1:100)) Call: lm(formula = seq(1:100) ~ seq(1:100)) Coefficients: (Intercept) 50.5 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(mt, mf, contrasts) : problem with term 1 in model.matrix: no columns are assigned Essentially, I believe it's because you're using the same syntax on the LHS and RHS of the formula. Try this, (and 'seq' is redundant in your example): x - 1:100 y - 1:100 lm(y ~ x) Call: lm(formula = y ~ x) Coefficients: (Intercept)x -1.121e-141.000e+00 Seems that is not able to dealing with similar number and so with very small numbers for calculating the coefficients. Moreover also Intercepts is wrong it should be equal to 0. I compile the R 2.11.1 in the Fedora 13. Should i download a library? Some configure options are missing during the installation? or is a bug? Thanks in advance Giuseppe Amatulli __ 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] linear model with similar response predictor
On Aug 5, 2010, at 6:50 AM, Giuseppe Amatulli wrote: Hi, can somebody tell me why R is not able to calculate a linear model written in this way? lm (seq(1:100)~seq(1:100)) Call: lm(formula = seq(1:100) ~ seq(1:100)) Coefficients: (Intercept) 50.5 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : the response appeared on the right-hand side and was dropped 2: In model.matrix.default(mt, mf, contrasts) : problem with term 1 in model.matrix: no columns are assigned Seems that is not able to dealing with similar number and so with very small numbers for calculating the coefficients. Moreover also Intercepts is wrong it should be equal to 0. The group mean is correctly calculated. I compile the R 2.11.1 in the Fedora 13. Should i download a library? That would not appear to be necessary: x= 1:100 y=1:100 lm(y~x) Call: lm(formula = y ~ x) Coefficients: (Intercept)x -5.684e-141.000e+00 Some configure options are missing during the installation? or is a bug? Not sure. To determine that you would need to read the help page very carefully and determine whether putting such raw expressions into a location where formulas were generally used actually is allowed. A bit of experimentation shows that it is probably the rhs logic (as was also suggested by the warning message) where the issue arises. lm (seq(1:100)~., data=list(a=1:100)) Call: lm(formula = seq(1:100) ~ ., data = list(a = 1:100)) Coefficients: (Intercept)a -5.684e-141.000e+00 Read the help page for formula and note the section regarding the I() function: lm(seq(1:100)~I(seq(1:100)) ) Call: lm(formula = seq(1:100) ~ I(seq(1:100))) Coefficients: (Intercept) I(seq(1:100)) -5.684e-14 1.000e+00 Thanks in advance Giuseppe Amatulli David Winsemius, MD West Hartford, CT __ 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] Reshape? I need it?
Hello, For that simple case you could just do... newdf - data.frame(A=df[df$TIPO == A,2], B=df[df$TIPO == B,2]) where df is the name of your existing data.frame Michael On 5 August 2010 20:57, spigo nicola.spigo...@gmail.com wrote: Dear all, I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic because I have this situation: TIPO Avariato A 0.05 B 0.09 A 9 B 8 A 9 B 3 and this is what I would like to do: Avariato A B Avariato 0.05 0.09 Avariato 9 8 Avariato 9 3 I don't know how to do it. I need to use reshape? how? thanks for your reply. Spigo -- View this message in context: http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.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] Reshape? I need it?
Try this: unstack(DF, Avariato ~ TIPO) On Thu, Aug 5, 2010 at 7:57 AM, spigo nicola.spigo...@gmail.com wrote: Dear all, I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic because I have this situation: TIPO Avariato A 0.05 B 0.09 A 9 B 8 A 9 B 3 and this is what I would like to do: AvariatoA B Avariato0.050.09 Avariato9 8 Avariato9 3 I don't know how to do it. I need to use reshape? how? thanks for your reply. Spigo -- View this message in context: http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] build.pl in building library with Rtools211
Dear all, As I couldn't find any thread on the internet I hope the help-list might help me out. I've tried to update Rtools from R210 used in combination with R2.9.1 to R211 in combination with R2.11.1. However, I do not succeed. I have R2.11.1 running, as well as Inno Setup 5, HTML help and MikTex. A version of Perl is installed too. Environment variable paths are set to link to these directories too. However, when I try to build a library using: R CMD BUILD mypackage it immediately crashes as apparently it cannot find the file 'build' in R-2.11.1/bin. Indeed, this file is not present there (only build.pl) while this file is present in the R-2.9.1/bin directory. What obvious thing am I doing wrong. Your help is much appreciated. With regards, Niels Hintzen __ 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] a question about 'read.table' with or without 'read.table'.(urgent)
I believe Wu Gong has given you a solution. As a note you were probably reading in the first two columns as either factors or characters and the last one as numeric. You might want to try it again and then do a str() on the resulting data.frame to see what was happening. It can be confusing to discover that you have factor rather than character data in the data.frame. :) --- On Thu, 8/5/10, karena dr.jz...@gmail.com wrote: From: karena dr.jz...@gmail.com Subject: [R] a question about 'read.table' with or without 'read.table'.(urgent) To: r-help@r-project.org Received: Thursday, August 5, 2010, 12:32 AM Hi, I've got a quite tricky question. I have a txt file, named 'temp.txt', as the following: snp1 snp2 snp3 AA 00 00 GG GG 00 00 AA 00 I want to read the file into R. 1) when I use 'read.table' without 'header=T' option, temp - read.table('temp.txt') # I got temp V1 V2 V3 1 snp1 snp2 snp3 2 AA 00 00 3 GG GG 00 4 00 AA 00 2) If I include the 'header=T' option, temp - read.table('temp.txt', header=T, as.is=T) # I got temp snp1 snp2 snp3 1 AA 00 0 2 GG GG 0 3 00 AA 0 The difference is for 'snp3', we can see, in 1) the values for snp3 are all '00', while in 2) the values are all '0'. How can I keep the original values for snp3 as '00', meanwhile get the 'headers' or say the colnames as 'snp1 snp2 snp3'? thank you very much, karena -- View this message in context: http://r.789695.n4.nabble.com/a-question-about-read-table-with-or-without-read-table-urgent-tp2314423p2314423.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] Reshape? I need it?
Am 05.08.2010 12:57, schrieb spigo: I don't know how to do it. I need to use reshape? how? thanks for your reply. example(reshape) Stefan __ 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] plot points using vis.gam
Hello, I'm trying to illustrate the relationships between various trait and environment data gathered from a number of sites. I've created a GAM to do this: gam1=gam(trait~s(env1)+s(env2)+te(env1,env2)) and I know how to create a 3D plot using vis.gam. I want to be able to show points on the 3D plot indicating the sites that the data came from. I can do this on a 2D plot when there is one term, e.g. gam2=gam(trait~s(env1)) but cannot figure it out for the 3D plot. Any help would be much appreciated Monica -- View this message in context: http://r.789695.n4.nabble.com/plot-points-using-vis-gam-tp2314926p2314926.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] REmove level with zero observations
On 03/08/10 21:50, GL wrote: If I have a column with 2 levels, but one level has no remaining observations. Can I remove the level? Like this? d - data.frame(a = factor(rep(A, 3), levels = c(A, B))) levels(d$a) # [1] A B d$a - d$a[,drop=TRUE] levels(d$a) # [1] A Hope this helps Allan __ 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] A %nin% operator?
Sometimes I write code like this: qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty soon my code looks like fingernail clippings (or Lisp) and I'm thinking about precedence rather than my original task. So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L and then I'm happy again. I wonder, would something like this find a home in core R? Or is that too much syntactic sugar for your taste? -- Ken Williams Sr. Research Scientist Thomson Reuters Phone: 651-848-7712 ken.willi...@thomsonreuters.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] A %nin% operator?
See Harrell's Hmisc package -- David Huffer, Ph.D. Deputy Director CSOSA/ORE Washington, DC -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ken Williams Sent: Thursday, August 05, 2010 11:20 AM To: r-help@r-project.org Subject: [R] A %nin% operator? Sometimes I write code like this: qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty soon my code looks like fingernail clippings (or Lisp) and I'm thinking about precedence rather than my original task. So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L and then I'm happy again. I wonder, would something like this find a home in core R? Or is that too much syntactic sugar for your taste? -- Ken Williams Sr. Research Scientist Thomson Reuters Phone: 651-848-7712 ken.willi...@thomsonreuters.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] A %nin% operator?
Just FYI, the Hmisc package has had an implementation of %nin% for some time now. Ken Williams wrote: Sometimes I write code like this: qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty soon my code looks like fingernail clippings (or Lisp) and I'm thinking about precedence rather than my original task. So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L and then I'm happy again. I wonder, would something like this find a home in core R? Or is that too much syntactic sugar for your taste? __ 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] A %nin% operator?
Ha! Thanks. I should have a closer look at Hmisc in general. -Ken On 8/5/10 10:25 AM, David Huffer david.huf...@csosa.gov wrote: See Harrell's Hmisc package -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ken Williams Sent: Thursday, August 05, 2010 11:20 AM To: r-help@r-project.org Subject: [R] A %nin% operator? [...] So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L -- Ken Williams Sr. Research Scientist Thomson Reuters Phone: 651-848-7712 ken.willi...@thomsonreuters.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] several figures from one Sweave chunk?
Dear all It seems that it is not possible [1] to generate several graphs in a loop within an Sweave document. For example, fig=TRUE for (i in 1:4) plot(rnorm(100)+i) @ will not work. Since this limitation dates from old times (at least 2005), I was curious whether workarounds other than \includegraphics{} appeared in meantime. Perhaps something related to cacheSweave or pgfSweave? If you are aware of any such hacks, please post them here. Regards Liviu [1] http://www.stat.uni-muenchen.de/~leisch/Sweave/FAQ.html#x1-11000A.9 __ 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] A %nin% operator?
For curiosity's sake, and perhaps closer in keystrokes to R home, here's another version, `%ni%` - Negate(`%in%`) baptiste On Aug 5, 2010, at 5:30 PM, Ken Williams wrote: Ha! Thanks. I should have a closer look at Hmisc in general. -Ken On 8/5/10 10:25 AM, David Huffer david.huf...@csosa.gov wrote: See Harrell's Hmisc package -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ken Williams Sent: Thursday, August 05, 2010 11:20 AM To: r-help@r-project.org Subject: [R] A %nin% operator? [...] So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L -- Ken Williams Sr. Research Scientist Thomson Reuters Phone: 651-848-7712 ken.willi...@thomsonreuters.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] A %nin% operator?
The examples in the help page for %in% (shared by match) has the definition of a %w/o% binary operator. %w/o% - function(x,y) x[!x %in% y] #-- x without y since: %in% - function(x, table) match(x, table, nomatch = 0) 0 It appears that you have just re-invented the without-wheel. (which also seems to be happening a lot in Formula 1 races lately.) -- David. On Aug 5, 2010, at 11:19 AM, Ken Williams wrote: Sometimes I write code like this: qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty soon my code looks like fingernail clippings (or Lisp) and I'm thinking about precedence rather than my original task. So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L and then I'm happy again. I wonder, would something like this find a home in core R? Or is that too much syntactic sugar for your taste? -- Ken Williams David Winsemius, MD West Hartford, CT __ 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] A %nin% operator?
Yeah, and %w/o% seems to have reinvented setdiff(). =) -Ken On 8/5/10 10:53 AM, David Winsemius dwinsem...@comcast.net wrote: The examples in the help page for %in% (shared by match) has the definition of a %w/o% binary operator. %w/o% - function(x,y) x[!x %in% y] #-- x without y since: %in% - function(x, table) match(x, table, nomatch = 0) 0 It appears that you have just re-invented the without-wheel. -- Ken Williams Sr. Research Scientist Thomson Reuters Phone: 651-848-7712 ken.willi...@thomsonreuters.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 installation lme4a,
Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) Any Ideas on what I should do to be able to use the functions profile and env ? Thank you -- View this message in context: http://r.789695.n4.nabble.com/Help-installation-lme4a-tp2315070p2315070.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] A %nin% operator?
A related hint, Google doesn't let you search for %nin%, because it ignores % symbols (and most other punctuation), but cuil does allow you to search: http://cuil.com/search?q=%25nin%25+R On 5 August 2010 08:53, David Winsemius dwinsem...@comcast.net wrote: The examples in the help page for %in% (shared by match) has the definition of a %w/o% binary operator. %w/o% - function(x,y) x[!x %in% y] #-- x without y since: %in% - function(x, table) match(x, table, nomatch = 0) 0 It appears that you have just re-invented the without-wheel. (which also seems to be happening a lot in Formula 1 races lately.) -- David. On Aug 5, 2010, at 11:19 AM, Ken Williams wrote: Sometimes I write code like this: qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !pubid %in% c(104, 106, 107, 108)) and I get a little worried that maybe I've remembered the precedence rules wrong, so I change it to qf.a - subset(qf, pubid %in% c(104, 106, 107, 108)) qf.b - subset(qf, !(pubid %in% c(104, 106, 107, 108))) and pretty soon my code looks like fingernail clippings (or Lisp) and I'm thinking about precedence rather than my original task. So I write a %nin% operator which I define as: `%nin%` - function (x, table) match(x, table, nomatch = 0L) == 0L and then I'm happy again. I wonder, would something like this find a home in core R? Or is that too much syntactic sugar for your taste? -- Ken Williams David Winsemius, MD West Hartford, CT __ 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. -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.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] Help installation lme4a,
rod84 wrote: Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) Any Ideas on what I should do to be able to use the functions profile and env ? Thank you You probably need to build the package after you download it. At least I had to. Kevin -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ 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] an issue about missing data
Hi, I am using a function 'polygenic' in the package called 'GenABEL'. h2.gs - polygenic(b.dbp~age+age2+age3+sex+b.bmi, kin=gs.gkin, data=gs) --- ## and I got the following error message: Error in svd(X): infinite or missing values in 'x'. I know this may be due to some missing data issue, but I just don't know how to solve this problem. anyone can help? thanks a lot, karena -- View this message in context: http://r.789695.n4.nabble.com/an-issue-about-missing-data-tp2315094p2315094.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] interpretation of summary.lm() for ANOVA and ANCOVA when dealing with 2 or more factors
Hi, I am having a hard time getting what the summary.lm-output for an ANOVA / ANCOVA means. Examples I find always seem to deal with simpler cases than what I meet in my data. My main problem is understanding the output when getting significant INTERACTION TERMS (what never occurs in examples :(). The following is the output after summary.lm(ancova) where week is continuous, refug is a 2-level (y,n) factor and behand is a 3-level (high,low,mix) factor. Call: lm(formula = length ~ week * refug * behand) Residuals: Min 1Q Median 3Q Max -3.91693 -0.53805 -0.01267 0.52403 4.04333 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 6.946110.07175 96.811 2e-16 *** week 0.776370.03894 19.938 2e-16 *** refugy 0.152650.09633 1.585 0.1132 behandlow 0.311960.12404 2.515 0.0120 * behandmix 0.286870.12467 2.301 0.0215 * week:refugy 0.305400.05312 5.749 1.04e-08 *** week:behandlow 0.319520.06899 4.632 3.86e-06 *** week:behandmix 0.161380.06717 2.403 0.0164 * refugy:behandlow -0.279290.16623 -1.680 0.0931 . refugy:behandmix -0.178370.17393 -1.026 0.3052 week:refugy:behandlow -0.514950.09173 -5.614 2.26e-08 *** week:refugy:behandmix -0.402250.09470 -4.248 2.26e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.9312 on 1978 degrees of freedom (2 observations deleted due to missingness) Multiple R-squared: 0.5722, Adjusted R-squared: 0.5698 F-statistic: 240.5 on 11 and 1978 DF, p-value: 2.2e-16 In my understanding I get so far: Where there are only factor levels only the intercept is affected and where my continuous variable is involved the slope is affected. What I also understand is that the alphabetically first factor levels of my factors are somewhat hidden in the first two coefficients (intercept and week). BUT IN WHAT WAY ARE TWO DIFFERENT FACTOR_LEVELS HIDDEN IN THE SAME COEFFICIENT? AND WHAT ABOUT THE INTERACTION TERMS FOR THOSE TWO? Thanks for any help! Maybe there is a way to use contrasts in some way that would make the output easier to grab? /B [[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] colour of label points on a boxplot
Alison, Check out the options for the function bxp(), they include control over the colors of all parts of the boxplot, e.g., whiskcol for whisker color. Jean `·.,, (((º `·.,, (((º `·.,, (((º Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA phone: 715-623-4190, ext. 3125 FAX: 715-623-6773 GLSC web site: http://www.glsc.usgs.gov My homepage: http://profile.usgs.gov/jvadams e-mail: jvad...@usgs.gov Thu Aug 5 13:36:05 CEST 2010 Hi all, I have 6 datasets(dataframes Assem_ContigsLen7 through all_ContigsLen12) containing 3 columns (contig_id, contig_length, read_count). Each dataset is composed of 3 types of contigs (assemblies of genomic fragments), 1- all Bacterial fragments, 2 - all Viral fragments, 3 - mixed fragments. I identified the type of contig through a merge with another table with just contig_id and contig_type as below: AssemViral_ContigsLen-merge(Assem_ContigsLen,allViral_contigs,by.x=contig_id,by.y=X.Contid.ID,all.x=FALSE) Below is a boxplot for boxplot(Assem_ContigsLen7$length,Assem_ContigsLen8$length,Assem_ContigsLen9$length,Assem_ContigsLen10$length,Assem_ContigsLen11$length,Assem_ContigsLen12$length,main=100species_rep2,ylab=Contig_length) All of the longer contigs in the sixth data set are allViral. How can I colour or label these? I tried overlaying 2 boxplots of different colours (using add=TRUE), but the individual points of the whiskers aren't coloured (and I can't figure out how to do so) I experimented with using points, but there isn't a general function that I can apply to all 6 datasets to identify the allViral contigs. specific questions; 1 -how can I color the data points that represent the whiskers in a boxplot? 2 - Can I identify and colour subsets of datapoints within a boxplot? 3- any other suggestions? Thank you, Alison [[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 installation lme4a, Error Message: lme4a is not a valid installed library
Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) -- View this message in context: http://r.789695.n4.nabble.com/Help-installation-lme4a-Error-Message-lme4a-is-not-a-valid-installed-library-tp2314939p2314939.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] using grib files in R
I am not new to R, but I am new to .grib files. I am downloading some climate data and I would like to analyze it in R. R has a nice netcdf package, but I don’t see any package available to deal specifically with grib files. I see a few posts from other people using grib files in R. However, I was unclear if they used grib files in a different software program and then imported the data somehow into R. Is it possible to use read grib files in R and then use the data? If so, could someone point me to a book/website that might help me learn how to do this? Any advice would be helpful…I am beginning to think I should use a different software program, but I’d like to use R! Thanks, Janet __ 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] an issue about missing data
On Aug 5, 2010, at 12:23 PM, karena wrote: Hi, I am using a function 'polygenic' in the package called 'GenABEL'. h2.gs - polygenic(b.dbp~age+age2+age3+sex+b.bmi, kin=gs.gkin, data=gs) Have you considered using the complete.cases function or one of the na.* functions? --- ## and I got the following error message: Error in svd(X): infinite or missing values in 'x'. I know this may be due to some missing data issue, but I just don't know how to solve this problem. David Winsemius, MD West Hartford, CT __ 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] compare gam fits
Hi folks, I originally tried R-SIG-Mixed-Models for this one (https://stat.ethz.ch/pipermail/r-sig-mixed-models/2010q3/004170.html), but I think that the final steps to a solution aren't mixed-model specific, so I thought I'd ask my final questions here. I used gamm4 to fit a generalized additive mixed model to data from a AxBxC design, where A is a random effect (human participants in an experiment), B is a 2-level factor predictor variable, and C is a continuous variable that is likely non-linear. I tell gamm4 to fit a smooth across C to each level of B independently, and I can use predict.gam(...,se.fit=T) to obtain predictions from the fitted model as well as the standard error for the prediction. I'd like to visualize the BxC interaction to see if smoothing C within each level of B was really necessary, and if so, where it is (along the C dimension) that B affects the smooth. It's easy enough to obtain the predicted B1-B2 difference function, but I'm stuck on how to convey the uncertainty of this function (e.g. computing the confidence interval of the difference at each value of C). One thought is that predict.gam(...,se.fit=T) returns SE values, so if I could find out the N on which these SE values are computed, I could compute the difference CI as sqrt( ( (SD_B1)^2 + (SD_B2)^2 ) / N ) * qt( .975, df=N-1 ) However, I can't seem to figure out what value of N was used to compute the SEs that predict.gam(...,se.fit=T) produces. Can anyone point me to where I might find N? Further, is N-1 the proper df for the call to qt()? Finally, with a smooth function and 95% confidence intervals computed at each of a large number of points, don't I run into a problem of an inflated Type I error rate? Or does the fact that each point is not independent from those next to it make this an inappropriate concern? Cheers, Mike -- Mike Lawrence Graduate Student Department of Psychology Dalhousie University Looking to arrange a meeting? Check my public calendar: http://tr.im/mikes_public_calendar ~ Certainty is folly... I think. ~ __ 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] KS Test question (2)
The warning (with an error you would not see any results) means that there are ties in your data, the theory behind the ks test says that the probability of seeing ties is 0, so your data and the theory do not match, therefore the p-value is suspect (though an ok approximation for some uses). These types of tests are useful for showing differences (often in a non meaningful way), not similarities. You really need to decide what you mean by similar. Consider two population distributions, the first is the standard uniform with density height equal to 1 between 0 and 1 (0 elsewhere), the 2nd distribution has height 1 from 0 to 0.99 and from 99.99 to 100 (0 elsewhere), are these 2 populations similar? By some measures they are (the ks statistic for one), by other measures they are not (comparing mean and variance as an example). Whether they are similar or not really depends on what you want to do with them. One additional test you might consider is use the vis.test function in the TeachingDemos package, write a function that will either draw a standard qqplot of your 2 datasets, or pools them together then splits them randomly and creates the qqplot. Use this with vis.test, if you cannot pick out the real dataset then it is less likely to matter if you interchange them. (this assumes 2 random samples from the respective populations, if there is something more going on then you will need to come up with a different comparison that accounts for any structure). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Ralf B Sent: Wednesday, August 04, 2010 3:50 PM To: r-help@r-project.org Subject: [R] KS Test question (2) Hi R Users, I have two vectors, x and y, of equal length representing two types of data from two studies. I would like to test if they are similar enough to use them interchangeably. No assumptions about distributions can be made (initial tests clearly show that they are not normal). Here some result: Two-sample Kolmogorov-Smirnov test data: x and y D = 0.1091, p-value 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(x[1:nx], y[1:nx], exact = FALSE) : cannot compute correct p-values with ties Here some questions: a) What does the error message means and what does it imply? b) The data is very noisy and the initial result shows that there is no relation between x and y. Is there a way to calculate and effect size? c) Can the p-value be used, when running tests over a large amount of different data sets, as a metric for ranking similarity between x and y data sets? Best R. __ 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] Kolmogorov-Smirnov test, which one to use?
It is not clear what question you are trying to answer. Perhaps if you can give us an explanation of your overall goal then we can be more helpful. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Roslina Zakaria Sent: Wednesday, August 04, 2010 8:34 PM To: r-help@r-project.org Subject: [R] Kolmogorov-Smirnov test, which one to use? Hi, I have two sets of data, an observed data and generated data. The generated data is obtained from the model where the parameters is estimated from the observed data. So I'm not sure which to use either one-sample test ks.test(x+2, pgamma, 3, 2) # two-sided, exact or two-sample test ks.test(x, x2, alternative=l) If I use the one-sample test I need to specified the model which I don't have in my case. Actually I use the two-sample test and when I compare with what I got from using Chi-square test the result is too different. Data: obs_data pre_gam [1,] 93 25.6770 [2,] 115 127.9095 [3,] 125 151.6845 [4,] 120 146.9295 [5,] 106 107.9385 [6,] 101 107.4630 [7,] 75 86.5410 [8,] 58 55.6335 [9,] 46 43.7460 [10,] 38 32.8095 [11,] 31 16.1670 [12,] 17 18.5445 [13,] 10 9.0345 [14,] 16 20.9220 Results: chisq.test(obs_data, p = pre_gam, rescale.p = TRUE) Chi-squared test for given probabilities data: obs_data X-squared = 205.4477, df = 13, p-value 2.2e-16 ks.test(obs_data,pre_gam) Two-sample Kolmogorov-Smirnov test data: obs_data and pre_gam D = 0.2143, p-value = 0.9205 alternative hypothesis: two-sided Am I doing the right thing? Thank you so much for your help. [[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] metafor and meta-analysis at arm-level
Dear Angelo, rma(yi=o, sei=se, mods=~s+t-1, method=REML) is *a* way to run the arm-based pairwise meta-analysis. Whether it is the *correct* way is a question I cannot answer. lme(o~s+t-1, random=~t-1 | s, weights=(~ se^2)) is a different model. First of all, it adds a random effect only to each treatment arm within each study, while the rma model above gives a random effect to each observation. Moreover, the lme model assumes that the sampling variances are only known up to a proportionality constant, while the rma model assumes that they are known exactly. Similarly, lm(formula = o ~ s + t - 1, weights = 1/se.o^2) assumes that the sampling variances are only known up to a proportionality constant, while rma (with method=FE) assumes that they are known exactly. For the same reason will rma(yi=e, sei=se, method=REML) lme(e~1, random=~1 | s, weights=(~ se.e^2)) and rma(yi=e, sei=se.e, method=FE) lm(e~1, weights = 1/se.e^2) not give you the same results. Best, -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (0)43 388-2277 School for Public Health and Primary Care Office Location: Maastricht University, P.O. Box 616 Room B2.01 (second floor) 6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck) Original Message From: Angelo Franchini [mailto:angelo.franch...@bristol.ac.uk] Sent: Wednesday, August 04, 2010 16:26 To: Viechtbauer Wolfgang (STAT) Cc: 'Angelo Franchini'; r-help@r-project.org Subject: RE: [R] metafor and meta-analysis at arm-level Hello Wolfgang. I'd appreciate if you could help me check whether I am doing the proper thing to do an arm-level meta-analysis with metafor and what differences there might be in trying to do the same with lme and lm. I am following the arm based model described in section 3.2 of the Salanti's paper that you mentioned in your previous e-mail, namely: theta = B*eta + X*mu + W*beta where: theta = vector of parameter for outcomes in treatment arms (theta_ij for study i, treat. arm j) eta= vector of parameter for outcomes in control arms (eta_i for study i) mu = vector of effects (treat. vs cont.) (mu_ij for study i, treat. arm j) beta = vector of random effects (beta_ij for study i, treat. arm j) In my specific case with a pairwise meta-analysis, I had my data arranged as in columns for the following variables: s t o se with s as study/trial identifier t as 0/1 for control/treatment arm o as observed outcome in control or treatment arm se as standard error of that outcome measure I then ran metafor as: rma(yi=o, sei=se, mods=~s+t-1, method=REML) for random effects, and REML replaced by FE for fixed effects. Is that the correct way to run the arm-based pairwise meta-analysis? Shouldn't I be able to obtain similar results with LME for random-effects by using the command: lme(o~s+t-1, random=~t-1 | s, weights=(~ se^2)) and for fixed-effects with: lm(formula = o ~ s + t - 1, weights = 1/se.o^2) For the trial-based pairwise meta-analysis I used: data arranged as: s e se with: s study e effect se standard error and commands: rma(yi=e, sei=se, method=REML) or lme(e~1, random=~1 | s, weights=(~ se.e^2)) for random-effects, while for fixed-effects: rma(yi=e, sei=se.e, method=FE) lm(e~1, weights = 1/se.e^2) Does that make sense? Many thanks for any comment/advice on this matter. Best regards, Angelo __ 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] Sciviews-K -- object 'httpdPort' not found
Hi, I'm trying to install Sciviews-K on Linux Ubuntu 9.10 (karmic) but I'm not able to establish the connection between Komodo and R. Here;s the error I get, plus some diagnostic info: R version 2.9.2 (2009-08-24) R is SciViews ready! Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'httpdPort' not found ls() [1] svStart Sys.info() sysname Linux release 2.6.31-22-generic version #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 getBuiltinRhome.GString() [1] /usr/lib/R Does anybody know how to resolve this? Thanks in advance! Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ [[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] Metafor
Correct. -- Wolfgang Viechtbauerhttp://www.wvbauer.com/ Department of Methodology and StatisticsTel: +31 (0)43 388-2277 School for Public Health and Primary Care Office Location: Maastricht University, P.O. Box 616 Room B2.01 (second floor) 6200 MD Maastricht, The Netherlands Debyeplein 1 (Randwyck) Original Message From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nathan L Pace Sent: Tuesday, August 03, 2010 23:21 To: r-help@r-project.org Subject: [R] Metafor This is a question of clarification. IN 2009 Higgins, Thompson and Spiegelhalter (J R Statist Soc A 172:137-159) gave WinBUGs code to get credible intervals from random effects meta analysis for the prediction interval of a new study. It appears that the predict.rma function creates approximate credible intervals (pending a function revision by the author) for that purpose. Is my assumption correct? Nathan -- Nathan Pace, MD, MStat Department of Anesthesiology University of Utah 801.581.6393 n.l.p...@utah.edu [[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] Finding the right url for RCurl
On 8/4/2010 2:07 PM, AndrewPage wrote: Hi all, I am using RCurl to try and download data from a website, but I'm having trouble finding out what URL to use. Here is the site: http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX See how in the upper right, above the displayed sheet, there's a link to download the data as a .csv file? When I hit copy url and paste into getURL in R, it doesn't work. That's no surprise because there isn't a URL in what gets pasted. I was just wondering if there's any way around this. Thanks in advance, Andrew I looked at the page. The link you mentioned runs some javascript which alters some values in a form and posts that form, the result of which is the CSV file. There is not a simple URL that points to the file. I don't know if RCurl can post forms, but if it can you may be able to mimic the form. The structure of the form starts on line 191 of the page source (or search for aspnetForm) and appropriate values for __EVENTTARGET are given in the doPostBack call on line 258. Some understanding of HTML and HTTP may be necessary to know what is going on. I don't know if this would work or not. Also, the site has not made it easy to directly download the CSV file. That may be intentional. The Terms Services of the site may have something to say about doing this as well. -- Brian Diggs Senior Research Associate, Department of Surgery, Oregon Health Science University __ 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 installation lme4a, Error Message: lme4a is not a valid installed library
On Thu, Aug 5, 2010 at 9:31 AM, rod84 ngueye...@hotmail.com wrote: Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. You are copying the source package to the library where the compiled packages are kept, which is why you are getting the error. You will need to install the package from the sources. As a Linux user I find the process straightforward. Windows and Mac OS X users are often taken aback by the complexity of the process. What operating system are you using? When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) -- View this message in context: http://r.789695.n4.nabble.com/Help-installation-lme4a-Error-Message-lme4a-is-not-a-valid-installed-library-tp2314939p2314939.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] Sciviews-K -- object 'httpdPort' not found
Hi, httpdPort arrived with R 2.10.0, apparently Sciviews-K relies on this, so you need to upgrade R to a newer version. Romain Le 05/08/10 19:16, Albert-Jan Roskam a écrit : Hi, I'm trying to install Sciviews-K on Linux Ubuntu 9.10 (karmic) but I'm not able to establish the connection between Komodo and R. Here;s the error I get, plus some diagnostic info: R version 2.9.2 (2009-08-24) R is SciViews ready! Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'httpdPort' not found ls() [1] svStart Sys.info() sysname Linux release 2.6.31-22-generic version #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 getBuiltinRhome.GString() [1] /usr/lib/R Does anybody know how to resolve this? Thanks in advance! Cheers!! Albert-Jan -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/aAyra4 : highlight 0.2-2 |- http://bit.ly/94EBKx : inline 0.3.6 `- http://bit.ly/aryfrk : useR! 2010 __ 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 installation lme4a, Error Message: lme4a is not a valid installed library
Thank you for your prompt response,I am using Windows. Date: Thu, 5 Aug 2010 12:32:19 -0500 Subject: Re: [R] Help installation lme4a, Error Message: lme4a is not a valid installed library From: ba...@stat.wisc.edu To: ngueye...@hotmail.com CC: r-help@r-project.org On Thu, Aug 5, 2010 at 9:31 AM, rod84 ngueye...@hotmail.com wrote: Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. You are copying the source package to the library where the compiled packages are kept, which is why you are getting the error. You will need to install the package from the sources. As a Linux user I find the process straightforward. Windows and Mac OS X users are often taken aback by the complexity of the process. What operating system are you using? When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) -- View this message in context: http://r.789695.n4.nabble.com/Help-installation-lme4a-Error-Message-lme4a-is-not-a-valid-installed-library-tp2314939p2314939.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. [[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] Help installation lme4a,
Thank you for your prompt response. I am not used to the process of building a package. And I am using Windows as an OS.Do you have some steps I should follow to be able to build the package.Thank you for your time and recommendations. Date: Thu, 5 Aug 2010 09:19:18 -0700 From: ml-node+2315087-721880019-372...@n4.nabble.com To: ngueye...@hotmail.com Subject: Re: Help installation lme4a, rod84 wrote: Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) Any Ideas on what I should do to be able to use the functions profile and env ? Thank you You probably need to build the package after you download it. At least I had to. Kevin -- Kevin E. Thorpe Biostatistician/Trialist, Knowledge Translation Program Assistant Professor, Dalla Lana School of Public Health University of Toronto email: [hidden email] Tel: 416.864.5776 Fax: 416.864.3016 __ [hidden email] mailing list PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. View message @ http://r.789695.n4.nabble.com/Help-installation-lme4a-tp2315070p2315087.html To unsubscribe from Help installation lme4a,, click here. -- View this message in context: http://r.789695.n4.nabble.com/Help-installation-lme4a-tp2315070p2315377.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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help installation lme4a,
On 05.08.2010 19:48, rod84 wrote: Thank you for your prompt response. I am not used to the process of building a package. And I am using Windows as an OS.Do you have some steps I should follow to be able to build the package.Thank you for your time and recommendations. See the manual R Installation and Administration. It won't help completely since at least the automatic R-forge scripts do not manage to compile lme4a out of the box, as far as I see from the logs. Best, Uwe Ligges Date: Thu, 5 Aug 2010 09:19:18 -0700 From: ml-node+2315087-721880019-372...@n4.nabble.com To: ngueye...@hotmail.com Subject: Re: Help installation lme4a, rod84 wrote: Dear R users, I recently downloaded the library lme4a by svn checkout svn://svn.r-forge.r-project.org/svnroot/lme4. I tried to install the library lme4a by copying the downloaded document in the location where all the R libraries are saved. When I try to load the library, I obtain the message library(lme4a) Error in library(lme4a) : 'lme4a' is not a valid installed package R version 2.11.1 (2010-05-31) Any Ideas on what I should do to be able to use the functions profile and env ? Thank you You probably need to build the package after you download it. At least I had to. Kevin __ 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] Finding the right url for RCurl
Try this: library(XML) readHTMLTable(' http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX', which = 13, header = TRUE) On Wed, Aug 4, 2010 at 6:07 PM, AndrewPage savejar...@yahoo.com wrote: Hi all, I am using RCurl to try and download data from a website, but I'm having trouble finding out what URL to use. Here is the site: http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX See how in the upper right, above the displayed sheet, there's a link to download the data as a .csv file? When I hit copy url and paste into getURL in R, it doesn't work. That's no surprise because there isn't a URL in what gets pasted. I was just wondering if there's any way around this. Thanks in advance, Andrew -- View this message in context: http://r.789695.n4.nabble.com/Finding-the-right-url-for-RCurl-tp2314163p2314163.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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] offlist comment Re: KS Test question (2)
Hi David, I would like to apologize for what I wrote earlier. It was late and I was frustrated. Please give me time to adapt to the formal structures of the forum. Best, Ralf On Thu, Aug 5, 2010 at 7:32 AM, David Winsemius dwinsem...@comcast.net wrote: On Aug 5, 2010, at 4:10 AM, Ralf B wrote: This is unbelievable. Now people like yourself start doing background searches on one and accusing one of not being professional Your words, not mine. plus posting cheeky R code. It appeared that you were having problems and did not have an efficient strategy for searching the archives, so I shared with you code that I developed and have put in my .Rprofile setup file. I do no see where that is posting cheeky R code. I saw it as trying to be constructive. Using it would only be part of the recommended actions to take before posting The reason why I submitted the questions I have submitted was that these answers did not satisfy my particular problem (or perhaps I mistakenly thought so). The point here is that the forum should be a forum where one should be allowed to ask questions without first studying the history of the the entire forum in fear that someone might have asked it before. If you read the Posting Guide I think you will find precisely the opposite expectation explicitly presented. Using my cheeky code would only be part of the recommended actions to take before posting if you follow the recommendations of the Do your homework before posting: section. This list was not set up to be a chat room or a tutoring center for general questions in statistics. While you are reading the Posting Guide, please note that it expresses this advice regarding posting messages that were sent privately: Take care when you quote other people's comments to respect their rights, e.g., as summarized here. In particular • Private messages should never be quoted without permission, I was hoping that I could find clearer answers then what I was able to read. I do know how to search in Google. But I am not an expert in statistics, as you already found in your background check. If I would be fluent in stastitsics and R and if past answers would have exactly satisfied my problem I would not post here and I certainly would not have occupied your expensive attention. On Wed, Aug 4, 2010 at 6:16 PM, David Winsemius dwinsem...@comcast.net wrote: On Aug 4, 2010, at 5:49 PM, Ralf B wrote: Hi R Users, I have two vectors, x and y, of equal length representing two types of data from two studies. I would like to test if they are similar enough to use them interchangeably. No assumptions about distributions can be made (initial tests clearly show that they are not normal). Here some result: Two-sample Kolmogorov-Smirnov test data: x and y D = 0.1091, p-value 2.2e-16 alternative hypothesis: two-sided Warning message: In ks.test(x[1:nx], y[1:nx], exact = FALSE) : cannot compute correct p-values with ties Here some questions: a) What does the error message means and what does it imply? b) The data is very noisy and the initial result shows that there is no relation between x and y. Is there a way to calculate and effect size? c) Can the p-value be used, when running tests over a large amount of different data sets, as a metric for ranking similarity between x and y data sets? There has been quite a bit of discussion on this list over the years about why KS test is not good in this situation. If I read the results of a search on your name correctly, you are in a department of Information Sciences. I would have thought that the first reaction of someone in that field would be do do a search on a question. Why are you filling up the archives with questions that have been repeatedly asked and answered? Do you need help in this area? rhelpSearch - function(string, restrict = c(Rhelp10, Rhelp08, Rhelp02, functions ), matchesPerPage = 100, ...) RSiteSearch(string=string, restrict = restrict, matchesPerPage = matchesPerPage, ...) rhelpSearch(KS.test ties p-value) Best R. -- David Winsemius, MD West Hartford, CT __ 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] Plotting range of values in barplot()
Hello, I am attempting to create a bar plot that contains a range of possible response values on the x-axis of 1 to 5 and contains barplots for the number of responses even in the event that there are 0 responses. For example, I have a data set that contains values of 2, 3, 4, and 5 but I would also like my graph to show that there are no 1's. I have attached the resulting graph. The appropriate values should be 0 - Strongly Disagree, 1 - Somewhat Disagree, 2 - Neutral, 7 - Somewhat Agree, and 12 - Strongly Agree. Any suggestions would be much appreciated as I am new to R. Thanks, Steve http://r.789695.n4.nabble.com/file/n2315414/graph.jpg -- View this message in context: http://r.789695.n4.nabble.com/Plotting-range-of-values-in-barplot-tp2315414p2315414.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] difficulties with read.table applied to files from URL
Hello, I am using read.table to read files directly from a public ftp site. I have a general list of files that may or may not exist in the ftp directory, but my hope was that R would read the file if it existed and ignored it if it didn't exist and move on to the next one. However, when R arrives at a file that does not exist I get the error message Error in file(file, rt) : cannot open the connection This makes sense, but I was wondering if there was any way I could circumvent this error message and have R instead give me a warning message without terminating my entire loop. Ideally, I would get a warning message saying the connection does not exist, and then have R skip to the next file. My code is copied below. hourly.years - c(2000:2008) hourly.species - c('ch4','co2','co') station.names - c('alt482n00','chm449n00','egb444n01','etl454n00','fsd449n00','llb454n01','wsa443n00','cdl453n00') for (kk in hourly.years) { for (i in hourly.species) { for (nn in station.names) { file1 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.anc',sep='') #ancillary data file2 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.dat',sep='') #concentration data dumm.anc - read.table(file1,skip=32,header=F,as.is=T) colnames(dumm.anc) - c('DATE','TIME','WD','WS','RH','AT') dumm.dat - read.table(file2,skip=32,header=F,as.is=T) colnames(dumm.dat) - c('DATE','TIME','DATE','TIME','CH4','ND','SD','F','CS','REM') r.obj.anc - paste(substr(nn,1,3),i,kk,'anc.cont',sep='.') r.obj.dat - paste(substr(nn,1,3),i,kk,'dat.cont',sep='.') assign(r.obj.anc,dumm.anc) assign(r.obj.dat,dumm.dat) status-paste(i,nn,kk,'EC HOURLY/CONTINUOUS DAT/ANC read complete',sep=' ') print(status,quote=F) } } } Thanks for any help! Regards, Archana [[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] difficulties with read.table applied to files from URL
On Aug 5, 2010, at 2:48 PM, Archana Dayalu wrote: Hello, I am using read.table to read files directly from a public ftp site. I have a general list of files that may or may not exist in the ftp directory, but my hope was that R would read the file if it existed and ignored it if it didn't exist and move on to the next one. However, when R arrives at a file that does not exist I get the error message Error in file(file, rt) : cannot open the connection This makes sense, but I was wondering if there was any way I could circumvent this error message and have R instead give me a warning message without terminating my entire loop. Yes. ?try Ideally, I would get a warning message saying the connection does not exist, and then have R skip to the next file. My code is copied below. Something like these modifications untested: hourly.years - c(2000:2008) hourly.species - c('ch4','co2','co') station.names - c ('alt482n00 ','chm449n00 ','egb444n01 ','etl454n00','fsd449n00','llb454n01','wsa443n00','cdl453n00') for (kk in hourly.years) { for (i in hourly.species) { for (nn in station.names) { file1 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.anc',sep='') #ancillary data file2 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.dat',sep='') #concentration data dumm.anc - try( read.table(file1,skip=32,header=F,as.is=T) ) if (class(dumm.anc) == try-error {} else { colnames(dumm.anc) - c('DATE','TIME','WD','WS','RH','AT') r.obj.anc - paste(substr(nn,1,3),i,kk,'anc.cont',sep='.') assign(r.obj.anc,dumm.anc) } dumm.dat - try( read.table(file2,skip=32,header=F,as.is=T) ) if (class(dumm.dat) == try-error {} else { #will skip over following commands if try-error-ed colnames(dumm.dat) - c('DATE','TIME','DATE','TIME','CH4','ND','SD','F','CS','REM') r.obj.dat - paste(substr(nn,1,3),i,kk,'dat.cont',sep='.') assign(r.obj.dat,dumm.dat) } # --presumably these do not depend on the read- tries- status-paste(i,nn,kk,'EC HOURLY/CONTINUOUS DAT/ANC read complete',sep=' ') print(status,quote=F) } } } -- David Winsemius, MD West Hartford, CT __ 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] Exporting nlme summary
I'm trying to export the results of my summary data for the object horton.nlme, but failing miserably. Running summary(horton.nlme) works fine, but both write.table and write.csv return the error cannot coerce class 'c(summary.lme, nlme, lme)' into a data.frame. I know I can copy and paste the output from the summary function, but it's ugly because the spacing between numbers and fields is minimal. Thanks for any help! [[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] Sciviews-K -- object 'httpdPort' not found
Hi, Thank you, you're right. I should have read the website more carefully: Download and install R (installers for Linux, Mac OS X universal, Windows, ...; use at least R 2.10.1). http://www.sciviews.org/SciViews-K/index.html In Windows, I use that version but I didn't think about it when trying to install it in Linux. Thanks again, I'll try it and I expect it will work. Cheers!! Albert-Jan ~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~ --- On Thu, 8/5/10, Romain Francois romain.franc...@dbmail.com wrote: From: Romain Francois romain.franc...@dbmail.com Subject: Re: [R] Sciviews-K -- object 'httpdPort' not found To: Albert-Jan Roskam fo...@yahoo.com Cc: r-help@r-project.org r-help@r-project.org Date: Thursday, August 5, 2010, 7:38 PM Hi, httpdPort arrived with R 2.10.0, apparently Sciviews-K relies on this, so you need to upgrade R to a newer version. Romain Le 05/08/10 19:16, Albert-Jan Roskam a écrit : Hi, I'm trying to install Sciviews-K on Linux Ubuntu 9.10 (karmic) but I'm not able to establish the connection between Komodo and R. Here;s the error I get, plus some diagnostic info: R version 2.9.2 (2009-08-24) R is SciViews ready! Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'httpdPort' not found ls() [1] svStart Sys.info() sysname Linux release 2.6.31-22-generic version #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 getBuiltinRhome.GString() [1] /usr/lib/R Does anybody know how to resolve this? Thanks in advance! Cheers!! Albert-Jan -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://bit.ly/aAyra4 : highlight 0.2-2 |- http://bit.ly/94EBKx : inline 0.3.6 `- http://bit.ly/aryfrk : useR! 2010 [[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] difficulties with read.table applied to files from URL
On Aug 5, 2010, at 3:05 PM, David Winsemius wrote: On Aug 5, 2010, at 2:48 PM, Archana Dayalu wrote: Hello, I am using read.table to read files directly from a public ftp site. I have a general list of files that may or may not exist in the ftp directory, but my hope was that R would read the file if it existed and ignored it if it didn't exist and move on to the next one. However, when R arrives at a file that does not exist I get the error message Error in file(file, rt) : cannot open the connection This makes sense, but I was wondering if there was any way I could circumvent this error message and have R instead give me a warning message without terminating my entire loop. Yes. ?try Ideally, I would get a warning message saying the connection does not exist, and then have R skip to the next file. My code is copied below. Something like these modifications untested: Tried and discovered I need to remove the line feeds that broke the file name assignment as well as adding 2 parens to close the if-test. With those modifications you seem to be getting some sore of activity. Aborting the run after a few access I see: str(r.obj.dat) chr alt.ch4.2000.dat.cont str(alt.ch4.2000.dat.cont) 'data.frame': 8784 obs. of 10 variables: $ DATE: chr 2000-01-01 2000-01-01 2000-01-01 2000-01-01 ... $ TIME: chr 01:00 02:00 03:00 04:00 ... $ DATE: chr -99-99 -99-99 -99-99 -99-99 ... $ TIME: chr 99:99 99:99 99:99 99:99 ... $ CH4 : num -1000 1864 1868 1863 1869 ... $ ND : int 0 10 7 10 10 7 10 10 7 10 ... $ SD : num -10 1.8 0.8 2.5 1.1 ... $ F : int 0 1 1 1 1 1 1 1 1 1 ... $ CS : int 0 0 0 0 0 0 0 0 0 0 ... $ REM : int - - - - - - - - - - ... hourly.years - c(2000:2008) hourly.species - c('ch4','co2','co') station.names - c ('alt482n00 ','chm449n00 ','egb444n01 ','etl454n00','fsd449n00','llb454n01','wsa443n00','cdl453n00') for (kk in hourly.years) { for (i in hourly.species) { for (nn in station.names) { file1 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.anc',sep='') #ancillary data file2 - paste('ftp://gaw.kishou.go.jp/pub/data/current/ ',i,'/hourly/y',kk,'/',nn,'.ec.as.cn.',i,'.nl.hr',kk,'.dat',sep='') #concentration data dumm.anc - try( read.table(file1,skip=32,header=F,as.is=T) ) if (class(dumm.anc) == try-error {} else { missing ) about here .^ colnames(dumm.anc) - c('DATE','TIME','WD','WS','RH','AT') r.obj.anc - paste(substr(nn,1,3),i,kk,'anc.cont',sep='.') assign(r.obj.anc,dumm.anc) } dumm.dat - try( read.table(file2,skip=32,header=F,as.is=T) ) if (class(dumm.dat) == try-error{} else { #will skip if error missing ) about here .^ colnames(dumm.dat) - c('DATE','TIME','DATE','TIME','CH4','ND','SD','F','CS','REM') r.obj.dat - paste(substr(nn,1,3),i,kk,'dat.cont',sep='.') assign(r.obj.dat,dumm.dat) } # --presumably these do not depend on the read- tries- status-paste(i,nn,kk,'EC HOURLY/CONTINUOUS DAT/ANC read complete',sep=' ') print(status,quote=F) } } } -- David Winsemius, MD West Hartford, CT __ 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. David Winsemius, MD West Hartford, CT __ 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] Finding the right url for RCurl
Thanks for the help so far-- one interesting thing about this particular page is that the data displayed on the website actually differs from the data you can access with the download link. The XML package command works, but the table it produces in R has the following column names: x1 = readHTMLTable(http://www.invescopowershares.com/products/holdings.aspx?ticker=PGX;, which + = 13, header = TRUE) colnames(x1) [1] Coupon Rate Maturity Date Ratingâ\u0080 % Weight Warning message: it is not known that wchar_t is Unicode on this platform whereas the .csv file you can get with the link has 8 columns, including a PositionDate column, a Shares column, etc. that aren't present on the page's table. What makes this even more confusing is that the XML table contains MORE information than is presented on the page, such as Maturity Date. What I'm really looking for is a way to access the .csv file, so I doubt that reading info from the webpage will be sufficient seeing as it seems to be displaying different data. --Andrew -- View this message in context: http://r.789695.n4.nabble.com/Finding-the-right-url-for-RCurl-tp2314163p2315461.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] an issue about missing data
thank you, but even after I tried 'complete.cases' function, I still get the same error messages. help. -- View this message in context: http://r.789695.n4.nabble.com/an-issue-about-missing-data-tp2315094p2315519.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] an issue about missing data
On Aug 5, 2010, at 3:44 PM, karena wrote: thank you, but even after I tried 'complete.cases' function, How did you try? I still get the same error messages. What does str(gs) tell you? help. Plaintive cries for help are considerably less useful than details about the code and the data. -- David Winsemius, MD West Hartford, CT __ 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] Multiply each depth level of an array with another vector element
Suppose x - array(c(1,1,1,1,2,2,2,2), dim = c(2,2,2)) y - c(5, 10) Now I would like to multiply x[, , 1] with y[1] and x[, , 2] with y[2]. Possible solution is a for-loop: for (i in 1:2) { x[, , i] * y[i] } Another possible solution is this construction: as.vector(t(replicate(nrow(x) * ncol(x), y))) * x I find that these two solutions have a relatively large computation time (on larger arrays) and I suspect there should be solution with less computation time. Is there a faster method to perform this calculation (thus to multiply the depth of an array with respective vector elements)? Best regards, Maurits Aben [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plotting range of values in barplot()
On Aug 5, 2010, at 1:22 PM, yankeetilidie wrote: Hello, I am attempting to create a bar plot that contains a range of possible response values on the x-axis of 1 to 5 and contains barplots for the number of responses even in the event that there are 0 responses. For example, I have a data set that contains values of 2, 3, 4, and 5 but I would also like my graph to show that there are no 1's. I have attached the resulting graph. The appropriate values should be 0 - Strongly Disagree, 1 - Somewhat Disagree, 2 - Neutral, 7 - Somewhat Agree, and 12 - Strongly Agree. Any suggestions would be much appreciated as I am new to R. Thanks, Steve http://r.789695.n4.nabble.com/file/n2315414/graph.jpg barplot() will plot the tabulation of the variables included in the available data set. If you want to include missing categories, then you need to set the underlying raw data to a factor, specifying the additional levels for the missing categories. So, presuming that you have the raw data in a vector 'MyData': MyData - c(Somewhat Disagree, rep(Neutral, 2), rep(Somewhat Agree, 7), rep(Strongly Agree, 12)) MyData [1] Somewhat Disagree Neutral Neutral [4] Somewhat AgreeSomewhat AgreeSomewhat Agree [7] Somewhat AgreeSomewhat AgreeSomewhat Agree [10] Somewhat AgreeStrongly AgreeStrongly Agree [13] Strongly AgreeStrongly AgreeStrongly Agree [16] Strongly AgreeStrongly AgreeStrongly Agree [19] Strongly AgreeStrongly AgreeStrongly Agree [22] Strongly Agree table(MyData) MyData NeutralSomewhat Agree Somewhat DisagreeStrongly Agree 2 7 112 Now, create a factor with the categories in the order that you want and with the additional level(s) that refer to missing categories: MyData - factor(MyData, levels = c(Strongly Disagree, Somewhat Disagree, Neutral, Somewhat Agree, Strongly Agree)) table(MyData) MyData Strongly Disagree Somewhat Disagree NeutralSomewhat Agree 0 1 2 7 Strongly Agree 12 Now do the barplot(): MyTab - table(MyData) barplot(MyTab, names.arg = MyTab) HTH, Marc Schwartz __ 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 to extract se(coef) from cph?
Hello, I am modeling some survival data wih cph (Design). I have modeled a predictor which showed non linear effect with restricted cubic splines. I would like to retrieve the se(coef) for other, linear, predictors. This is just to make nice LateX tables automatically. I have the coefficients with coef(). How do I do that? Thanks, David Biau. [[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] try-error within for loop
Dear all, I run a loop wrapped in try(), and for each of the rows where try-error is true I want to fill that row with NA (at the moment it is omitted). So I would expect to get a dataframe with 1000 rows some of which would be empty, but instead I get a dataframe with 995 rows. In this case missing 5 rows were omitted. Any suggestions? Thanks, Olga result-list() for(i in 1:1000)try({ hclass-mydata2$tclass[mydata2$tspecies%in%com[[i]][[5]][[1]]] horder-mydata2$torder[mydata2$tspecies%in%com[[i]][[5]][[1]]] hfamily-mydata2$tfamily[mydata2$tspecies%in%com[[i]][[5]][[1]]] hgenus-mydata2$tgenus[mydata2$tspecies%in%com[[i]][[5]][[1]]] hspecies-mydata2$tspecies[mydata2$tspecies%in%com[[i]][[5]][[1]]] hier-cbind(hspecies,hgenus,hfamily,horder,hclass) s-nrow(hier) s-ifelse(s1000,s/10,s) taxa-taxa2dist(hier[sample(s,replace=F),]) abd-t(cbind(c(1:s),rep(1,s))) taxdiv-taxondiveO(abd,taxa) if(class(result)==try-error) result[[i]] - NA else result[[i]] -taxdiv #it doesnt work result[[i]]-as.data.frame(result[[i]])[1,]},silent=T) taxind-do.call(rbind,result) taxind[1:5,] numberDDstar LambdaDplusSDplus 1 589 94.72456 94.93875 142.4468 94.88140 55885.15 2 428 80.38656 80.63660 328.7728 80.90432 34627.05 3 282 88.03613 88.45139 332.8963 88.53554 24967.02 41320 80.43822 80.51943 328.1416 80.63355 106436.29 51077 80.43121 80.53073 287.2267 80.62954 86838.01 and instead I want to see NA where appropriate taxind[1:5,] numberDDstar LambdaDplusSDplus 1 589 94.72456 94.93875 142.4468 94.88140 55885.15 2 428 80.38656 80.63660 328.7728 80.90432 34627.05 3 282 88.03613 88.45139 332.8963 88.53554 24967.02 4 NA NA NA NA NA NA 51077 80.43121 80.53073 287.2267 80.62954 86838.01 __ 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 to extract se(coef) from cph?
On Aug 5, 2010, at 4:03 PM, Biau David wrote: Hello, I am modeling some survival data wih cph (Design). I have modeled a predictor which showed non linear effect with restricted cubic splines. I would like to retrieve the se(coef) for other, linear, predictors. The cph object has a var. The vcov function is an extractor function. You would probably be using something like: diag(vcov(fit))^(1/2) This is just to make nice LateX tables automatically. Are you sure Frank has not already programed that for you somewhere? Perhaps latex.cph? I have the coefficients with coef(). How do I do that? Thanks, David Biau. -- David Winsemius, MD West Hartford, CT __ 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] an issue about missing data
library(GenABEL) gs.b - gs ok - complete.cases(g...@phdata[,c('sex','age','b.dbp','b.bmi')]) gs.b - gs.b[ok] g...@phdata - g...@phdata[,c('id','sex','age','b.dbp','b.bmi')] index=1:g...@gtdata@nsnps ran.snp=sample(index,261,replace=F) gs.b.gkin=ibs(gs.b[,ran.snp], weight=freq) attach(g...@phdata) age2 - age^2 age3 - age^3 ##lm.bmi - lm(bmi~age+age2+age3+sex) ##step.bmi - step(lm.bmi) ##bmi.adj - residuals(step.bmi) h2.gs.b - polygenic(b.dbp~age+age2+age3+sex+b.bmi, kin=gs.b.gkin, data=gs.b) ## Hi, david, above is my code. So I first removed the 3 individuals who have some missing data, then I performed the polygenic function with the complete data. thanks, karena -- View this message in context: http://r.789695.n4.nabble.com/an-issue-about-missing-data-tp2315094p2315536.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] How to extract se(coef) from cph?
if the cph model fit is m1, you can try sqrt(diag(m1$var)) This is coded in print.cph.fit (library(rms)) On 08/05/2010 04:03 PM, Biau David wrote: Hello, I am modeling some survival data wih cph (Design). I have modeled a predictor which showed non linear effect with restricted cubic splines. I would like to retrieve the se(coef) for other, linear, predictors. This is just to make nice LateX tables automatically. I have the coefficients with coef(). How do I do that? Thanks, David Biau. [[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. -- Abhijit Dasgupta, PhD Director and Principal Statistician ARAASTAT Ph: 301.385.3067 E: adasgu...@araastat.com W: http://www.araastat.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.