[R] gettng the row number based on column conditions
Hi all, I would like to get the row numbers in X where col1 and col2 are both 1 I tried this: which(X[,c(1,2)]==1) but it gives me the row numbers where either col1 or col2 = 1 What should I do? Thank you. -- View this message in context: http://r.789695.n4.nabble.com/gettng-the-row-number-based-on-column-conditions-tp3041549p3041549.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] gettng the row number based on column conditions
Hi, You should use the logical and, i.e., to tell R that you need condition 1 (first column equals 1) AND condition 2 (second column equals 1) to be true: which(X[, 1] == 1 X[, 2] == 1) HTH, Josh On Sun, Nov 14, 2010 at 12:39 AM, gtg maif...@gmail.com wrote: Hi all, I would like to get the row numbers in X where col1 and col2 are both 1 I tried this: which(X[,c(1,2)]==1) but it gives me the row numbers where either col1 or col2 = 1 What should I do? Thank you. -- View this message in context: http://r.789695.n4.nabble.com/gettng-the-row-number-based-on-column-conditions-tp3041549p3041549.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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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 permanently remove [Previously saved workspace restored]
Good afternoon, I am actually concerned with this issue too. What if I run R at work and I simply do not have the necessary access-rights in order to delete the .Rdata file. Do I really have only 3 choices: ask the admin to delete it, live with it always reloading the previous workspace, resave an empty workspace. That'd be sad if it really was like that... 2010/11/14 Peter Langfelder peter.langfel...@gmail.com On Sat, Nov 13, 2010 at 10:33 PM, Stephen Liu sati...@yahoo.com wrote: Win 7 64 bit R version 2.11.1 (2010-05-31) How to permanently remove; [Previously saved workspace restored] rm (list = ls( )) On next start it still displays; . [Previously saved workspace restored] There is a file keeping the previous data on Linux .Rdata To the best of my knowledge there's an .RData file on Windows as well. Check your default directory (usually Documents but may be something else - start R as usual and type getwd() before you do anything). Remove the .RData file as well the file .Rhistory and you should be good to go. Peter __ 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] Reverting to previous version
not sure about Mac but in windows simply reinstalling the old version will work. Different version of R are installed in different directories. -- View this message in context: http://r.789695.n4.nabble.com/Reverting-to-previous-version-tp3040344p3041572.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 permanently remove [Previously saved workspace restored]
On Sun, 14 Nov 2010, Yuliya Matveyeva wrote: Good afternoon, I am actually concerned with this issue too. What if I run R at work and I simply do not have the necessary access-rights in order to delete the .Rdata file. Do I really have only 3 choices: ask the admin to delete it, live with it always reloading the previous workspace, resave an empty workspace. That'd be sad if it really was like that... It isn't. Please do read 'An Introduction to R': you can start R with --no-restore. And BTW rm (list = ls( )) isn't correct: it needs to be rm (list = ls(all=TRUE)) However, I suspect that YM is starting R with a non-writable working directory, and (on Windows) the suggestion is that you create a new shortcut with the working directory (the 'Start in' property) changed to the base directory of your project. We've seen instances with an all-users adminstrator install of R on Windows 7 (but not earlier) that non-administrator users cannot edit nor copy the shortcut on their desktop. This seems to be a bug in Windows, so simply create a new one to (e.g.) c:/Program Files/R/R-2.12.0/bin/i386/Rgui.exe 2010/11/14 Peter Langfelder peter.langfel...@gmail.com On Sat, Nov 13, 2010 at 10:33 PM, Stephen Liu sati...@yahoo.com wrote: Win 7 64 bit R version 2.11.1 (2010-05-31) How to permanently remove; [Previously saved workspace restored] rm (list = ls( )) On next start it still displays; . [Previously saved workspace restored] There is a file keeping the previous data on Linux .Rdata To the best of my knowledge there's an .RData file on Windows as well. Check your default directory (usually Documents but may be something else - start R as usual and type getwd() before you do anything). Remove the .RData file as well the file .Rhistory and you should be good to go. Peter __ 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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to permanently remove [Previously saved workspace restored]
Hi, On Sun, Nov 14, 2010 at 1:14 AM, Yuliya Matveyeva yu...@statmod.ru wrote: Good afternoon, I am actually concerned with this issue too. What if I run R at work and I simply do not have the necessary access-rights in order to delete the .Rdata One wonders how it was created in the first place; with write privileges almost always come delete privileges. file. Do I really have only 3 choices: ask the admin to delete it, live with it always reloading the previous workspace, resave an empty workspace. That'd be sad if it really was like that... There are always more options, but they may not be more pleasant. Here are some examples: 1) Start R in a different directory 2) Rename the .Rdata file 3) Move the .Rdata file out of R's starting directory 4) add --vanilla to your start R command (also useful if your .Rdata file is corrupt or you want to avoid using your .Rprofile file for some reason) 5) Stop using R (though this seems a little extreme) [snip] -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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] Do loop
Hi r-help-boun...@r-project.org napsal dne 13.11.2010 16:17:47: Re: [R] Do loop Gud evening sir ,I want do the cluster analysis algorithm in r software can u guide me sir ??cluster gives you bunch of methods My mail id is :sundars...@gmail.com And I want the brief explanation to for,do.while,if etc loops and conditions. Use C or similar. Regards Petr Thank you sir. [[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] How to permanently remove [Previously saved workspace restored]
Hi folks, Tks for your advice. Summing up all your advice I performed following steps without success. 1) rm (list = ls( )) q() save working image 2) rm (list = ls(all=TRUE)) q() save working image 3) getwd() [1] C:/Users/satimis .Rhistory list.files(path=C:\Users\satimis, all.files = FALSE) Error: '\U' used without hex digits in character string starting C:\U list.files(path=C:\Users\satimis, all.files = TRUE) Error: '\U' used without hex digits in character string starting C:\U - Windows Explorer delete .Rhistory manually Start R [Previously saved workspace restored] is still there Please advise. TIA B.R. Stephen L - Original Message From: Stephen Liu sati...@yahoo.com To: r-help@r-project.org Sent: Sun, November 14, 2010 2:33:21 PM Subject: [R] How to permanently remove [Previously saved workspace restored] Win 7 64 bit R version 2.11.1 (2010-05-31) How to permanently remove; [Previously saved workspace restored] rm (list = ls( )) On next start it still displays; . [Previously saved workspace restored] There is a file keeping the previous data on Linux .Rdata How about on Windows? TIA B.R. Stephen L __ 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] How to permanently remove [Previously saved workspace restored]
On Sun, Nov 14, 2010 at 2:00 AM, Stephen Liu sati...@yahoo.com wrote: Hi folks, Tks for your advice. Summing up all your advice I performed following steps without success. 1) rm (list = ls( )) q() save working image 2) rm (list = ls(all=TRUE)) q() save working image 3) getwd() [1] C:/Users/satimis .Rhistory list.files(path=C:\Users\satimis, all.files = FALSE) Error: '\U' used without hex digits in character string starting C:\U You need to either escape the backslashes (with another backslash) or use forward slashes. Perhaps most simply: list.files(path = getwd(), all.files = FALSE) list.files(path=C:\Users\satimis, all.files = TRUE) Error: '\U' used without hex digits in character string starting C:\U - Windows Explorer delete .Rhistory manually don't forget the .Rdata file, history is separate. Start R [Previously saved workspace restored] is still there Please advise. TIA Sure the message is there but it should have restored an empty workspace so it should have absolutely no impact on your work. If the message really bugs you, add the --vanilla flag when you start R. If you are using a shortcut to R, you can add it there, if you start R from the command prompt you can use it directly just like R --vanilla. Josh B.R. Stephen L [snip] __ 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 find names referring to parts of an R object. particlualry w.r.t capscale
This is both a very general, and a specific question. either answer will help me a lot. I know the object$part syntax is used to retrieve parts of an object for instance myMantel$signif will return the the p value of mantel() and myMantel$statistic the mantel r. Is there any way of listing such components of all objects. at the moment I would like to be able to extract the variance, p value etc for a capscle to tabulate the automatically but would also like to know if the re is a simple way to establish the way to refer to all individual sub parts of a object? thanks Nevil Amos __ 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] jackknife-after-bootstrap
Hi dear all, Can someone help me about detection of outliers using jackknife after bootstrap algorithm? -- View this message in context: http://r.789695.n4.nabble.com/jackknife-after-bootstrap-tp3041634p3041634.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] How to permanently remove [Previously saved workspace restored]
Hi Joshua, list.files(path = getwd(), all.files = TRUE) [1] . [2] .. [3] .RData [4] .Rhistory [5] AppData [6] Application Data [7] Contacts [8] Cookies [9] Desktop [10] Documents [11] Downloads [12] Favorites [13] Links [14] Local Settings [15] Music [16] My Documents [17] NetHood [18] NTUSER.DAT [19] ntuser.dat.LOG1 [20] ntuser.dat.LOG2 [21] NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf [22] NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer0001.regtrans-ms [23] NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer0002.regtrans-ms [24] ntuser.ini [25] Pictures [26] PrintHood [27] R [28] Recent [29] Saved Games [30] Searches [31] SendTo [32] Start Menu [33] Templates [34] Videos .Rhistory and .RDate are there. But I can't find .RDate on Windows Explorer. Only .Rhistory is there. rm (list = ls(all=TRUE)) q() save working image On next start of R [Previously saved workspace restored] still popup B.R. Stephen L - Original Message From: Joshua Wiley jwiley.ps...@gmail.com To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Sun, November 14, 2010 6:31:11 PM Subject: Re: [R] How to permanently remove [Previously saved workspace restored] On Sun, Nov 14, 2010 at 2:00 AM, Stephen Liu sati...@yahoo.com wrote: Hi folks, Tks for your advice. Summing up all your advice I performed following steps without success. 1) rm (list = ls( )) q() save working image 2) rm (list = ls(all=TRUE)) q() save working image 3) getwd() [1] C:/Users/satimis .Rhistory list.files(path=C:\Users\satimis, all.files = FALSE) Error: '\U' used without hex digits in character string starting C:\U You need to either escape the backslashes (with another backslash) or use forward slashes. Perhaps most simply: list.files(path = getwd(), all.files = FALSE) list.files(path=C:\Users\satimis, all.files = TRUE) Error: '\U' used without hex digits in character string starting C:\U - Windows Explorer delete .Rhistory manually don't forget the .Rdata file, history is separate. Start R [Previously saved workspace restored] is still there Please advise. TIA Sure the message is there but it should have restored an empty workspace so it should have absolutely no impact on your work. If the message really bugs
[R] Fetching data
Dear all R users, I am wondering is there any procedure exists on R to fetch data directly from http://www.ncdex.com/Market_Data/Spot_price.aspx; and save it in some time series object, without filling any field in that website. Can somebody point me whether it is possible? Thanks and regards, [[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] Full path to currently executed script file
I am looking for a way to determine the full filepath to the currently executed script. Any ideas? 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] problem with chartSeries
Hi All, I came across some trouble with this function when trying to plot intraday data. I can't manage to plot candelsticks I get a line instead and I don't understand why. I put below data sample and code. head(x) open high low close 2010-10-27 08:59:59 13821 13824 13818 13824 2010-10-27 09:05:00 13823 13830 13823 13830 2010-10-27 09:09:59 13829 13831 13828 13829 2010-10-27 09:15:00 13828 13829 13824 13824 2010-10-27 09:19:59 13825 13826 13817 13817 2010-10-27 09:25:00 13816 13822 13816 13822 2010-10-27 09:30:00 13821 13822 13809 13816 2010-10-27 09:34:59 13816 13816 13811 13815 2010-10-27 09:40:00 13815 13816 13808 13810 2010-10-27 09:44:59 13810 13812 13804 13811 The below code gives me a line chart instead of candlestick. I can't figure out why??? chartSeries(x, TA = NULL, theme = chartTheme('black'), up.col = 'white', dn.col = 'tomato', type = candlesticks, name = EUR, minor.ticks=FALSE) the x object seems to have the right attributes (see below) class(x) [1] xts zoo head(index(x)) [1] 2010-10-27 08:59:59 CEST 2010-10-27 09:05:00 CEST 2010-10-27 09:09:59 CEST 2010-10-27 09:15:00 CEST [5] 2010-10-27 09:19:59 CEST 2010-10-27 09:25:00 CEST 2010-10-27 09:30:00 CEST 2010-10-27 09:34:59 CEST [9] 2010-10-27 09:40:00 CEST 2010-10-27 09:44:59 CEST Did I miss something obvious? Any help appreciated Thanks -- View this message in context: http://r.789695.n4.nabble.com/problem-with-chartSeries-tp3041637p3041637.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] sum in vector
hy guys i have one question :) i have two vectors markets and price market - c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price - c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041661.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] sum in vector
tapply(price, market, sum) andydol...@gmail.com On 14 November 2010 13:02, lgpeco pavic.o...@gmail.com wrote: hy guys i have one question :) i have two vectors markets and price market - c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price - c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041661.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] sum in vector
Am 14.11.2010 13:02, schrieb lgpeco: hy guys i have one question :) i have two vectors markets and price market- c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price- c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) you could cbind() the vectors and use sum( result[row1==i] ) for market number i, I guess? -- Alexx __ 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 find names referring to parts of an R object. particlualry w.r.t capscale
Use str(object) in order to inspect what elements object consists of. Uwe Ligges On 14.11.2010 12:28, Nevil Amos wrote: This is both a very general, and a specific question. either answer will help me a lot. I know the object$part syntax is used to retrieve parts of an object for instance myMantel$signif will return the the p value of mantel() and myMantel$statistic the mantel r. Is there any way of listing such components of all objects. at the moment I would like to be able to extract the variance, p value etc for a capscle to tabulate the automatically but would also like to know if the re is a simple way to establish the way to refer to all individual sub parts of a object? thanks Nevil Amos __ 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] RCurl and cookies in POST requests
Hello. I know that it's usually possible to write cookies to a cookie file by removing the curl handle and doing a gc() call. I can do this with getURL(), but I just can't obtain the same results with postForm(). If I use: curlHandle - getCurlHandle(cookiefile=FILE, cookiejar=FILE) and then do: getURL(http://example.com/script.cgi, curl=curlHandle) rm(curlHandle) gc() it's OK, the cookie is there. But, if I do (same handle; the parameter is a dummy): postForm(site, .params=list(par=cookie), curl=curlHandle, style=POST) rm(curlHandle) gc() no cookie is written. Probably I'm doing something wrong, but don't know what. Is it possible to store cookies read from the output of a postForm() call? How? Thanks. Christian PS.: I'm attaching a script that can be sourced (and its .txt version). It contains an example. The expected result is a file (cookies.txt) with two cookies. The script currently uses getURL() and two cookies are stored. If postForm() is used (currently commented), only 1 cookie is written. -- SDF Public Access UNIX System - http://sdf.lonestar.org # The script will call no_cookie() if no cookies file exists. # It will then read the cookie XXX (its value is cookie1). # When XXX has been read, it will be written to c_file with # rm(curlHandle) ; gc(). Finally the script will test whether # cookie ZZZ (its value is cookie2) exists. If it doesn't, # then the script will retrive the same URL as before, which # will reply with ZZZ if XXX was sent. # # If XXX and ZZZ are in cookies.txt, this should be removed # to test again (otherwise the script will find both cookies # and won't do anything). library(RCurl) site - http://chr.tx0.org/arch/ml/r/cookie-20101114.cgi; c_file - cookies.txt no_cookie - function() { curlHandle - getCurlHandle(cookiefile=c_file, cookiejar=c_file) getURL(site, curl=curlHandle) rm(curlHandle) gc() } if ( file.exists(c_file) == FALSE ) { file.create(c_file) no_cookie() } cookie_1 - sub(.*(XXX)\t, , grep(XXX,readLines(c_file),value=T)) if ( length(grep(ZZZ,readLines(c_file))) == 0 ) { curlHandle - getCurlHandle(cookiefile=c_file, cookiejar=c_file) # Either getURL OR postForm: aaa - getURL(site, curl=curlHandle) #aaa - postForm(site, .params=list(par=cookie_1), curl=curlHandle, style=POST) # Debug POST: #d = debugGatherer() #postForm(site, .params=list(par=cookie_1), .opts=list(httpheader = c( # header = foo: bar), debugfunction = d$update, verbose=T), # curl=curlHandle, style=POST) #write.table(d$value()[[headerIn]], file=debug_in.txt) #write.table(d$value()[[headerOut]], file=debug_out.txt) rm(curlHandle) gc() } # The script will call no_cookie() if no cookies file exists. # It will then read the cookie XXX (its value is cookie1). # When XXX has been read, it will be written to c_file with # rm(curlHandle) ; gc(). Finally the script will test whether # cookie ZZZ (its value is cookie2) exists. If it doesn't, # then the script will retrive the same URL as before, which # will reply with ZZZ if XXX was sent. # # If XXX and ZZZ are in cookies.txt, this should be removed # to test again (otherwise the script will find both cookies # and won't do anything). library(RCurl) site - http://chr.tx0.org/arch/ml/r/cookie-20101114.cgi; c_file - cookies.txt no_cookie - function() { curlHandle - getCurlHandle(cookiefile=c_file, cookiejar=c_file) getURL(site, curl=curlHandle) rm(curlHandle) gc() } if ( file.exists(c_file) == FALSE ) { file.create(c_file) no_cookie() } cookie_1 - sub(.*(XXX)\t, , grep(XXX,readLines(c_file),value=T)) if ( length(grep(ZZZ,readLines(c_file))) == 0 ) { curlHandle - getCurlHandle(cookiefile=c_file, cookiejar=c_file) # Either getURL OR postForm: aaa - getURL(site, curl=curlHandle) #aaa - postForm(site, .params=list(par=cookie_1), curl=curlHandle, style=POST) # Debug POST: #d = debugGatherer() #postForm(site, .params=list(par=cookie_1), .opts=list(httpheader = c( # header = foo: bar), debugfunction = d$update, verbose=T), # curl=curlHandle, style=POST) #write.table(d$value()[[headerIn]], file=debug_in.txt) #write.table(d$value()[[headerOut]], file=debug_out.txt) rm(curlHandle) gc() } __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem on update
Hi all, Win7 64 bit R version 2.11.1 (2010-05-31) Ran R as admin update.packages(ask='graphics') --- Please select a CRAN mirror for use in this session --- Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows64/contrib/2.11 It is this site in problem? I tried another mirror with same result. TIA B.R. Stephen L __ 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] About upgrade R
Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ 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] Sweave question
On 13/11/2010 10:31 PM, Ralf B wrote: Thank you. The article you cited explains on the last page how this is done and shows how Sweave is run from within R and it says that it creates the .tex file. My last remaining question is now if there is a way to execute this Sweave tex output by executing Latex from R. In other words, what is the command to execute latex from within R. Or do I perhaps think to complcated and there is a single command to create the tex and the pdf/ps in a single step? At the end, I would like to create everything between the Sweave document and the final pdf/ps output from within R without the need to make external calls. See SweavePDF() in the patchDVI package on R-forge. Duncan Murdoch Ralf On Sat, Nov 13, 2010 at 4:29 PM, Johannes Huesingjohan...@huesing.name wrote: Ralf Bralf.bie...@gmail.com [Sat, Nov 13, 2010 at 10:03:49PM CET]: It seems that Sweave is supposed to be used from Latex and R is called during the LaTeX compilation process whenever R chunks appear. This is not how it works. In the first page of http://www.statistik.lmu.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf that the file is first processed by R before it can be typeset by LaTeX. What about the other way round? I would like to run it triggered by R. Is this possible? To my understanding this is how it's done. I understand that this does not correspond to the idea of literate programming since it means that there is R code running outside the document, You lost me here. but for my practical approach, I would like to use Sweave more like a report extension at the end of my already existing R scripts that combined a number of diagrams to a pdf file. My second question is, does Sweave create a potential performance bottleneck when used with very big data analysis compared with when using R directly? Not really, because the only overhead is tangling the Sweave file. If it is very big, you may want to process only the parts you have changed last. The package weaver seems to come in handy then, see http://bioconductor.org/packages/2.6/bioc/vignettes/weaver/inst/doc/weaver_howTo.pdf -- Johannes Hüsing There is something fascinating about science. One gets such wholesale returns of conjecture mailto:johan...@huesing.name from such a trifling investment of fact. http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number above the bar?
Check out ggplot2, specifically geom_bar and geom_text. http://had.co.nz/ggplot2/ You have to get used to its syntax, which can take some time, but after that it can make things a lot easier. Here is an example. library(ggplot2) df - data.frame(xvar = factor(c(1, 2)), yvar = c(1, 5)) p - ggplot(df, aes( y=yvar, x=xvar)) p - p + geom_bar( stat=identity) p - p + geom_text(aes(y=yvar+1,label=yvar)) p On Thu, Nov 11, 2010 at 4:03 AM, Joel joda2...@student.uu.se wrote: Hi I got an barplot, and I would like to have the exact number of the bars just above the bars anyone know how to do this? Sorry for bad English, and I do hope that you understand what im after. //Joel -- View this message in context: http://r.789695.n4.nabble.com/Number-above-the-bar-tp3037438p3037438.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] Problem on update
On 14.11.2010 15:34, Stephen Liu wrote: Hi all, Win7 64 bit R version 2.11.1 (2010-05-31) Ran R as admin update.packages(ask='graphics') --- Please select a CRAN mirror for use in this session --- Here you selected a CRAN mirror. Fine. Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows64/contrib/2.11 Actually this thing is the CRAN extras repository maintained by Broan Ripley which does not have any mirrors. R-2.11.x in 64-bit was the very first and interim 64-bit solution under Windows. With the release of R-2.12.0 we stopped supporting the 64-bit version of R-2.11.x since we can handle 64-bit much easier now. So please upgrade to R-2.12.x which will probably have the usual support again. Best wishes, Uwe Ligges It is this site in problem? I tried another mirror with same result. TIA B.R. Stephen L __ 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] sum in vector
Have a look at the reshape2 package. http://had.co.nz/reshape/ reshape2 is, to the user a slight modification of rehape but the author says it is much faster. The code below seems to do what you want. - xx - data.frame(market, price) library(reshape2) yy - melt(xx, id=1) dcast(yy, market ~ variable, sum) - --- On Sun, 11/14/10, lgpeco pavic.o...@gmail.com wrote: From: lgpeco pavic.o...@gmail.com Subject: [R] sum in vector To: r-help@r-project.org Received: Sunday, November 14, 2010, 7:02 AM hy guys i have one question :) i have two vectors markets and price market - c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price - c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041661.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] About upgrade R
Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ 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] Define a glm object with user-defined coefficients (logistic regression, family=binomial)
On Nov 14, 2010, at 8:35 AM, Jürgen Biedermann wrote: Hi David, Thank you very much for your answer. It helps me a lot. The offset argument was the key (I didn't understand the description in the R- help file) Rereading my email I found a mistake in the definition of my formula. Instead of p(y) = exp(a + c1*x1 + c2*x2), it has to be: p(y) = exp(a + c1*x1 + c2*x2)/(1+exp(a + c1*x1 + c2*x2)), but actually that doesn't matter much in our case. Oh, but I think it does matter (at least in the situation where p(event) are above 1/20 or so. At lower probabilities it wouldn't matter very much. You are posting above the default logistic equation used when the distribution is specified as binomial which I meant to include but forgot. Had I remembered to include the ..., family=binomial it would have implied what you write above. So: firstfit - glm( c(event,no_event) ~ 1 + x1 +x2, data=dfrm, family=binomial) # Is the model you cite above and I meant to write: forcedfit - glm( c(event,no_event) ~ 1 + offset(logoff), data=dfrm, family=binomial) (I think the only reason this went unremarked by the usually eagle- eyed rhelp viewership is the weekend has a decreased viewing activity.) The anova results would have not much interpretability in this setting. You would be testing for the Intercept being zero under very artificial conditions. You have eliminated much statistical meaning by forcing the form of the results. Imagine the following. I develop a model on one dataset and want to validate it on another. So I could use the coefficents trained on the first dataset to define a glm model (named: ModelV) on the second dataset. Then i could test this model against a NULL model (named: ModelV0) of the second dataset with anova(ModelV, ModelV0, test=Chisq). Assuming this is a split dataset from run 1 in a split datast, why not develop a score from the the first set and run it against a model that includes the score and the original variables. Model 1: mod1 - glm( c(event,no_event) ~ 1 + x1 +x2, data=dfrm1) dfrm2$scr1 - with(dfrm2, Intercept + c1*x1 + c2*x2)) Model2: mod2 - glm( c(event,no_event) ~ 0 + x1 +x2 +scr1, data=dfrm2) (In this manner impact from the deviations induced by varying X values would be assessed as evidence of potential model mis-specification. This would be most successful with larger datasets. It would probably be a better use of a smaller dataset, however, to get a bootstrapped validation of a model. Or to do a one-tenth holdout and do the validations run ten times. Harrells' Regression Modeling Strategies gives a good discussion of validation strategies and his rms amd Hmisc packages provide the functions to perform the validation and display results neatly.) Best Wishes Jürgen -- --- Jürgen Biedermann Blücherstraße 56 10961 Berlin-Kreuzberg Mobil: +49 176 247 54 354 Home: +49 30 250 11 713 e-mail: juergen.biederm...@gmail.com - Korrespondenz -- Betreff: Re: [R] Define a glm object with user-defined coefficients (logistic regression, family=binomial) Von: David Winsemius dwinsem...@comcast.net An: Jürgen Biedermann juergen.biederm...@googlemail.com Datum: 13.11.2010 17:15 On Nov 13, 2010, at 7:43 AM, Jürgen Biedermann wrote: Hi there, I just don't find the solution on the following problem. :( Suppose I have a dataframe with two predictor variables (x1,x2) and one depend binary variable (y). How is it possible to define a glm object (family=binomial) with a user defined logistic function like p(y) = exp(a + c1*x1 + c2*x2) where c1,c2 are the coefficents which I define. So I would like to do no fitting of the coefficients. Still, I would like to define a GLM object because I could then easily use other functions which need a glm object as argument (e.g. I could use the anova, The anova results would have not much interpretability in this setting. You would be testing for the Intercept being zero under very artificial conditions. You have eliminated much statistical meaning by forcing the form of the results. summary functions). # Assume dataframe name is dfrm with variables event, no_event, x1, x2, and further assume c1 and c2 are also defined: dfrm$logoff - with(dfrm, log(c1*x1 + c2*x2)) forcedfit - glm( c(event,no_event) ~ 1 + offset(logoff), data=dfrm) (Obviously untested.) Thank you very much! Greetings Jürgen -- --- Jürgen Biedermann David Winsemius, MD West Hartford, CT 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] How to permanently remove [Previously saved workspace restored]
On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liu sati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). You can adjust this behavior in the folder options (if the idea of protected/hidden files and folder options all sounds new to you, now is a great opportunity to spend some time exploring your operating system, learning how it works and how to use it at a more serious level than the basic user it assumesGoogle is your friend here, there are literally thousands of articles, walkthroughs, and tutorials on different aspects of Windows). rm (list = ls(all=TRUE)) This does NOT delete the workspace, it just clears your worksapce of any objects. q() save working image Now you will have saved your current worksapce (which if you just used rm() as above, will be empty, but still there). On next start of R [Previously saved workspace restored] still popup Now you probably just restored an empty workspace. This is not a problem, it is normal R behavior and is a sign that everything is working as expected. B.R. Stephen L __ 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] replace a row in a matrix
Dear all, I created a n*2 matrix and I want to replace the ith row with a vector. Can anyone suggest me what is the simple way to do it? Sorry for bothering you with such simple question. I appreciate any hints or advice. Thanks in advance. Cassie [[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] kalman filter
Hello, I would like use Kalman filter for estimating parameters of a stochastic model. I have developed the state space model but I dont know the correct way use Kalman filter for parameter estimation. Has anybody experience in work with Kalman filter in R. I dont know the correct function. Maybe it is - KalmanLike; but what is the correct Input? - tsmooth? - kfilter? Thanks for helping. I have ask the same question in the help list sig-dynamic-models Best, Thomas [[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] Define a glm object with user-defined coefficients (logistic regression, family=binomial)
Hi David, Thank you very much for your answer. It helps me a lot. The offset argument was the key (I didn't understand the description in the R-help file) Rereading my email I found a mistake in the definition of my formula. Instead of p(y) = exp(a + c1*x1 + c2*x2), it has to be: p(y) = exp(a + c1*x1 + c2*x2)/(1+exp(a + c1*x1 + c2*x2)), but actually that doesn't matter much in our case. The anova results would have not much interpretability in this setting. You would be testing for the Intercept being zero under very artificial conditions. You have eliminated much statistical meaning by forcing the form of the results. Imagine the following. I develop a model on one dataset and want to validate it on another. So I could use the coefficents trained on the first dataset to define a glm model (named: ModelV) on the second dataset. Then i could test this model against a NULL model (named: ModelV0) of the second dataset with anova(ModelV, ModelV0, test=Chisq). Best Wishes Jürgen -- --- Jürgen Biedermann Blücherstraße 56 10961 Berlin-Kreuzberg Mobil: +49 176 247 54 354 Home: +49 30 250 11 713 e-mail: juergen.biederm...@gmail.com - Korrespondenz -- Betreff: Re: [R] Define a glm object with user-defined coefficients (logistic regression, family=binomial) Von: David Winsemius dwinsem...@comcast.net An: Jürgen Biedermann juergen.biederm...@googlemail.com Datum: 13.11.2010 17:15 On Nov 13, 2010, at 7:43 AM, Jürgen Biedermann wrote: Hi there, I just don't find the solution on the following problem. :( Suppose I have a dataframe with two predictor variables (x1,x2) and one depend binary variable (y). How is it possible to define a glm object (family=binomial) with a user defined logistic function like p(y) = exp(a + c1*x1 + c2*x2) where c1,c2 are the coefficents which I define. So I would like to do no fitting of the coefficients. Still, I would like to define a GLM object because I could then easily use other functions which need a glm object as argument (e.g. I could use the anova, The anova results would have not much interpretability in this setting. You would be testing for the Intercept being zero under very artificial conditions. You have eliminated much statistical meaning by forcing the form of the results. summary functions). # Assume dataframe name is dfrm with variables event, no_event, x1, x2, and further assume c1 and c2 are also defined: dfrm$logoff - with(dfrm, log(c1*x1 + c2*x2)) forcedfit - glm( c(event,no_event) ~ 1 + offset(logoff), data=dfrm) (Obviously untested.) Thank you very much! Greetings Jürgen -- --- Jürgen Biedermann 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] replace a row in a matrix
Hi Cassie, If your matrix is named X, and your vector y, then: X[i, ] - y Please read the documentation for the extraction operator. You can pull this up by entering the following command at the R console: ?[ You would also probably benefit from a careful reading of this manual: http://cran.r-project.org/doc/manuals/R-intro.pdf I know it is 100 pages, but if you are going to use R much at all, the time investment to read through that carefully will pay off (even if it does not all make sense the first time through). Cheers, Josh On Sun, Nov 14, 2010 at 7:59 AM, cassie jones cassiejone...@gmail.com wrote: Dear all, I created a n*2 matrix and I want to replace the ith row with a vector. Can anyone suggest me what is the simple way to do it? Sorry for bothering you with such simple question. I appreciate any hints or advice. Thanks in advance. Cassie [[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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.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] kalman filter
Hi, There are a few packages that I would suggest to run Kalman filter. Take a look at dlm and KFAS. If you need more help you should be more precise in formulating your problem, providing a small example, as required by the posting guide. Best, Giovanni Petris Quoting Garten Stuhl gartenstu...@googlemail.com: Hello, I would like use Kalman filter for estimating parameters of a stochastic model. I have developed the state space model but I dont know the correct way use Kalman filter for parameter estimation. Has anybody experience in work with Kalman filter in R. I dont know the correct function. Maybe it is - KalmanLike; but what is the correct Input? - tsmooth? - kfilter? Thanks for helping. I have ask the same question in the help list sig-dynamic-models Best, Thomas [[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] replace a row in a matrix
Indexing (xx - matrix(1:4, nrow=2)) vec - 5:6 xx[2,] - vec xx --- On Sun, 11/14/10, cassie jones cassiejone...@gmail.com wrote: From: cassie jones cassiejone...@gmail.com Subject: [R] replace a row in a matrix To: r-help@r-project.org Received: Sunday, November 14, 2010, 10:59 AM Dear all, I created a n*2 matrix and I want to replace the ith row with a vector. Can anyone suggest me what is the simple way to do it? Sorry for bothering you with such simple question. I appreciate any hints or advice. Thanks in advance. Cassie [[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] How to permanently remove [Previously saved workspace restored]
Hi Joshua, But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). You can adjust this behavior in the folder options (if the idea of .. I'm aware of the hidden files. [hidden] on properties has not bee checked. Otherwise .Rhistory won't show up. The strange thing is on; - Start - Search RData I can't find .RData. But search on Rhistory found .Rhistory. Would it be .RData not yet created? On next start of R [Previously saved workspace restored] still popup Now you probably just restored an empty workspace. This is not a problem, it is normal R behavior and is a sign that everything is working as expected. Ah I see. Thanks B.R. Stephen L - Original Message From: Joshua Wiley jwiley.ps...@gmail.com To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Sun, November 14, 2010 11:42:37 PM Subject: Re: [R] How to permanently remove [Previously saved workspace restored] On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liu sati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). You can adjust this behavior in the folder options (if the idea of protected/hidden files and folder options all sounds new to you, now is a great opportunity to spend some time exploring your operating system, learning how it works and how to use it at a more serious level than the basic user it assumesGoogle is your friend here, there are literally thousands of articles, walkthroughs, and tutorials on different aspects of Windows). rm (list = ls(all=TRUE)) This does NOT delete the workspace, it just clears your worksapce of any objects. q() save working image Now you will have saved your current worksapce (which if you just used rm() as above, will be empty, but still there). On next start of R [Previously saved workspace restored] still popup Now you probably just restored an empty workspace. This is not a problem, it is normal R behavior and is a sign that everything is working as expected. B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem on update
Hi Uwe, Your advice noted. I'll upgrade R to version 2.12.0 B.R. Stephen L - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Sun, November 14, 2010 11:02:00 PM Subject: Re: [R] Problem on update On 14.11.2010 15:34, Stephen Liu wrote: Hi all, Win7 64 bit R version 2.11.1 (2010-05-31) Ran R as admin update.packages(ask='graphics') --- Please select a CRAN mirror for use in this session --- Here you selected a CRAN mirror. Fine. Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows64/contrib/2.11 Actually this thing is the CRAN extras repository maintained by Broan Ripley which does not have any mirrors. R-2.11.x in 64-bit was the very first and interim 64-bit solution under Windows. With the release of R-2.12.0 we stopped supporting the 64-bit version of R-2.11.x since we can handle 64-bit much easier now. So please upgrade to R-2.12.x which will probably have the usual support again. Best wishes, Uwe Ligges It is this site in problem? I tried another mirror with same result. TIA B.R. Stephen L __ 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] About upgrade R
Hi Uwe, If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) I have following packages installed in addition to R base rcom RExcel statconnDCOM IIRC statconnDCOM and RExcel are on different directories. rcom was installed on repo. I'll run; update.packages(checkBuilt=TRUE) In the worst case I just reinstall abovementioned packages. Any further advice before I start? Thanks B.R. Stephen L - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Sun, November 14, 2010 11:03:57 PM Subject: Re: [R] About upgrade R Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ 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] sum in vector
Try this: rowsum(price, market) On Sun, Nov 14, 2010 at 10:02 AM, lgpeco pavic.o...@gmail.com wrote: hy guys i have one question :) i have two vectors markets and price market - c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price - c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041661.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] How to permanently remove [Previously saved workspace restored]
On 14/11/2010 10:42 AM, Joshua Wiley wrote: On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liusati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch You can adjust this behavior in the folder options (if the idea of protected/hidden files and folder options all sounds new to you, now is a great opportunity to spend some time exploring your operating system, learning how it works and how to use it at a more serious level than the basic user it assumesGoogle is your friend here, there are literally thousands of articles, walkthroughs, and tutorials on different aspects of Windows). rm (list = ls(all=TRUE)) This does NOT delete the workspace, it just clears your worksapce of any objects. q() save working image Now you will have saved your current worksapce (which if you just used rm() as above, will be empty, but still there). On next start of R [Previously saved workspace restored] still popup Now you probably just restored an empty workspace. This is not a problem, it is normal R behavior and is a sign that everything is working as expected. B.R. Stephen L __ 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] About upgrade R
Hi Stephen, I just happened to have upgraded my R today. Tips: 1) Make sure the folder has full permissions so that you'll be able to install/update packages on it. 2) I still find the advices (and code) I gave in that article to be worthwhile. And do pay attention to the directory into which you want to install the packages. Good luck, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Sun, Nov 14, 2010 at 6:28 PM, Stephen Liu sati...@yahoo.com wrote: Hi Uwe, If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) I have following packages installed in addition to R base rcom RExcel statconnDCOM IIRC statconnDCOM and RExcel are on different directories. rcom was installed on repo. I'll run; update.packages(checkBuilt=TRUE) In the worst case I just reinstall abovementioned packages. Any further advice before I start? Thanks B.R. Stephen L - Original Message From: Uwe Ligges lig...@statistik.tu-dortmund.de To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Sun, November 14, 2010 11:03:57 PM Subject: Re: [R] About upgrade R Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to permanently remove [Previously saved workspace re
On 14-Nov-10 16:43:18, Duncan Murdoch wrote: On 14/11/2010 10:42 AM, Joshua Wiley wrote: On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liusati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch That is a nice reply, Duncan, and an excellent explanation of why .Rdata has no name! I also like the final sentence. I would only add: If you're sane, and want to stay sane, think about not using Windows. Ted. E-Mail: (Ted Harding) ted.hard...@wlandres.net Fax-to-email: +44 (0)870 094 0861 Date: 14-Nov-10 Time: 16:58:49 -- XFMail -- __ 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] About upgrade R
wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Ligges lig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] score test for logistic regression
Dear R experts, I'm trying to find a code to calculate the p-value from the score test for the logistic regression. My fit is like this: logit=beta0+beta1*x1+beta2*x2 ++ betak* xk. And my H0 is beta1=beta2=...=betak =0. Any help will be highly appreciated. Thank you! Ying __ 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] score test for logistic regression
On Nov 14, 2010, at 11:29 AM, Wang, Ying wrote: Dear R experts, I'm trying to find a code to calculate the p-value from the score test for the logistic regression. My fit is like this: logit=beta0+beta1*x1+beta2*x2 ++ betak* xk. And my H0 is beta1=beta2=...=betak =0. Any help will be highly appreciated. Thank you! Which score test do you want? -- 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] Integrate to 1? (gauss.quad)
Does anyone see why my code does not integrate to 1? library(statmod) mu - 0 s - 1 Q - 5 qq - gauss.quad(Q, kind='hermite') sum((1/(s*sqrt(2*pi))) * exp(-((qq$nodes-mu)^2/(2*s^2))) * qq$weights) ### This does what's it is supposed to myNorm - function(theta) (1/(s*sqrt(2*pi))) * exp(-((theta-mu)^2/(2*s^2))) integrate(myNorm, -Inf, Inf) __ 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 permanently remove [Previously saved workspace restored]
@Stephen Sorry, Duncan's right, it is likely not a protected/hidden file issue. At the risk of nuking the fridge, you could also open an elevated command prompt then navigate to the relevant directory and delete the file: cd C:\Users\satimis del .RData exit Probably too much trouble for deleting a single file, but handy if you want to do a lot (e.g., all files with the *.RData extension or...). The new PowerShell is starting to grow on me too (it seems wider), but I am not as familiar with the commands. Josh On Sun, Nov 14, 2010 at 8:43 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. @Duncan You're right, as usual. I mixed Windows and Linux. Changing the setting for extensions is basically as you described on my Windows 7 except I have to hit the left alt for Windows Explorer to even show the file menu where I can click on Tools - Folder Options (maybe just my configuration). Does .RData get registered by default but not .Rhistory? (since Stephen reported seeing the .Rhistory file). If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch __ 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] About upgrade R
On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] score test for logistic regression
On Nov 14, 2010, at 18:15 , David Winsemius wrote: On Nov 14, 2010, at 11:29 AM, Wang, Ying wrote: Dear R experts, I'm trying to find a code to calculate the p-value from the score test for the logistic regression. My fit is like this: logit=beta0+beta1*x1+beta2*x2 ++ betak* xk. And my H0 is beta1=beta2=...=betak =0. Any help will be highly appreciated. Thank you! Which score test do you want? That's actually pretty well-defined, David. The score test is based on calculating the efficient scores, aka the derivative of the likelihood, at the MLE under the null hypothesis, and measuring it in the x'Ax sense, where A is the inverse expected Fisher information. It is very similar to the Wald test but things get evaluated under the null rather than the alternative. In GLM's with canonical links, there is a straightforward connection to the first weighted regression step taking you from the maximum under the null towards the maximum under the alternative. Now, coercing R to generate the score tests is not _entirely_ trivial, since you need to pick glm()-related code and objects apart in exactly the right way, and I'm afraid that I don't know any pre-cooked codes for it. -- 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. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] as.matrix behaves weird
Hi, can someone tell me why x is still a 2x1-matrix in the last step? x - 1:2 x [1] 1 2 t(x) [,1] [,2] [1,]12 x - as.matrix(x,ncol=2) x [,1] [1,]1 [2,]2 I figured out that if I use x - matrix(x,ncol=2), instead of as.matrix(), it works fine. What exactly is the difference between matrix() and as.matrix() here? The help file describes the two functions with different words, but the essence sounds like the same to me. Thanks in advance, Alex __ 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] dnorm and qnorm
Thank you all for the great help. I think the optimize function and approach solves my problem well. Edwin Sun -- View this message in context: http://r.789695.n4.nabble.com/dnorm-and-qnorm-tp3040427p3041962.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] as.matrix behaves weird
ncol is not an argument for as.matrix() Alexx Hardt mikrowelle1234 at gmx.de writes: Hi, can someone tell me why x is still a 2x1-matrix in the last step? __ 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] sum in vector
to be more general you can also use aggregate: aggregate(price,list(market),sum) Henrique Dallazuanna wrote: Try this: rowsum(price, market) On Sun, Nov 14, 2010 at 10:02 AM, lgpeco pavic.o...@gmail.com wrote: hy guys i have one question :) i have two vectors markets and price market - c(1, 5, 7, 9, 9, 6, 5, 4, 4, 3, 1, 2, 1) price - c(100, 20, 30, 10, 50, 23, 23, 33, 96, 6, 4, 38, 96) i would like sum prices: market 1: (100+4+96), market 2: (38),..., market 9: (10+50) ao i would like get this result: (200, 38, ..., 60) and i don't wanna use while, for loops... is there any other function to sum these :) tnx for helping ;) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041661.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. -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3041991.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] R package 'np' problems
Hi List, I'm trying to get a density estimate for a point of interest from an npudens object created for a sample of points. I'm working with 4 variables in total (3 continuous and 1 unordered discrete - the discrete variable is the character column in training.csv). When I try to evaluate the density for a point that was not used in the training dataset, and when I extract the fitted values from the npudens object itself, I'm getting values that are much greater than 1 in some cases, which, if I understand correctly, shouldn't be possible considering a pdf estimate can only be between 0 and 1. I think I must be doing something wrong, but I can't see it. Attached I've included the training data (training.csv) and the point of interest (origin.csv); below I've included the code I'm using and the results I'm getting. I also don't understand why, when trying to evaluate the npudens object at one point, I'm receiving the same set of fitted values from the npudens object with the predict() function. It should be noted that I'm indexing the dataframe of training data in order to get samples of the df for density estimation (the samples are from different geographic locations measured on the same set of variables; hence my use of sub-setting by [i] and removing columns from the df before running the density estimation). Moreover, in the example I'm providing here, the point of interest does happen to come from the training dataset, but I'm receiving the same results when I compare the point of interest to samples of which it is not a part (density estimates that are either extremely small, which is acceptable, or much greater than one, which doesn't seem right to me). Any thoughts would be greatly appreciated, Chris fitted(npudens(tdat=training_df[training_cols_select][training_df$cat == i,])) [1] 7.762187e+18 9.385532e+18 6.514318e+18 7.583486e+18 6.283017e+18 [6] 6.167344e+18 9.820551e+18 7.952821e+18 7.882741e+18 1.744266e+19 [11] 6.653258e+18 8.704722e+18 8.631365e+18 1.876052e+19 1.995445e+19 [16] 2.323802e+19 1.203780e+19 8.493055e+18 8.485279e+18 1.722033e+19 [21] 2.227207e+19 2.177740e+19 2.168679e+19 9.329572e+18 9.380505e+18 [26] 1.023311e+19 2.109676e+19 7.903112e+18 7.935457e+18 8.91e+18 [31] 8.899827e+18 6.265440e+18 6.204720e+18 6.276559e+18 6.218002e+18 npu_dens - npudens(tdat=training_df[training_cols_select][training_df$cat == i,]) summary(npu_dens) Density Data: 35 training points, in 4 variable(s) aster_srtm_aspect aster_srtm_dem_filled aster_srtm_slope Bandwidth(s): 29.22422 2.500559e-24 3.111467 class_unsup_pc_iso Bandwidth(s): 0.2304616 Bandwidth Type: Fixed Log Likelihood: 1531.598 Continuous Kernel Type: Second-Order Gaussian No. Continuous Vars.: 3 Unordered Categorical Kernel Type: Aitchison and Aitken No. Unordered Categorical Vars.: 1 predict(npu_dens,newdata=origin[training_cols_select])) [1] 7.762187e+18 9.385532e+18 6.514318e+18 7.583486e+18 6.283017e+18 [6] 6.167344e+18 9.820551e+18 7.952821e+18 7.882741e+18 1.744266e+19 [11] 6.653258e+18 8.704722e+18 8.631365e+18 1.876052e+19 1.995445e+19 [16] 2.323802e+19 1.203780e+19 8.493055e+18 8.485279e+18 1.722033e+19 [21] 2.227207e+19 2.177740e+19 2.168679e+19 9.329572e+18 9.380505e+18 [26] 1.023311e+19 2.109676e+19 7.903112e+18 7.935457e+18 8.91e+18 [31] 8.899827e+18 6.265440e+18 6.204720e+18 6.276559e+18 6.218002e+18 __ 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] as.matrix behaves weird
On Sun, 14 Nov 2010, Feng Mai wrote: ncol is not an argument for as.matrix() Perhaps this is more than Alexx wanted to know, but ... Things can get a wee bit tricky when the function is a 'generic'. More precisely: 'ncol' is not an argument for any method for as.matrix() that is on your search path. as.matrix(x,...) is an S3 generic function. try methods( as.matrix ) and you will see what methods are available for it. And some do have arguments other than 'x': args( as.matrix.data.frame ) function (x, rownames.force = NA, ...) NULL If you wanted to (but you don't, this is just didactic) you could make a method that accepts the ncol arg for a particular class as.matrix.columned - function(x,ncol=1) matrix(x,ncol=ncol) x - 1:3 class(x) - 'columned' as.matrix(x, ncol=3) [,1] [,2] [,3] [1,]123 HTH, Chuck Alexx Hardt mikrowelle1234 at gmx.de writes: Hi, can someone tell me why x is still a 2x1-matrix in the last step? __ 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. Charles C. BerryDept of Family/Preventive Medicine cbe...@tajo.ucsd.eduUC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] sum in vector
Hi all, On Sun, Nov 14, 2010 at 10:06 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this: rowsum(price, market) does it work with multiple factors/groups ? using multiple factors such as c(factor1,factor2,factor3,...) as second arg with rowsum() doesnt seem to work! am i missing something ? regards KM __ 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] Integrate to 1? (gauss.quad)
I don't know about the statmod package and the gauss.quad function but generally the definition of Gauss-Hermite quadrature is with respect to the function that is multiplied by exp(-x^2) in the integrand. So your example would reduce to summing the weights. On Sun, Nov 14, 2010 at 11:18 AM, Doran, Harold hdo...@air.org wrote: Does anyone see why my code does not integrate to 1? library(statmod) mu - 0 s - 1 Q - 5 qq - gauss.quad(Q, kind='hermite') sum((1/(s*sqrt(2*pi))) * exp(-((qq$nodes-mu)^2/(2*s^2))) * qq$weights) ### This does what's it is supposed to myNorm - function(theta) (1/(s*sqrt(2*pi))) * exp(-((theta-mu)^2/(2*s^2))) integrate(myNorm, -Inf, Inf) __ 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] JGR install problem
thanks! i installed and it can run already. -- View this message in context: http://r.789695.n4.nabble.com/JGR-install-problem-tp3039013p3041935.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] GeneGobi
Recently, i saw lot of news about GeneGobi. Anyone know where to download and how install it? -- View this message in context: http://r.789695.n4.nabble.com/GeneGobi-tp3041938p3041938.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] Correction on last post
Hi again List, By 'discrete' variable in the last email, I meant 'categorical'. Also, the data I sent is one of the samples of the main data frame, which I mentioned in a round-about way, but I thought that it might be confusing after reading the email again. Thanks again for any help, Chris [[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] About upgrade R
The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ r-h...@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-h...@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-h...@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. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problems loading xlsx
Hi all, I am trying to run the package xlsx to read Excel 2007 files and I am getting the error below. library(xlsx) Loading required package: xlsxjars Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'xlsxjars', details: call: .jinit() error: cannot obtain Class.getSimpleName method ID Error: package 'xlsxjars' could not be loaded By looking up this in the mailing list I have seen that it is an error related to the configuration of the path. I was also made aware that the path read into R gets truncated if it is too long. To avoid any issue I have added the jre at the very beginning of the path - see below p = Sys.getenv(PATH) strsplit(p,;) $PATH [1] c:\\Program Files\\Java\\j2re1.4.2_06\\bin\\client\\ [2] c:\\Program Files\\Java\\jre1.5.0_06\\bin\\client\\ [3] c:\\oracle\\ora92\\bin\\ [4] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\ [5] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\client\\ [6] c:\\program files\\oracle\\jre\\1.3.1\\bin\\ [7] C:\\WINDOWS\\system32 [8] C:\\WINDOWS In the path variable the items have been pasted like this: c:\Program Files\Java\j2re1.4.2_06\bin\client\;c:\Program Files\Java\jre1.5.0_06\bin\client\; The issue still persists. Can you please help? Thanks Paolo [[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] About upgrade R
update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ r-h...@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-h...@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-h...@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. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis A big computer, a complex algorithm and a long time does not equal science. -Robert Gentleman __ 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] Problems loading xlsx
Hi all, I am trying to run the package xlsx to read Excel 2007 files and I am getting the error below. library(xlsx) Loading required package: xlsxjars Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'xlsxjars', details: call: .jinit() error: cannot obtain Class.getSimpleName method ID Error: package 'xlsxjars' could not be loaded By looking up this in the mailing list I have seen that it is an error related to the configuration of the path. I was also made aware that the path read into R gets truncated if it is too long. To avoid any issue I have added the jre at the very beginning of the path - see below p = Sys.getenv(PATH) strsplit(p,;) $PATH [1] c:\\Program Files\\Java\\j2re1.4.2_06\\bin\\client\\ [2] c:\\Program Files\\Java\\jre1.5.0_06\\bin\\client\\ [3] c:\\oracle\\ora92\\bin\\ [4] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\ [5] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\client\\ [6] c:\\program files\\oracle\\jre\\1.3.1\\bin\\ [7] C:\\WINDOWS\\system32 [8] C:\\WINDOWS In the path variable the items have been pasted like this: c:\Program Files\Java\j2re1.4.2_06\bin\client\;c:\Program Files\Java\jre1.5.0_06\bin\client\; The issue still persists. Can you please help? Thanks Paolo [[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] About upgrade R
Hi John, thank you for that input. It could be that the code I wrote here: http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ Should be updated so every time you install a new R version, you run the code for it to: 1) copy all packages from the old R version to the new R version library 2) update all the packages. But I have no clue how to do step 1. How do you find out the latest R version that was install previous to the current one? And then, how would you find where it's package library is? If you could do this in R, then installing a new version of R could be made simpler for you. Cheers, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Sun, Nov 14, 2010 at 10:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. [[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] sum in vector
thx all for help this function works fine aggregate(price,list(market),sum) i also find another one sapply(x, function) -- View this message in context: http://r.789695.n4.nabble.com/sum-in-vector-tp3041661p3042089.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] cannot see the y-labels (getting cut-off)
Hi All, When I run the following code, I cannot see the entire number. As opposed to seeing 1,000,000,000. I only see 000,000 because the rest is cut off. The cex option doesn't seem to be doing anything at all. y-seq(1e09,5e09,1e09); plot(1:5,y,ylab='',yaxt='n' ); axis(2, at=y, labels=formatC(y,big.mark=,,format=fg),las=2,cex=0.1); Any thoughts? Thanks, Sachin p.s. sorry about corporate notice. --- Please consider the environment before printing this email --- Allianz - Best General Insurance Company of the Year 2010* Allianz - General Insurance Company of the Year 2009+ * Australian Banking and Finance Insurance Awards + Australia and New Zealand Insurance Industry Awards This email and any attachments has been sent by Allianz ...{{dropped:3}} __ 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] interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors
On Sun, Nov 14, 2010 at 6:51 AM, Biau David djmb...@yahoo.fr wrote: Dear R help list, I am modeling some survival data with coxph and survreg (dist='weibull') using package survival. I have 2 problems: 1) I do not understand how to interpret the regression coefficients in the survreg output and it is not clear, for me, from ?survreg.objects how to. Here is an example of the codes that points out my problem: - data is stc1 - the factor is dichotomous with 'low' and 'high' categories slr - Surv(stc1$ti_lr, stc1$ev_lr==1) mca - coxph(slr~as.factor(grade2=='high'), data=stc1) mcb - coxph(slr~as.factor(grade2), data=stc1) mwa - survreg(slr~as.factor(grade2=='high'), data=stc1, dist='weibull', scale=0) mwb - survreg(slr~as.factor(grade2), data=stc1, dist='weibull', scale=0) summary(mca)$coef coef exp(coef) se(coef) z Pr(|z|) as.factor(grade2 == high)TRUE 0.2416562 1.273356 0.2456232 0.9838494 0.3251896 summary(mcb)$coef coef exp(coef) se(coef) z Pr(|z|) as.factor(grade2)low -0.2416562 0.7853261 0.2456232 -0.9838494 0.3251896 summary(mwa)$coef (Intercept) as.factor(grade2 == high)TRUE 7.9068380 -0.4035245 summary(mwb)$coef (Intercept) as.factor(grade2)low 7.5033135 0.4035245 No problem with the interpretation of the coefs in the cox model. However, i do not understand why a) the coefficients in the survreg model are the opposite (negative when the other is positive) of what I have in the cox model? are these not the log(HR) given the categories of these variable? No. survreg() fits accelerated failure models, not proportional hazards models. The coefficients are logarithms of ratios of survival times, so a positive coefficient means longer survival. b) how come the intercept coefficient changes (the scale parameter does not change)? Because you have reversed the order of the factor levels. The coefficient of that variable changes sign and the intercept changes to compensate. 2) My second question relates to the first. a) given a model from survreg, say mwa above, how should i do to extract the base hazard and the hazard of each patient given a set of predictors? With the hazard function for the ith individual in the study given by h_i(t) = exp(\beta'x_i)*\lambda*\gamma*t^{\gamma-1}, it doesn't look like to me that predict(mwa, type='linear') is \beta'x_i. No, it's beta'x_i for the accelerated failure parametrization of the Weibull. In terms of the CDF F_i(t) = F_0( exp((t+beta'x_i)/scale) ) So you need to multiply by the scale parameter and change sign to get the log hazard ratios. b) since I need the coefficient intercept from the model to obtain the scale parameter to obtain the base hazard function as defined in Collett (h_0(t)=\lambda*\gamma*t^{\gamma-1}), I am concerned that this coefficient intercept changes depending on the reference level of the factor entered in the model. The change is very important when I have more than one predictor in the model. As Terry Therneau pointed out recently in the context of the Cox model, there is no such thing as the baseline hazard. The baseline hazard is the hazard when all your covariates are equal to zero, and this depends on how you parametrize. In mwa, zero is grade2=low, in mwb, zero is grade2=high, so the hazard at zero has to be different in the two cases. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland __ 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] Re : interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors
Dear Prof Lumley, This is a very clear, precise, and useful answer to all my questions. Thank you very much. David Biau. De : Thomas Lumley tlum...@uw.edu Cc : r help list r-help@r-project.org Envoyé le : Dim 14 novembre 2010, 23h 54min 23s Objet : Re: [R] interpretation of coefficients in survreg AND obtaining the hazard function for an individual given a set of predictors Dear R help list, I am modeling some survival data with coxph and survreg (dist='weibull') using package survival. I have 2 problems: 1) I do not understand how to interpret the regression coefficients in the survreg output and it is not clear, for me, from ?survreg.objects how to. Here is an example of the codes that points out my problem: - data is stc1 - the factor is dichotomous with 'low' and 'high' categories slr - Surv(stc1$ti_lr, stc1$ev_lr==1) mca - coxph(slr~as.factor(grade2=='high'), data=stc1) mcb - coxph(slr~as.factor(grade2), data=stc1) mwa - survreg(slr~as.factor(grade2=='high'), data=stc1, dist='weibull', scale=0) mwb - survreg(slr~as.factor(grade2), data=stc1, dist='weibull', scale=0) summary(mca)$coef coef exp(coef) se(coef) z Pr(|z|) as.factor(grade2 == high)TRUE 0.2416562 1.273356 0.2456232 0.9838494 0.3251896 summary(mcb)$coef coef exp(coef) se(coef) z Pr(|z|) as.factor(grade2)low -0.2416562 0.7853261 0.2456232 -0.9838494 0.3251896 summary(mwa)$coef (Intercept) as.factor(grade2 == high)TRUE 7.9068380 -0.4035245 summary(mwb)$coef (Intercept) as.factor(grade2)low 7.5033135 0.4035245 No problem with the interpretation of the coefs in the cox model. However, i do not understand why a) the coefficients in the survreg model are the opposite (negative when the other is positive) of what I have in the cox model? are these not the log(HR) given the categories of these variable? No. survreg() fits accelerated failure models, not proportional hazards models. The coefficients are logarithms of ratios of survival times, so a positive coefficient means longer survival. b) how come the intercept coefficient changes (the scale parameter does not change)? Because you have reversed the order of the factor levels. The coefficient of that variable changes sign and the intercept changes to compensate. 2) My second question relates to the first. a) given a model from survreg, say mwa above, how should i do to extract the base hazard and the hazard of each patient given a set of predictors? With the hazard function for the ith individual in the study given by h_i(t) = exp(\beta'x_i)*\lambda*\gamma*t^{\gamma-1}, it doesn't look like to me that predict(mwa, type='linear') is \beta'x_i. No, it's beta'x_i for the accelerated failure parametrization of the Weibull. In terms of the CDF F_i(t) = F_0( exp((t+beta'x_i)/scale) ) So you need to multiply by the scale parameter and change sign to get the log hazard ratios. b) since I need the coefficient intercept from the model to obtain the scale parameter to obtain the base hazard function as defined in Collett (h_0(t)=\lambda*\gamma*t^{\gamma-1}), I am concerned that this coefficient intercept changes depending on the reference level of the factor entered in the model. The change is very important when I have more than one predictor in the model. As Terry Therneau pointed out recently in the context of the Cox model, there is no such thing as the baseline hazard. The baseline hazard is the hazard when all your covariates are equal to zero, and this depends on how you parametrize. In mwa, zero is grade2=low, in mwb, zero is grade2=high, so the hazard at zero has to be different in the two cases. -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland [[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] cannot see the y-labels (getting cut-off)
increase the margins on the plot: par(mar=c(4,7,2,1)) plot(1:5,y,ylab='',yaxt='n' ); axis(2, at=y, labels=formatC(y,big.mark=,,format=fg),las=2,cex=0.1); On Sun, Nov 14, 2010 at 6:03 PM, sachinthaka.abeyward...@allianz.com.au wrote: Hi All, When I run the following code, I cannot see the entire number. As opposed to seeing 1,000,000,000. I only see 000,000 because the rest is cut off. The cex option doesn't seem to be doing anything at all. y-seq(1e09,5e09,1e09); plot(1:5,y,ylab='',yaxt='n' ); axis(2, at=y, labels=formatC(y,big.mark=,,format=fg),las=2,cex=0.1); Any thoughts? Thanks, Sachin p.s. sorry about corporate notice. --- Please consider the environment before printing this email --- Allianz - Best General Insurance Company of the Year 2010* Allianz - General Insurance Company of the Year 2009+ * Australian Banking and Finance Insurance Awards + Australia and New Zealand Insurance Industry Awards This email and any attachments has been sent by Allianz ...{{dropped:3}} __ 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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] Kevin Long wants to stay in touch on LinkedIn
LinkedIn I'd like to add you to my professional network on LinkedIn. - Kevin Long Kevin Long Environmental Scientist at WorleyParsons MEG Calgary, Canada Area Confirm that you know Kevin Long https://www.linkedin.com/e/j2w180-ggikhybj-3x/isd/1903753444/xYvORBoR/ -- (c) 2010, LinkedIn Corporation [[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] L-shaped boxes with lattice graphs?
Can anyone suggest an equivalent, for lattice graphs, of the base graphics argument bty=l? NB that I am leaving off the box around the strip, with a strip function: stripfun - function(which.given,which.panel, factor.levels=as.expression(levlist), ...){ panel.text(x=0, y=0.5, lab = as.expression(levlist[which.panel[which.given]]), adj=0) } e.g. levlist - list(A, B) xyplot(11:14 ~ 1:4 | rep(1:2,2), scales=list(x=list(alternating=c(1,1), relation=sliced)), strip=stripfun, layout=c(1,2)) John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. http://www.maths.anu.edu.au/~johnm __ 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] Problems loading xlsx
If you are running on WIndows, I would suggest that you use the RODBC package and the odbcConnectExcel2007 function. I have had reasonable success with this. On Sun, Nov 14, 2010 at 3:23 PM, Paolo Rossi statmailingli...@googlemail.com wrote: Hi all, I am trying to run the package xlsx to read Excel 2007 files and I am getting the error below. library(xlsx) Loading required package: xlsxjars Loading required package: rJava Error : .onLoad failed in loadNamespace() for 'xlsxjars', details: call: .jinit() error: cannot obtain Class.getSimpleName method ID Error: package 'xlsxjars' could not be loaded By looking up this in the mailing list I have seen that it is an error related to the configuration of the path. I was also made aware that the path read into R gets truncated if it is too long. To avoid any issue I have added the jre at the very beginning of the path - see below p = Sys.getenv(PATH) strsplit(p,;) $PATH [1] c:\\Program Files\\Java\\j2re1.4.2_06\\bin\\client\\ [2] c:\\Program Files\\Java\\jre1.5.0_06\\bin\\client\\ [3] c:\\oracle\\ora92\\bin\\ [4] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\ [5] c:\\oracle\\ora92\\jre\\1.4.2\\bin\\client\\ [6] c:\\program files\\oracle\\jre\\1.3.1\\bin\\ [7] C:\\WINDOWS\\system32 [8] C:\\WINDOWS In the path variable the items have been pasted like this: c:\Program Files\Java\j2re1.4.2_06\bin\client\;c:\Program Files\Java\jre1.5.0_06\bin\client\; The issue still persists. Can you please help? Thanks Paolo [[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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ 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 from data.frame
Can someone please explain the following behavior? df1 and df2 are data.frames. Suppose I want a subset of the rows (observations) using extraction, say just the first row. What I want to know is why if df1 has just one column then df1[1,] returns a vector, whereas if df2 has 2 or more columns then df2[1,] returns a data frame? Why is the single column case different? [[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] Full path to currently executed script file
See findSourceTraceback() in the R.utils package. It's been discussed before, e.g. http://www.mail-archive.com/r-help@r-project.org/msg112375.html http://www.mail-archive.com/r-help@r-project.org/msg111871.html Beware, if you find yourself having to do this, it may be that you are doing something awkward. It is likely that there is a better way to what you are trying achieve. My $.02 /Henrik On Sun, Nov 14, 2010 at 4:31 AM, Ralf B ralf.bie...@gmail.com wrote: I am looking for a way to determine the full filepath to the currently executed script. Any ideas? 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] Extracting from data.frame
Use df[1,,drop=FALSE] if you want the output to be a data.frame, no matter how many columns df has. The effective default value for drop is TRUE if the output has a single column. This does not depend on whether or not you subscripted rows or columns or both. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of James Hirschorn Sent: Sunday, November 14, 2010 4:32 PM To: R-help@r-project.org Subject: [R] Extracting from data.frame Can someone please explain the following behavior? df1 and df2 are data.frames. Suppose I want a subset of the rows (observations) using extraction, say just the first row. What I want to know is why if df1 has just one column then df1[1,] returns a vector, whereas if df2 has 2 or more columns then df2[1,] returns a data frame? Why is the single column case different? [[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] Extracting from data.frame
It's because in this instance R (and S before it) behaves a bit like Microsoft and tries to guess what you really wanted rather than listen to what you asked for. If you ask for a single column from a data frame, e.g. df[,1] then by default this behaves like df[[1]] and you get a single component, no longer a part of the data frame. If you want to ensure you always get a data frame, you need to say so with df[,j, drop = FALSE] If you select a single row from a data frame in general you get a data frame. The exceptin is when the data frame itself only has one column and the dropping convention swings into action once more. The way to avoid this is the same, i.e. df[j,,drop = FALSE] In general if you want to ensure consistent behaviour in scripts, it is a recommended that you use drop = FALSE as a kind of pseudo-index in the last position like this. You can always demote the object to a simpler form, if that's what you really want and if one exists, using the drop() function later. Why is it so? It was not my idea. I do know, though, that the Matrix package allows matrix operations with this convention inoperative. Other people must have become a tad frustrated with it before now. Bill Venables. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of James Hirschorn Sent: Monday, 15 November 2010 10:32 AM To: R-help@r-project.org Subject: [R] Extracting from data.frame Can someone please explain the following behavior? df1 and df2 are data.frames. Suppose I want a subset of the rows (observations) using extraction, say just the first row. What I want to know is why if df1 has just one column then df1[1,] returns a vector, whereas if df2 has 2 or more columns then df2[1,] returns a data frame? Why is the single column case different? [[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] RCurl and cookies in POST requests
Hi Christian Thanks for finding this. The problem seems to be that the finalizer on the curl handle seems to disappear and so is not being called when the handle is garbage collected. So there is a bug somewhere and I'll try to hunt it down quickly. In the meantime, you can achieve the same effect by calling the C routine curl_easy_cleanup. You can't do this directly with a .Call() or .C() as there is no explicit interface in the RCurl package to this routine. However, you can use the Rffi package (on the omegahat repository) library(Rffi) cif = CIF(voidType, list(pointerType)) callCIF(cif, curl_easy_cleanup, c...@ref) I'll keep looking for why the finalizer is getting discarded. Thanks again, D. On 11/14/10 6:30 AM, Christian M. wrote: Hello. I know that it's usually possible to write cookies to a cookie file by removing the curl handle and doing a gc() call. I can do this with getURL(), but I just can't obtain the same results with postForm(). If I use: curlHandle - getCurlHandle(cookiefile=FILE, cookiejar=FILE) and then do: getURL(http://example.com/script.cgi, curl=curlHandle) rm(curlHandle) gc() it's OK, the cookie is there. But, if I do (same handle; the parameter is a dummy): postForm(site, .params=list(par=cookie), curl=curlHandle, style=POST) rm(curlHandle) gc() no cookie is written. Probably I'm doing something wrong, but don't know what. Is it possible to store cookies read from the output of a postForm() call? How? Thanks. Christian PS.: I'm attaching a script that can be sourced (and its .txt version). It contains an example. The expected result is a file (cookies.txt) with two cookies. The script currently uses getURL() and two cookies are stored. If postForm() is used (currently commented), only 1 cookie is written. __ 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] How to permanently remove [Previously saved workspace re
That is a nice reply, Duncan, and an excellent explanation of why .Rdata has no name! I also like the final sentence. I would only add: If you're sane, and want to stay sane, think about not using Windows. Hi Ted, 10 years ago, I have stopped running Windows for production. I only keep Windows for testing. This is a virtual machine running Oracle VBox as virtualizer with Ubuntu 1010 as host. Win7 is running as VM. In certain occasion we still need Windows temporarily such RExcel, a Windows application. I found R and Calc later. RBloomberg is also a Windows application. Very soon a Linux/Unix version will be available, etc. Some enterprises still keep Windows as OS in office. In order to survive we have to follow. B.R. Stephen - Original Message From: ted.hard...@wlandres.net ted.hard...@wlandres.net To: r-help@r-project.org Sent: Mon, November 15, 2010 12:58:51 AM Subject: Re: [R] How to permanently remove [Previously saved workspace re On 14-Nov-10 16:43:18, Duncan Murdoch wrote: On 14/11/2010 10:42 AM, Joshua Wiley wrote: On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liusati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch That is a nice reply, Duncan, and an excellent explanation of why .Rdata has no name! I also like the final sentence. I would only add: If you're sane, and want to stay sane, think about not using Windows. Ted. E-Mail: (Ted Harding) ted.hard...@wlandres.net Fax-to-email: +44 (0)870 094 0861 Date: 14-Nov-10 Time: 16:58:49 -- XFMail -- __ 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] How to permanently remove [Previously saved workspace restored]
Hi Duncun, Thanks for your advice. Start Window Explorer as Admin - Organize - Folder and Search Option - View Under Advanced settings: [uncheck] Hide extension for known file types - OK .RData shown up. Also it can be searched. B.R. Stephen L - Original Message From: Duncan Murdoch murdoch.dun...@gmail.com To: Joshua Wiley jwiley.ps...@gmail.com Cc: Stephen Liu sati...@yahoo.com; r-help@r-project.org Sent: Mon, November 15, 2010 12:43:18 AM Subject: Re: [R] How to permanently remove [Previously saved workspace restored] On 14/11/2010 10:42 AM, Joshua Wiley wrote: On Sun, Nov 14, 2010 at 3:40 AM, Stephen Liusati...@yahoo.com wrote: Hi Joshua, list.files(path = getwd(), all.files = TRUE) [3] .RData [4] .Rhistory .Rhistory and .RDate are there. Note that these files start with a . But I can't find .RDate on Windows Explorer. Only .Rhistory is there. This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch You can adjust this behavior in the folder options (if the idea of protected/hidden files and folder options all sounds new to you, now is a great opportunity to spend some time exploring your operating system, learning how it works and how to use it at a more serious level than the basic user it assumesGoogle is your friend here, there are literally thousands of articles, walkthroughs, and tutorials on different aspects of Windows). rm (list = ls(all=TRUE)) This does NOT delete the workspace, it just clears your worksapce of any objects. q() save working image Now you will have saved your current worksapce (which if you just used rm() as above, will be empty, but still there). On next start of R [Previously saved workspace restored] still popup Now you probably just restored an empty workspace. This is not a problem, it is normal R behavior and is a sign that everything is working as expected. B.R. Stephen L __ 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] sum in vector
Try this: rowsum(value, paste(factor1, factor2, factor3)) On Sun, Nov 14, 2010 at 5:21 PM, km srikrishnamo...@gmail.com wrote: Hi all, On Sun, Nov 14, 2010 at 10:06 PM, Henrique Dallazuanna www...@gmail.com wrote: Try this: rowsum(price, market) does it work with multiple factors/groups ? using multiple factors such as c(factor1,factor2,factor3,...) as second arg with rowsum() doesnt seem to work! am i missing something ? regards KM __ 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] How to permanently remove [Previously saved workspace restored]
Hi Josh, Start Command Prompt as Admin C:\Windows\system32cd C:\Users\satimis C:\Users\satimisdir Volume in drive C has no label. Volume Serial Number is EC2D-3F1A Directory of C:\Users\satimis 11/14/2010 05:52 PMDIR . 11/14/2010 05:52 PMDIR .. 11/14/2010 01:58 PM42 .RData 11/14/2010 07:33 PM94 .Rhistory 05/11/2010 08:33 PMDIR AppData 08/06/2010 12:57 PMDIR Contacts 11/13/2010 12:00 AMDIR Desktop 11/14/2010 01:39 PMDIR Documents 08/27/2010 05:34 PMDIR Downloads 08/06/2010 12:57 PMDIR Favorites 08/06/2010 12:57 PMDIR Links 08/06/2010 12:57 PMDIR Music 08/06/2010 12:57 PMDIR Pictures 08/19/2010 10:34 AMDIR R 08/06/2010 12:57 PMDIR Saved Games 11/14/2010 07:31 PMDIR Searches 08/06/2010 12:57 PMDIR Videos 2 File(s)136 bytes 15 Dir(s) 19,187,191,808 bytes free .RData is there. C:\Users\satimisdel .RData Start R the warning [Previously saved workspace restored] disappears Thanks B.R. Stephen L - Original Message From: Joshua Wiley jwiley.ps...@gmail.com To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Mon, November 15, 2010 1:26:16 AM Subject: Re: [R] How to permanently remove [Previously saved workspace restored] @Stephen Sorry, Duncan's right, it is likely not a protected/hidden file issue. At the risk of nuking the fridge, you could also open an elevated command prompt then navigate to the relevant directory and delete the file: cd C:\Users\satimis del .RData exit Probably too much trouble for deleting a single file, but handy if you want to do a lot (e.g., all files with the *.RData extension or...). The new PowerShell is starting to grow on me too (it seems wider), but I am not as familiar with the commands. Josh On Sun, Nov 14, 2010 at 8:43 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: This is likely a feature of Windows Explorercertain types of files are hidden by default (like those that start with .). That's not true: it's Unix ls that hides filenames starting with a .. Windows Explorer does hide some files, but I don't think it is ever based on the name, it's based on the attributes. What Windows Explorer does that is incredibly stupid is that (by default) it hides file extensions for known file types. Generally .RData will be registered as a known file type. Exporer will cut off the .RData part the name of a file with that extension, and only show the first part of the name. Since the file .RData has no starting part of a name, it will be listed with a blank name. What you should do (and what Microsoft should set the default to) is to turn off this bad policy of listing filenames incorrectly. I don't remember how to do it in Windows 7 or Vista, but on XP, here's how: Go into Explorer in some folder. Click on the Tools menu, then the Folder Options... choice. Choose the View tab. About 10 choices down within Files and Folders, you'll see Hide Extensions for Known File Types. Make sure this is *not* checked. @Duncan You're right, as usual. I mixed Windows and Linux. Changing the setting for extensions is basically as you described on my Windows 7 except I have to hit the left alt for Windows Explorer to even show the file menu where I can click on Tools - Folder Options (maybe just my configuration). Does .RData get registered by default but not .Rhistory? (since Stephen reported seeing the .Rhistory file). If you're sane, you'll then click on the button Apply to all folders, but you might just want to click on OK to try it out on one folder first. Duncan Murdoch __ 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] About upgrade R
Hi Ajay wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying I also have this doubt? The packages have been updated. Are those packages updated belong to version 2.12 OR still version 2.11.1 In Linux/Unix if the latest version, say 5.2.0, and the running version is 5.1.0 I have to upgrade the version NOT the packages. I have no idea on R B.R. Stephen L - Original Message From: Ajay Ohri ohri2...@gmail.com To: Uwe Ligges lig...@statistik.tu-dortmund.de Cc: Stephen Liu sati...@yahoo.com; r-help@r-project.org Sent: Mon, November 15, 2010 12:59:22 AM Subject: Re: [R] About upgrade R wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Ligges lig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] About upgrade R
Hi Stephen and folks mv .Rprofile Rprofile I can't find .Rprofile on Win7 even with [uncheck] Hide extension for known file types on Windows Explorer. Nor I can search for it. Would it be under another name in Windows? B.R. Stephen L - Original Message From: stephen sefick ssef...@gmail.com To: r-help@r-project.org Sent: Mon, November 15, 2010 4:19:15 AM Subject: Re: [R] About upgrade R update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849| |___| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis A big computer, a complex algorithm and a long time does not equal science. -Robert Gentleman __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help
Re: [R] LAPACK lib problem, lme4, lastest R, Linux
With help from Dirk Eddelbuettel we found that I needed to explicitly install libatlas-base-dev. After doing this everything worked with no further fuss. Best Regards, Ron On 11/13/2010 11:10 AM, Ron Burns wrote: I just dumped Vista off a laptop and installed Ubuntu 10.10 (latest release) as the single operating system. I did all of the updates and then installed emacs and ess. Next I installed R by following the the usual instructions on the CRAN site. At this point all is working I am now in the process of installing the packages that I normally have installed. I am having a problem with the LAPACK libraries when installing lme4, but the problem is not unique to lme4. It is either a link to or missing LAPACK libs. I am at a loss as what I am doing wrong since I have started with a completely clean machine and am not trying to anything special. ---HERE is the R startup: wow (ron) R R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) ---HERE is the final output from trying to install lme4: * installing *source* package lme4 ... ** libs gcc -I/usr/share/R/include -I/usr/lib/R/library/Matrix/include -I/usr/lib/R/library/stats/include -fpic -std=gnu99 -O3 -pipe -g -c init.c -o init.o gcc -I/usr/share/R/include -I/usr/lib/R/library/Matrix/include -I/usr/lib/R/library/stats/include -fpic -std=gnu99 -O3 -pipe -g -c lmer.c -o lmer.o gcc -I/usr/share/R/include -I/usr/lib/R/library/Matrix/include -I/usr/lib/R/library/stats/include -fpic -std=gnu99 -O3 -pipe -g -c local_stubs.c -o local_stubs.o gcc -shared -o lme4.so init.o lmer.o local_stubs.o -llapack -lf77blas -latlas -lgfortran -lm -L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -lf77blas /usr/bin/ld: cannot find -latlas collect2: ld returned 1 exit status make: *** [lme4.so] Error 1 ERROR: compilation failed for package lme4 * removing /usr/local/lib/R/site-library/lme4 -BUT [ 48 ] wow (ron) /usr/bin/R CMD config LAPACK_LIBS -llapack -AND wow (ron) dpkg -l | grep lapack ii liblapack-dev 3.2.1-8 library of linear algebra routines 3 - static version ii liblapack3gf 3.2.1-8 library of linear algebra routines 3 - shared version [ 44 ] wow (ron) I did see a message indicating Also do 'ldd /usr/lib/R/bin/exec/R' and make sure you do _not_ have a depends on Rlapack.so. : [ 47 ] wow (ron) ldd /usr/lib/R/bin/exec/R linux-gate.so.1 = (0x00533000) libR.so = /usr/lib/libR.so (0x0073e000) libc.so.6 = /lib/libc.so.6 (0x0011) libf77blas.so.3gf = /usr/lib/libf77blas.so.3gf (0x00ed4000) libatlas.so.3gf = /usr/lib/libatlas.so.3gf (0x0026e000) libgfortran.so.3 = /usr/lib/libgfortran.so.3 (0x00cca000) libm.so.6 = /lib/libm.so.6 (0x0065f000) libreadline.so.6 = /lib/libreadline.so.6 (0x00534000) libpcre.so.3 = /lib/libpcre.so.3 (0x00f5b000) liblzma.so.2 = /usr/lib/liblzma.so.2 (0x00568000) libz.so.1 = /lib/libz.so.1 (0x0058b000) libdl.so.2 = /lib/libdl.so.2 (0x005a) /lib/ld-linux.so.2 (0x00e67000) libcblas.so.3gf = /usr/lib/libcblas.so.3gf (0x005a4000) libgcc_s.so.1 = /lib/libgcc_s.so.1 (0x005c4000) libpthread.so.0 = /lib/libpthread.so.0 (0x005e) libncurses.so.5 = /lib/libncurses.so.5 (0x005fa000) [ 41 ] wow (ron) ls /usr/lib/libatlas* /usr/lib/libatlas.so.3gf@ [ 42 ] wow (ron) ls /usr/lib/libf77blas* /usr/lib/libf77blas.so.3gf@ so these are there and linked OK and there is no Rlapack.so The links look OK. Should I be linking to static libs and if so they do not seem to on my machine anywhere. ( a find . -name *f77blas* (or on atlas) turned up so's only) I am at a loss as to where to go from here. Thank you all for your consideration. Ron Burns -- R. R. Burns Physicist (Retired) Oceanside, CA __ 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] About upgrade R
Hi Stephen, I think .Rprofile is something you have to create yourself. It is not needed, but you can create it and then put your customizations in it (just put it in the same directory as the directory R starts in. Cheers, Josh On Sun, Nov 14, 2010 at 6:15 PM, Stephen Liu sati...@yahoo.com wrote: Hi Stephen and folks mv .Rprofile Rprofile I can't find .Rprofile on Win7 even with [uncheck] Hide extension for known file types on Windows Explorer. Nor I can search for it. Would it be under another name in Windows? B.R. Stephen L - Original Message From: stephen sefick ssef...@gmail.com To: r-help@r-project.org Sent: Mon, November 15, 2010 4:19:15 AM Subject: Re: [R] About upgrade R update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the
Re: [R] About upgrade R
Sorry for the confusion. My post applies to *NIX. I am sorry for not reading your post thoroughly and also not specifying the system that I am using. Stephen On Sun, Nov 14, 2010 at 8:15 PM, Stephen Liu sati...@yahoo.com wrote: Hi Stephen and folks mv .Rprofile Rprofile I can't find .Rprofile on Win7 even with [uncheck] Hide extension for known file types on Windows Explorer. Nor I can search for it. Would it be under another name in Windows? B.R. Stephen L - Original Message From: stephen sefick ssef...@gmail.com To: r-help@r-project.org Sent: Mon, November 15, 2010 4:19:15 AM Subject: Re: [R] About upgrade R update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849 | |___| | sas0...@auburn.edu | | http://www.auburn.edu/~sas0025 | |___| Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals.
[R] Problem in installing and starting Rattle
Hello, I am trying to install and run Rattle on my Dell Laptop and I have Windows 7 OS. The following three commands executed successfully : install.packages(RGtk2) install.packages(rattle) library(rattle) Rattle: Graphical interface for data mining using R. Version 2.5.47 Copyright (c) 2006-2010 Togaware Pty Ltd. Type 'rattle()' to shake, rattle, and roll your data. When I type the below command, I get an error message. rattle() Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'C:/Users/Kaushik/Documents/R/win-library/2.12/RGtk2/libs/i386/RGtk2.dll': LoadLibrary failure: The specified module could not be found. Failed to load RGtk2 dynamic library, attempting to install it. trying URL 'http://downloads.sourceforge.net/gtk-win/gtk2-runtime-2.22.0-2010-10-21-ash.exe?download' Content type 'application/octet-stream' length 7820679 bytes (7.5 Mb) opened URL downloaded 7.5 Mb Learn more about GTK+ at http://www.gtk.org If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN Error in as.GType(type) : Cannot convert RGtkBuilder to GType rattle() Error in as.GType(type) : Cannot convert RGtkBuilder to GType Why do I get this error message ? Please advice. -- View this message in context: http://r.789695.n4.nabble.com/Problem-in-installing-and-starting-Rattle-tp3042502p3042502.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] About upgrade R
Hi Josh and all, I think .Rprofile is something you have to create yourself No, it is a file on Linux OS Start R as Admin update.packages(checkBuilt=TRUE) --- Please select a CRAN mirror for use in this session --- Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows64/contrib/2.11 It didn't work. Start MS Excel 2007 to make sure following packages; RExcel rcom statconnDCOM work To remove R 2.11.1 Start - Control Panel - Uninstall a program - highlight R for windows x64 2.11.1 - Uninstall Download Windows R-2.12.0 for Windows (32/64 bit) http://cran.at.r-project.org/ - Windows - base - Download R 2.12.0 for Windows (32/64 bit) - Run Select Destination Location C:\Program Files\R-2.12.0 - Next select Default settings and add; On-line PDF Manuals [check] Technical Manual [check] PDF help pages SupportFiles for Package tcltk [check] Timezone files for Tcl [check] Tcl/Tk Help (Compiled HTML) [check Test files - Next Startup options [check] No (accep defaults) - Next Select Start Menu Folder R - Next Select Additional Tasks [check] Create a desktop icon [check] Save version number in registry [check] Associate R with .RData files - Next - Finish Installation went throught w/o complaint To my surprise there are 2 R icons on desktop - R x64 2.12.0 - R 2.12.0 I suppose the 2nd one is 32bit version? I don't need 2 R versions here. This is a 64bit Win7. Can I delete the 32bit R? Start MS Excel 2007 - start R complaining R server not available. I have to reinstall; rcom statconnDCOM RExcel Now R 2.12 is running on Win7. RExcel also works B.R. Stephen L - Original Message From: Joshua Wiley jwiley.ps...@gmail.com To: Stephen Liu sati...@yahoo.com Cc: r-help@r-project.org Sent: Mon, November 15, 2010 11:19:38 AM Subject: Re: [R] About upgrade R Hi Stephen, I think .Rprofile is something you have to create yourself. It is not needed, but you can create it and then put your customizations in it (just put it in the same directory as the directory R starts in. Cheers, Josh On Sun, Nov 14, 2010 at 6:15 PM, Stephen Liu sati...@yahoo.com wrote: Hi Stephen and folks mv .Rprofile Rprofile I can't find .Rprofile on Win7 even with [uncheck] Hide extension for known file types on Windows Explorer. Nor I can search for it. Would it be under another name in Windows? B.R. Stephen L - Original Message From: stephen sefick ssef...@gmail.com To: r-help@r-project.org Sent: Mon, November 15, 2010 4:19:15 AM Subject: Re: [R] About upgrade R update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows – another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting
Re: [R] About upgrade R
Hi Stephen, It doesn't exist before you'll make it (that's one of the thing the code in my post does) Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Mon, Nov 15, 2010 at 4:15 AM, Stephen Liu sati...@yahoo.com wrote: Hi Stephen and folks mv .Rprofile Rprofile I can't find .Rprofile on Win7 even with [uncheck] Hide extension for known file types on Windows Explorer. Nor I can search for it. Would it be under another name in Windows? B.R. Stephen L - Original Message From: stephen sefick ssef...@gmail.com To: r-help@r-project.org Sent: Mon, November 15, 2010 4:19:15 AM Subject: Re: [R] About upgrade R update.packages has always worked well for me. I have a customized .Rprofile file and just update from linux repos, or build from source mv .Rprofile Rprofile update all packages mv Rprofile .Rprofile It only takes a couple of minutes and everything is up I like being in control of what happens on my system. Stephen On Sun, Nov 14, 2010 at 2:05 PM, John C Frain fra...@gmail.com wrote: The current method allows one to easily retain several versions working in parallel. This particularly important if some package is not available in the new version. A few years ago there were problems such as these during a major overhaul of the rmetrics group of packages. My current practice is to retain older versions until I am sure that all I need is available in the new version. Thus I am in favour of retaining the current system. John On Sunday, Novembe 14, 2010, Uwe Ligges lig...@statistik.tu-dortmund.de wrote: On 14.11.2010 17:59, Ajay Ohri wrote: wont it make more common sense to make updating packages also as part of every base version install BY Default.. just saying At least I do not like the idea: If I just want to try a beta version, I do not want that everything is updated and I can't switch back to my last stable version. Uwe Ligges Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri 2010/11/14 Uwe Liggeslig...@statistik.tu-dortmund.de: Upgrading is mentioned in the FAQs / R for Windows FAQs. If you have your additionally installed packages in a separate library (not the R base library) you can simply run update.packages(checkBuilt=TRUE) If not ... Uwe Ligges On 14.11.2010 15:51, Stephen Liu wrote: Hi all, Win 7 64-bit R version 2.11.1 (2010-05-31) I want to upgrade R to version 2.12.0 R-2.12.0 for Windows (32/64 bit) http://cran.r-project.org/bin/windows/base/ I found steps on following site; How to upgrade R on windows another strategy (and the R code to do it) http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ / I wonder is there a straight forwards way to upgrade the package direct on repo? TIA B.R. Stephen L __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@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. -- Stephen Sefick | Auburn University | | Department of Biological Sciences | | 331 Funchess Hall | | Auburn, Alabama | | 36849| |___| |
Re: [R] L-shaped boxes with lattice graphs?
Hi John, Here is an example with plot borders on the left and bottom only. ## hide the usual panel and strip borders by using transparent NA sty - list() sty$axis.line$col - NA sty$strip.border$col - NA sty$strip.background$col - NA xyplot(11:14 ~ 1:4 | rep(c(A, B), 2), scales=list(x=list(alternating=FALSE, relation=sliced)), par.settings = sty, panel = function(...) { grid::grid.lines(x = 0); grid::grid.lines(y = 0) panel.xyplot(...) }, layout=c(1,2)) Hope that helps -Felix On 15 November 2010 11:00, John Maindonald john.maindon...@anu.edu.au wrote: Can anyone suggest an equivalent, for lattice graphs, of the base graphics argument bty=l? NB that I am leaving off the box around the strip, with a strip function: stripfun - function(which.given,which.panel, factor.levels=as.expression(levlist), ...){ panel.text(x=0, y=0.5, lab = as.expression(levlist[which.panel[which.given]]), adj=0) } e.g. levlist - list(A, B) xyplot(11:14 ~ 1:4 | rep(1:2,2), scales=list(x=list(alternating=c(1,1), relation=sliced)), strip=stripfun, layout=c(1,2)) John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473 fax : +61 2(6125)5549 Centre for Mathematics Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. http://www.maths.anu.edu.au/~johnm __ 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. -- Felix Andrews / 安福立 http://www.neurofractal.org/felix/ __ 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] About upgrade R
Em 14/11/2010 18:24, Tal Galili escreveu: Hi John, thank you for that input. It could be that the code I wrote here: http://www.r-statistics.com/2010/04/changing-your-r-upgrading-strategy-and-the-r-code-to-do-it-on-windows/ Should be updated so every time you install a new R version, you run the code for it to: 1) copy all packages from the old R version to the new R version library 2) update all the packages. But I have no clue how to do step 1. I've a clue but not the exact syntax for doing it: a) you need to get the library directory path of your current installation or if putting it manually; b) list.files(path = 'path to your libraries') select the directories with the return of file.info(); c) save the list for processing in the newer R version; d) in the newer version you use the list as argument to install.packages(). All the aforementioned /caveats/ about packages not in CRAN still apply. . . Regards, -- Cesar Rabak __ 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.