[R] Check DESCRIPTION meta-information ... ERROR
Hi r-help, When I was building my package whin on Mac OS X using R CMD build --binary whin the following error occured: $ R CMD build --binary whin * checking for file 'spss/DESCRIPTION' ... OK * preparing 'spss': * checking DESCRIPTION meta-information ... ERROR /Library/Frameworks/R.framework/Resources $ but I can install this package with R CMD INSTALL whin. Also, when I logon Mac with another account, the command R CMD build --binary whin worked well and no error occured. Would someone tell me why please? What does R do when it checks the meta-information and what information will be checked? Thank you very much! Whin. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] hi, about mysql from r
hi, I am using the R connect to mysql by RODBC, windows XP. when I use sqlQuery() to select blob columns from table, the result is binary type. but what i put into the blob column is character. and when using Perl, it is ok. i change the column data type to longtext. but this time, the sqlQuery() just gives me 255 characters. so, how can i do? this column composite with many numeric data, separated by ,. i just use the ID index to select this big field, about 24KB each field. this is the first time i use mailing list. hehe thanks in advance! whhu 2007-07-18 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] list
Hello, in using vector() we can create a vector and fill in like this v - vector() v - c(v,2) v - c(v,c(5,10,23)) but I wanna know if it's possible to do the same with the list I don't fond how? Can you help me? Thanks. ___ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] R equivalent to Matlab's Bayes net toolbox
On Wed, 2007-07-18 at 03:52 +, Jose wrote: The thing that I don't understand in the gR page is why there are so many different packages and why they are not very integrated: You have to understand the gR project for that. It started from a number of completely separate pieces of software within the general field of graphical models, and tried to bring people together and make the existing pieces of software accessible from R. Given that the active core of the group was really just a handful of people with limited R programming experience (much of the original code was written in dialects of Pascal/Delphi), the project must be said to have had some success. However, the most pronounced effect has been to bring those old codes out in the open, but seamless integration would be quite far into the horizon. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] list
'c' also works with lists: a=list(1,2,3) b=list(1,2,3) c(a,b) [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 [[4]] [1] 1 [[5]] [1] 2 [[6]] [1] 3 On 7/18/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote: Hello, in using vector() we can create a vector and fill in like this v - vector() v - c(v,2) v - c(v,c(5,10,23)) but I wanna know if it's possible to do the same with the list I don't fond how? Can you help me? Thanks. ___ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Christophe Pallier (http://www.pallier.org) [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [R-sig-DB] RODBC on Oracle DB
On Tue, 17 Jul 2007, Marc Schwartz wrote: Try the sqlQuery() syntax with a semi-colon at the end of it: sqlQuery(essai, select * from S_TYP_COLLEGES;) Oracle requires the semi-colon at the end of the SQL statement. Over ODBC? I've never heard of that, and others have used RODBC to Oracle successfully when it does not itself add semicolons. What sqlFetch is running is (in a vanilla setup) SELECT * FROM 'S_TYP_COLLEGES', and we've heard of a few cases where the quotes were a problem, hence my suggestion. The error message is not a syntax error (which is what I would expect from a missing terminator), but that the table/view is not found. If that does not help, try these queries using the Oracle Instant Client command line application outside of R and see if your queries work there. If so, then we can likely isolate the problem to R. If not, then there is an ODBC/Oracle configuration issue. If you are unsure of how to use (or perhaps install) the Oracle Instant Client, check with one of your SysAdmins. BTW, unstated is the OS here, but I presume Windows, given the ODBC driver version and DLL noted previously. HTH, Marc Schwartz On Tue, 2007-07-17 at 09:24 +0200, [EMAIL PROTECTED] wrote: essai - odbcConnect(ORESTE_prod, uid=osis_r, pwd=12miss15 ,case=oracle) sqlTables(essai)$ORESTE ... 1315 NA ORESTE S_PROFESSIONS_OLDTABLENA 1316 NA ORESTE S_PROVENANCESTABLENA 1317 NA ORESTES_SEXESTABLENA 1318 NA ORESTE S_SOUS_CLASSESTABLENA 1319 NA ORESTE S_TYP_COLLEGESTABLENA 1320 NA ORESTE S_TYP_ENSEIGNEMENTTABLENA ... sqlQuery(essai, select * from S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n I have also tried the essai2 - odbcDriverConnect(connection=essai2) But with no succes. On Lun Juil 16 15:32 , Prof Brian Ripley [EMAIL PROTECTED] sent: The problem could be quoting, if Oracle is not standards-compliant. See the options in ?odbcConnect. If sqlQuery(essai, select * from S_TYP_COLLEGES) works, this is likely to be the problem. On Mon, 16 Jul 2007, [EMAIL PROTECTED] wrote: essai odbcGetInfo(essai) DBMS_Name DBMS_Ver Driver_ODBC_Ver Oracle 09.00.0121 03.51 Data_Source_Name Driver_Name Driver_Ver ORESTE_prodSQORA32.DLL 09.00.0101 ODBC_Ver Server_Name 03.52. weba sqlTables(essai) The result of this function is a liste of tables, one of them is called: S_TYP_COLLEGES. sqlFetch(essai,S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n sqlFetch(essai, S_TYP_COLLEGES, colnames=TRUE, rownames=FALSE) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n What could be the problem here ? Any help is welcome Eric Röthlisberger, Neuchâtel ___ R-sig-DB mailing list -- R Special Interest Group [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-sig-db -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] filter out observation by condition
hello, I have a longitudinal data: idn mort30 newinfec 1 0 1 1 0 1 1 0 1 1 0 1 2 1 1 2 1 1 2 1 1 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 and i want to filter out those obs. that has mort30==1 (mort30 is constant over idn). how can i use if...else and filter out those unwanted obs.? I appriciate the help, sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] R and Copula
hi meeryana, may be this time nobnody is responding. but dont worry you will get a lot of help eventually, so always post a copy to the mailing list. The reason is there are a lot many newbies, although i am also not so old enough, who have even the simplest questions but are hesitant to ask. the objective of the list is to help, and thus feel free to ask, stand and contribute :-) i hope you will understand not today then tomorrow as you will get associated with the mailing list more closely. Personally i have found friends here. Further, never post a mail with a loose subject and secondly try to maintain the thread i.e. reply to the mail which you want to reply(for more details refer to the posting guide) :-) that would really help. Yes now regarding your question :-) Step1 : List of all packages can be found at this link :-) http://cran.r-project.org/src/contrib/PACKAGES.html Step2: Click on the package you want to install :-) http://cran.r-project.org/src/contrib/Descriptions/copula.html Step3: Then download the binary of your Operating system. If windows then download corresponding zip file. for copula it is http://cran.r-project.org/bin/windows/contrib/r-release/copula_0.5-3.zip save zip file on your system Step4 Open your R rpogram Step5: Goto Packages - Install packages from Local Zip file Step6: Select your package zip file which you want to install Step7: Sit back and relax Step8: load the library using library(LibraryName) on R prompt There are alternate ways of installing the package directly from R prompt. It didn't worked for me a long time back, so i always adopt this method. Somebody on the list may help you in this regards :-) bye and learn Join and stand with Open Source and R community Cheers and Chiao, Welcome -gaurav dear Mr. Yadav, I want to thank for help, and for that you are only who is willing to help, but I have one question: because I'm new with R project also, I think I should install a package for copula. I have only installed R program. How should I install this package? And is it what I have also to do with credit metrics, Value at Risk, matix and the other formulas, I mean install packages. I hope that you have a little time for me and my problem, and I hope I'm not disturbing you. thank you for all you can do for me and best regards, Mirjana gyadav wrote: hi see the code below i hope this will make your understanding of copulas better this code plots two normal distribution and their joint distribution N[0,2] N[0,4] HTH ##code library(copula) ###copy in two parts in R# ##PART A## ## construct a bivariate distribution whose marginals ## are normal and Normal respectively, coupled ## together via a normal copula op - par(mfrow = c(2, 2), # 2 x 2 pictures on one plot pty = s) # square plotting region, # independent of device size x - mvdc(normalCopula(0.75), c(norm, norm), list(list(mean = 0, sd =2),list(mean = 0, sd =4))) x.samp - rmvdc(x, 1) par(mfrow=c(2,3)) hist(x.samp[,1],xlab=Normal) hist(x.samp[,2],xlab=Normal) plot(x.samp[,2],x.samp[,1],pch=21,xlab=Normal,ylab=Normal) plot(dmvdc(x, x.samp)) plot(pmvdc(x, x.samp)) ## At end of plotting, reset to previous settings: ###PART B### par(op) for (i in seq(1:360)){ persp(x, dmvdc, xlim = c(-4, 4), ylim=c(0, 1),theta=i) } Regards, Gaurav Yadav +++ Assistant Manager, CCIL, Mumbai (India) Mob: +919821286118 Email: [EMAIL PROTECTED] Bhagavad Gita: Man is made by his Belief, as He believes, so He is copula [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 07/17/2007 12:53 PM To r-help@stat.math.ethz.ch cc Subject Re: [R] R and Copula it would be great when somebody will help me thanks copula wrote: hi, first I want to say that I'm new here, and new with copula and R. That is the reason why I'm writing, if somebody can help me. I have to make an example of Copula. On internet I've found this forum and that copula can calculate with R. Can somebody help me with the thing how can I start and where can read about these stuffs. Thank to all who can help! -- View this message in context: http://www.nabble.com/R-and-Copula-tf4085867.html#a11644534 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message
Re: [R] filter out observation by condition
sigalit mangut-leiba wrote: hello, I have a longitudinal data: idn mort30 newinfec 1 0 1 1 0 1 1 0 1 1 0 1 2 1 1 2 1 1 2 1 1 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 and i want to filter out those obs. that has mort30==1 (mort30 is constant over idn). how can i use if...else and filter out those unwanted obs.? I appriciate the help, sigalit. subset(data, mort30 != 1) Uwe Ligges [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Delaunay triangulation
Dear R-help users, i used R to costruct the Delaunay triangulation with delaunayn function: vertex=delaunayn(3d_coord, option=QJ) of geometry package. 3d_coord is a matrix that contain 3d coordinates (x,y,z) of 160 points in the 3d space. I understand that not all of this point are used by delaunay function to constract the polyedrons. So now i need to obtain the coordintate x,y,z only that are used by delaunay function to construct these poliedrons. Best regards Piero Ricchiuto Gruppo di Studio per la Proteomica e la Struttura delle Proteine Dipartimento di Scienze Farmacologiche Università degli Studi di Milano Via Giuseppe Balzaretti, 9 20133 - Milano tel.: +39-02-50318395, fax: +39-02-50318284 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Sorting data frame by a string variable
Dimitri If you try order(c(b,a,c)) [1] 2 1 3 or sort(c(b,a,c)) [1] a b c You will see that sort() and order() DO respect character order. Your problem could be that your data frame variable is not a character but a factor (the default for read.table, for example) Check the class of the variable. If it is a factor, try order(as.vector(String)) This will also work if String is a character vector; as.vector will just return the character variable. Dimitri Liakhovitski [EMAIL PROTECTED] 17/07/2007 18:56:00 I have a data frame MyData with 2 variables. One of the variables (String) contains a string of letters. How can I resort MyData by MyData$String (alphabetically) and then save the output as a sorted data file? I tried: o-order(MyData$String) SortedData-rbind(MyData$String[o], MyData$Value[o]) write.table(SortedData,file=Sorted.txt,sep=\t,quote=F, row.names=F) However, all strings get replaced with digits (1 for the first string, 2 for the second string etc.). How can I keep the strings instead of digits? Thank you! Dimitri __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** This email and any attachments are confidential. Any use, co...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Subsetting Enigma: More rows after dataframe[-list,]?
Hello again, I'm trying to purge the indexes in i.delete from frame and end up with more rows!? Please be so kind and let me know where I screw this up ... Joh i.delete [1] 40 45 165 212 253 270 280 287 301 352 421 433 463 467 487 [16] 517 537 542 573 594 596 612 614 621 635 650 696 699 707 732 [31] 738 776 826 891 892 936 937 935 940 976 988 995 1037 1043 1059 [46] 1081 1123 1128 1132 1140 1153 1155 1165 1176 1179 1200 1281 1289 1300 [61] 1320 1346 1356 1366 1369 1396 1406 1420 1428 1429 1471 1474 1475 1525 1540 [76] 1554 1565 1645 1667 1665 1706 1711 1724 1764 1788 1791 1805 1808 1847 1881 [91] 10 18 137 238 254 260 262 288 292 314 338 349 414 447 457 [106] 465 470 478 511 530 536 552 582 588 644 655 687 693 701 724 [121] 739 763 771 836 848 859 888 900 902 919 939 972 979 989 1000 [136] 1002 1015 1020 1026 1029 1032 1055 1060 1073 1088 1104 1117 1124 1130 1135 [151] 1144 1221 1225 1249 1251 1257 1376 1384 1386 1453 1487 1529 1532 1534 1605 [166] 1624 1633 1646 1648 1702 1787 1948 1951 length(i.delete) [1] 173 nrow(frame) [1] 1975 nrow(frame[-i.delete,]) [1] 1802 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Missing value in circ.mean and polar.plot
Gagnon,Francois [SteFoy] wrote: Hi, I try to compute circular means for a matrix with NAs, but the function circ.mean return only means for lines with complete values and do not accept na.omit=T or na.rm=T, or na.action=na.omit, or na.fail=T. Also, I try to use polar.plot of the package poltrix with the same matrix, but angles are not display because of many NAs. Does any one know how what should be the right NA action to get results in these two cases ? Hi Francois, For one thing, you should be using radial.plot, as the angles are in radians, not degrees. However, your data shows up a couple of problems with radial.plot that I will fix. I'm currently fixing some minor (I hope) problems with plotrix v2.2-3 and this should turn up on CRAN in the next few days. I'll see if I can get radial.plot to produce the sort of plots you are seeking. Thanks for finding the problem. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 combine presence only data sets to one presence/absence table
Problem: I have a Set of samples each with a list of observed species (presence only). Data is stored in a excel spreadsheet and the columns (spl) have different numbers of observations (spcs). Now I want to organize the data in a species by sample matrix with presence/absence style in R. data style (in excel): spl_A spl_B spl_C spcs1 spcs1 spcs2 spcs2 spcs3 spcs3 spcs4 spcs5 spcs5 desired style: spl_A spl_B spl_C spcs1 1 1 0 spcs2 1 0 1 spcs3 0 1 1 . . . How and in which form do I import the data to R? (read.table() seems not to be appropriate, as data is not organized as a table) How can I create the species by sample matrix? Thanks for any help, Patrick Zimmermann __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] hist() Frequancy values
I have seen that the hist() function plots an histogram of the frequency but I cannot find the value of the object hist that contains theese values... how is possible to get out them? thank you very mutch best regards Manuele -- Manuele Pesenti [EMAIL PROTECTED] [EMAIL PROTECTED] http://mpesenti.polito.it __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] hist() Frequancy values
Try xx = hist(yy,plot=FALSE) ## plot=FALSE if you don't want to plot it and then xx$counts HIH Stefano On Wed, Jul 18, 2007 at 12:34:42PM +0200, Manuele Pesenti wrote: ManueleI have seen that the hist() function plots an histogram of the frequency but I Manuelecannot find the value of the object hist that contains theese values... how Manueleis possible to get out them? Manuele Manuelethank you very mutch Manuelebest regards Manuele Manuele Manuele Manuele Manuele Manuele-- ManueleManuele Pesenti Manuele [EMAIL PROTECTED] Manuele [EMAIL PROTECTED] Manuele http://mpesenti.polito.it Manuele Manuele__ ManueleR-help@stat.math.ethz.ch mailing list Manuelehttps://stat.ethz.ch/mailman/listinfo/r-help ManuelePLEASE do read the posting guide http://www.R-project.org/posting-guide.html Manueleand provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Subsetting Enigma: More rows after dataframe[-list,]?
On Wed, 2007-07-18 at 11:40 +0200, Johannes Graumann wrote: Hello again, I'm trying to purge the indexes in i.delete from frame and end up with more rows!? Please be so kind and let me know where I screw this up ... I think you'll have to explain why you think there are more rows after using i.delete than before. (1975 - 173 = 1802). By purge, you mean delete the rows indexed by i.delete? If so, you are doing nothing wrong: frame - data.frame(matrix(runif(1975*10), ncol = 10)) i.delete - sample(nrow(frame), 173) # random rows to delete nrow(frame) [1] 1975 nrow(frame[-i.delete, ]) [1] 1802 nrow(frame) nrow(frame[-i.delete, ]) [1] TRUE G Joh i.delete [1] 40 45 165 212 253 270 280 287 301 352 421 433 463 467 487 [16] 517 537 542 573 594 596 612 614 621 635 650 696 699 707 732 [31] 738 776 826 891 892 936 937 935 940 976 988 995 1037 1043 1059 [46] 1081 1123 1128 1132 1140 1153 1155 1165 1176 1179 1200 1281 1289 1300 [61] 1320 1346 1356 1366 1369 1396 1406 1420 1428 1429 1471 1474 1475 1525 1540 [76] 1554 1565 1645 1667 1665 1706 1711 1724 1764 1788 1791 1805 1808 1847 1881 [91] 10 18 137 238 254 260 262 288 292 314 338 349 414 447 457 [106] 465 470 478 511 530 536 552 582 588 644 655 687 693 701 724 [121] 739 763 771 836 848 859 888 900 902 919 939 972 979 989 1000 [136] 1002 1015 1020 1026 1029 1032 1055 1060 1073 1088 1104 1117 1124 1130 1135 [151] 1144 1221 1225 1249 1251 1257 1376 1384 1386 1453 1487 1529 1532 1534 1605 [166] 1624 1633 1646 1648 1702 1787 1948 1951 length(i.delete) [1] 173 nrow(frame) [1] 1975 nrow(frame[-i.delete,]) [1] 1802 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 combine presence only data sets to one presence/absence table
Patrick Zimmermann wrote: Problem: I have a Set of samples each with a list of observed species (presence only). Data is stored in a excel spreadsheet and the columns (spl) have different numbers of observations (spcs). Now I want to organize the data in a species by sample matrix with presence/absence style in R. data style (in excel): spl_A spl_B spl_C spcs1 spcs1 spcs2 spcs2 spcs3 spcs3 spcs4 spcs5 spcs5 desired style: spl_A spl_B spl_C spcs1 1 1 0 spcs2 1 0 1 spcs3 0 1 1 . . . How and in which form do I import the data to R? (read.table() seems not to be appropriate, as data is not organized as a table) How can I create the species by sample matrix? I'm not going to tackle how to read in the Excel data, but assuming you had several vectors of species names gather together in a list, you could construct a presence/absence data frame or matrix as follows: spl_A - c(spcs1,spcs2,spcs4,spcs5) spl_B - c(spcs1,spcs3) spl_C - c(spcs2,spcs3,spcs5) mylist - list(spl_A = spl_A, spl_B = spl_B, spl_C = spl_C) mymat - sapply(mylist, function(x){as.numeric(sort(unique(unlist(mylist))) %in% x)}) rownames(mymat) - sort(unique(unlist(mylist))) mymat spl_A spl_B spl_C spcs1 1 1 0 spcs2 1 0 1 spcs3 0 1 1 spcs4 1 0 0 spcs5 1 0 1 Thanks for any help, Patrick Zimmermann __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 : Combine R2HTML and Rcmd BATCH?
I have an R script that spawns output in the form of an HTML page. This is done by the R2HTML package. Now I want to run the same script using Rcmd BATCH. However, it seems that it is not possible to use R2HTML in this case. My script ends with this error message: # Error in dev.print(png, file = AbsGraphFileName, width = Width, height = Height, : can only print from screen device Execution halted # I can not find how to work around this problem in the R2HTML manual or the help archives. Has anybody done a similar thing before? Any suggestions? I'm not entierly sure this is what you want, but you may find the GDD package useful. I use it to generate graphs when I run scripts remotely or via batches and don't have a graphical display. Neil -- In mathematics you don't understand things. You just get used to them. - Johann von Neumann Email - [EMAIL PROTECTED] / [EMAIL PROTECTED] Website - http://slack.ser.man.ac.uk/ Photos - http://www.flickr.com/photos/slackline/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] remove columns having a partial match name
Dear all, I would like to know how can I retrieve a data.frame without the columns that have a partial match name. Let´s say that I have a data.frame with 200 columns and 100 of them have the name StartX, with X being the unique part for each column name. I want to delete all columns that have the name starting with Start. I´ve tried to do this but it doesn´t work: DATA_OK - DATA[,-match((Start*),names(DATA))] dim(DATA_OK) NULL Thanks in advance. Best regards João Fadista Ph.d. student UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers Allé 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1900 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.agrsci.org http://www.agrsci.org/ News and news media http://www.agrsci.org/navigation/nyheder_og_presse . This email may contain information that is confidential. Any use or publication of this email without written permission from Faculty of Agricultural Sciences is not allowed. If you are not the intended recipient, please notify Faculty of Agricultural Sciences immediately and delete this email. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] remove columns having a partial match name
Hi, DATA_OK - DATA[,-match(Start, names(DATA))] -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 18/07/07, João Fadista [EMAIL PROTECTED] wrote: Dear all, I would like to know how can I retrieve a data.frame without the columns that have a partial match name. Let´s say that I have a data.frame with 200 columns and 100 of them have the name StartX, with X being the unique part for each column name. I want to delete all columns that have the name starting with Start. I´ve tried to do this but it doesn´t work: DATA_OK - DATA[,-match((Start*),names(DATA))] dim(DATA_OK) NULL Thanks in advance. Best regards João Fadista Ph.d. student UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers Allé 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1900 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.agrsci.org http://www.agrsci.org/ News and news media http://www.agrsci.org/navigation/nyheder_og_presse . This email may contain information that is confidential. Any use or publication of this email without written permission from Faculty of Agricultural Sciences is not allowed. If you are not the intended recipient, please notify Faculty of Agricultural Sciences immediately and delete this email. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] remove columns having a partial match name
DATA_OK - DATA[-grep(^Start, names(DATA)),] On 7/18/07, João Fadista [EMAIL PROTECTED] wrote: Dear all, I would like to know how can I retrieve a data.frame without the columns that have a partial match name. Let´s say that I have a data.frame with 200 columns and 100 of them have the name StartX, with X being the unique part for each column name. I want to delete all columns that have the name starting with Start. I´ve tried to do this but it doesn´t work: DATA_OK - DATA[,-match((Start*),names(DATA))] dim(DATA_OK) NULL Thanks in advance. Best regards João Fadista Ph.d. student UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers Allé 20, P.O. BOX 50 DK-8830 Tjele Phone: +45 8999 1900 Direct: +45 8999 1900 E-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Web: www.agrsci.org http://www.agrsci.org/ News and news media http://www.agrsci.org/navigation/nyheder_og_presse . This email may contain information that is confidential. Any use or publication of this email without written permission from Faculty of Agricultural Sciences is not allowed. If you are not the intended recipient, please notify Faculty of Agricultural Sciences immediately and delete this email. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [R-sig-DB] RODBC on Oracle DB
On Wed, 2007-07-18 at 08:04 +0100, Prof Brian Ripley wrote: On Tue, 17 Jul 2007, Marc Schwartz wrote: Try the sqlQuery() syntax with a semi-colon at the end of it: sqlQuery(essai, select * from S_TYP_COLLEGES;) Oracle requires the semi-colon at the end of the SQL statement. Over ODBC? I've never heard of that, and others have used RODBC to Oracle successfully when it does not itself add semicolons. What sqlFetch is running is (in a vanilla setup) SELECT * FROM 'S_TYP_COLLEGES', and we've heard of a few cases where the quotes were a problem, hence my suggestion. The error message is not a syntax error (which is what I would expect from a missing terminator), but that the table/view is not found. I stand corrected. I was going from memory pertaining to some prior errors that I had when setting up my unixODBC/RODBC connection on Fedora to our Oracle server. Adding the semi-colon to the query string seemed to have helped to resolve at least part of the issue, but perhaps it was merely a red-herring. I just tried it here from home over our VPN and the queries worked with and without the semi-colon. Thanks for pointing that out. Regards, Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 open an URL using RGtk2
Hi I am working on R 2.5.0 on window. I am trying to provide a Hyper-link to the user as a result, I have tried using gtkLinkButton to exercise the facility, however, i am not able to perform the required task, i.e. when I clicked on the LinkButton actually nothing happened. I have gone through the documentation for the same and found that GtkLinkButtonUriFunc is a function which is require to do something with the opening of the given URL. Further, I didn't find any other information regarding this. Following is my code: messlab - gtkLabelNew(str = Please wait!, show = TRUE) messwin - gtkWindowNew(type = NULL, show = TRUE) messwin$Add(messlab) gtkWindowResize(messwin, 250, 60) gtkWindowSetTitle(messwin, Graph Analysis) fihor - gtkHPanedNew(show = TRUE) fn - gtkLinkButtonNewWithLabel(http://cran.r-project.org/;, Result Link!) messwin$Remove(messlab) gtkLabelSetText(messlab, Result link is ::) gtkPanedAdd1(fihor, messlab) gtkPanedAdd2(fihor, fn) gtkPanedSetPosition(fihor, 100) gtkWindowSetTitle(messwin, Result Link) gtkWindowResize(messwin, 380, 60) messwin$Add(fihor) I am confused how to make this link workable on click? Your replies/suggestions are important to me. Please suggest solution. Thanks in advance. Divya Sarthi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Neuman-Keuls
hello, I have programmed this function to calculate the Neuman-Keuls test but I have a problem the function return an empty list and I don't know why. summary(fm1) E - sqrt((summary(fm1)[[1]][Residuals,Mean Sq])/length(LR)) lst - list() lst1 - list() lst2 - list() NK - function (x) { if (length(x) == 2) { Tstudent - t.test(subset(exple, groupe == names(x)[1])$vd,subset(exple, groupe == names(x)[2])$vd) t - as.numeric(Tstudent$statistic) if (t = Tstudent$conf.int[1:2][1] t = Tstudent$conf.int[1:2][2]) { lst1[[1]] - x lst - c(lst,lst1) } else { lst1[[1]] - x[1] lst2[[1]] - x[2] lst - c(lst,lst1) lst - c(lst,lst2) } } else { test - x[c(1,length(x))] Q - (as.numeric(test[2]) - as.numeric(test[1]))/E qtt - qtukey(0.95,length(x),df=41) if (Q qtt) { lst1[[1]] - range(x) lst - c(lst,lst1) } else { x1 - x[-length(x)] x2 - x[-1] NK(x1) NK(x2) } } return(lst) } with fm1 Call: aov(formula = vd ~ groupe, data = exple) Terms: groupe Residuals Sum of Squares 300.9871 27. Deg. of Freedom 2041 Residual standard error: 0.8115027 Estimated effects may be unbalanced Can you help me please? thanks. _ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 combine presence only data sets to one presence/absence table
I think you can still read as a table, just use argument fill=TRUE. Reading from Excel in general: you can save data as 'csv' or tab-delimited file and then use read.csv or read.delim, respectively, or use one of the packages listed in the following post (for some reason lines breaks are messed up but hope you can extract the content): http://tolstoy.newcastle.edu.au/R/e2/help/07/06/19925.html ## read in data x - read.table(textConnection( spl_A spl_B spl_C spcs1 spcs1 spcs2 spcs2 spcs3 spcs3 spcs4 spcs5 spcs5 ),fill=TRUE,header=TRUE,na.string=) Then, ## 1. find unique spcs - sort(na.omit(unique(unlist(x ## 2. create matrix of zeros mat - matrix(0,ncol=ncol(x),nrow=length(spcs), dimnames=list(spcs,names(x))) ## 3. assign zeros to matches for( i in 1:ncol(mat) ) mat[match(x[,i],rownames(mat)),i] - 1 Alternatively, ## find unique spcs - sort(na.omit(unique(unlist(x ## return the matrix you want (combine steps 2 and 3 from above) sapply(x,function(.x,spcs) names-(ifelse(!is.na(match(spcs,.x)),1,0),spcs),spcs) Hope this helps. ST --- Patrick Zimmermann [EMAIL PROTECTED] wrote: Problem: I have a Set of samples each with a list of observed species (presence only). Data is stored in a excel spreadsheet and the columns (spl) have different numbers of observations (spcs). Now I want to organize the data in a species by sample matrix with presence/absence style in R. data style (in excel): spl_A spl_B spl_C spcs1 spcs1 spcs2 spcs2 spcs3 spcs3 spcs4 spcs5 spcs5 desired style: spl_A spl_B spl_C spcs1 1 1 0 spcs2 1 0 1 spcs3 0 1 1 . . . How and in which form do I import the data to R? (read.table() seems not to be appropriate, as data is not organized as a table) How can I create the species by sample matrix? Thanks for any help, Patrick Zimmermann __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 open an URL using RGtk2
On 7/18/07, d. sarthi maheshwari [EMAIL PROTECTED] wrote: Hi I am working on R 2.5.0 on window. I am trying to provide a Hyper-link to the user as a result, I have tried using gtkLinkButton to exercise the facility, however, i am not able to perform the required task, i.e. when I clicked on the LinkButton actually nothing happened. I have gone through the documentation for the same and found that GtkLinkButtonUriFunc is a function which is require to do something with the opening of the given URL. Further, I didn't find any other information regarding this. Have you installed GtkLibs: http://www.omegahat.org/RGtk/Windows/ Senthil __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] EM unsupervised clustering
Hi All, I have a n x m matrix. The n rows are individuals, the m columns are variables. The matrix is in itself a collection of 1s (if a variable is observed for an individual), and 0s (is there is no observation). Something like: [,1] [,2] [,3] [,4] [,5] [,6] [1,]101100 [2,]101100 [3,]101100 [4,]010000 [5,]101100 [6,]010010 I use kmeans to find 2 or 3 clusters in this matrix k2 = kmeans(data, 2, 1000) k3 = kmeans(data, 3, 1000) but I would like to use something a bit more refined, so I though about a EM based clustering. I am using the Mclust() function from the mclust package, but I get the following (to me incomprehensible) error message: plot(Mclust(as.data.frame(data)), as.data.frame(data)) Hit Return to see next plot: Hit Return to see next plot: Hit Return to see next plot: Error in 1:L : NA/NaN argument In addition: Warning messages: 1: best model occurs at the min or max # of components considered in: summary.mclustBIC(Bic, data, G = G, modelNames = modelNames) 2: optimal number of clusters occurs at min choice in: Mclust(as.data.frame(anc.st.mat)) 3: insufficient input for specified plot in: coordProj(data = data, parameters = x$parameters, z = x$z, what = classification, That's puzzling because the example given by ?Mclust is something like plot(Mclust(iris[,-5]), iris[,-5]) which is pretty simple and dumbproof and works flawlessly... best, Federico -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] EM unsupervised clustering
you could also have a look at function lca() from package `e1071' that performs a latent class analysis, e.g., fit1 - lca(data, 2) fit1 fit2 - lca(data, 3) fit2 I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Federico Calboli [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Sent: Wednesday, July 18, 2007 3:37 PM Subject: [R] EM unsupervised clustering Hi All, I have a n x m matrix. The n rows are individuals, the m columns are variables. The matrix is in itself a collection of 1s (if a variable is observed for an individual), and 0s (is there is no observation). Something like: [,1] [,2] [,3] [,4] [,5] [,6] [1,]101100 [2,]101100 [3,]101100 [4,]010000 [5,]101100 [6,]010010 I use kmeans to find 2 or 3 clusters in this matrix k2 = kmeans(data, 2, 1000) k3 = kmeans(data, 3, 1000) but I would like to use something a bit more refined, so I though about a EM based clustering. I am using the Mclust() function from the mclust package, but I get the following (to me incomprehensible) error message: plot(Mclust(as.data.frame(data)), as.data.frame(data)) Hit Return to see next plot: Hit Return to see next plot: Hit Return to see next plot: Error in 1:L : NA/NaN argument In addition: Warning messages: 1: best model occurs at the min or max # of components considered in: summary.mclustBIC(Bic, data, G = G, modelNames = modelNames) 2: optimal number of clusters occurs at min choice in: Mclust(as.data.frame(anc.st.mat)) 3: insufficient input for specified plot in: coordProj(data = data, parameters = x$parameters, z = x$z, what = classification, That's puzzling because the example given by ?Mclust is something like plot(Mclust(iris[,-5]), iris[,-5]) which is pretty simple and dumbproof and works flawlessly... best, Federico -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] EM unsupervised clustering
Dimitris Rizopoulos wrote: you could also have a look at function lca() from package `e1071' that performs a latent class analysis, e.g., fit1 - lca(data, 2) I tried but I got: lca(data, 2) Error in matrix(0, 2^nvar, nvar) : matrix: invalid 'nrow' value (too large or NA) In addition: Warning message: NAs introduced by coercion in: matrix(0, 2^nvar, nvar) and dim(mat) is 110 and 109. I am puzzled. Cheers, Fede -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [R-sig-DB] RODBC on Oracle DB
I believe I have seen that error message from Oracle when I tried to query a table for which I did not have select privileges (and when I knew for certain that the table existed). Ask your database administrator about the table, and make sure that you do have that privilege. What I am uncertain about is whether Oracle, when asked to list tables, returns a list that includes tables for which the user does not have select privileges. -Don At 9:24 AM +0200 7/17/07, [EMAIL PROTECTED] wrote: essai - odbcConnect(ORESTE_prod, uid=osis_r, pwd=12miss15 ,case=oracle) sqlTables(essai)$ORESTE ... 1315 NA ORESTE S_PROFESSIONS_OLDTABLENA 1316 NA ORESTE S_PROVENANCESTABLENA 1317 NA ORESTES_SEXESTABLENA 1318 NA ORESTE S_SOUS_CLASSESTABLENA 1319 NA ORESTE S_TYP_COLLEGESTABLENA 1320 NA ORESTE S_TYP_ENSEIGNEMENTTABLENA ... sqlQuery(essai, select * from S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n I have also tried the essai2 - odbcDriverConnect(connection=essai2) But with no succes. On Lun Juil 16 15:32 , Prof Brian Ripley [EMAIL PROTECTED] sent: The problem could be quoting, if Oracle is not standards-compliant. See the options in ?odbcConnect. If sqlQuery(essai, select * from S_TYP_COLLEGES) works, this is likely to be the problem. On Mon, 16 Jul 2007, [EMAIL PROTECTED] wrote: essai odbcGetInfo(essai) DBMS_Name DBMS_Ver Driver_ODBC_Ver Oracle 09.00.0121 03.51 Data_Source_Name Driver_Name Driver_Ver ORESTE_prodSQORA32.DLL 09.00.0101 ODBC_Ver Server_Name 03.52. weba sqlTables(essai) The result of this function is a liste of tables, one of them is called: S_TYP_COLLEGES. sqlFetch(essai,S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n sqlFetch(essai, S_TYP_COLLEGES, colnames=TRUE, rownames=FALSE) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n What could be the problem here ? Any help is welcome Eric Röthlisberger, Neuchâtel ___ R-sig-DB mailing list -- R Special Interest Group [EMAIL PROTECTED] https://stat.ethz.ch/mailman/listinfo/r-sig-db -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] random number generation
Hi there, I am relatively new user of R. I need to generate random number following Gamma distribution with mean 14 und st.dev 3. I read the help-text but I can not understand it well. Regards, Azizi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Forall symbol with plotmath/grid
I am trying to get the forall symbol (upside down A) as part of the label of a lattice plot. Is there an easy way to do this? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Can any one help me on format file data.
Hi all. I'd like know what is the format file saved by Leica Microsystems TCS SP2-AOBS equipped with a SP2-FCS2 Leica Microsystems workstation its datas. Cause it save in *.fcs extention file but ins't flow cytometry standart format file... Tahnks Horacio. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Optimization question
Dear R users, Imagine please an optimization problem: minimize sum S1+S2 Subject to : y - x = a + S1 x - y = a + S2 and we want to add two more constraints: y - x = b - S3 x - y = b - S4 where a is a small constant value and b is a large constant value, S1 and S2 are surplus and S3 and S4 are slack variables. S3 and S4 have to be maximized, not minimized in objective function. But how to write this? Is this correct? : minimize sum S1+ S2 - S3 -S4 where actually we want to minimize S1 and S2; and maximize S3 and S4. If it is not correct, how to formulate this? what to do ? Thank you for any guide. Tobias - Pinpoint customers who are looking for what you sell. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] HSAURtable question
It appears that HSAURtable only works on two dimensional tables. Is this correct? For example, here is HairEyeColor: , , Sex = Male Eye HairBrown Blue Hazel Green Black32 1110 3 Brown38 502515 Red 10 10 7 7 Blond 3 30 5 8 , , Sex = Female Eye HairBrown Blue Hazel Green Black369 5 2 Brown81 342914 Red 167 7 7 Blond 4 64 5 8 HSAURtable(HairEyeColor) only uses the first matrix above HSAURtable(HairEyeColor) $xname [1] HairEyeColor $pkg NULL $varnames [1] Hair Eye Sex $data [,1][,2][,3] [,4][,5] [1,] Brown Blue Hazel Green [2,] Black 3211 103 [3,] Brown 3850 2515 [4,] Red 1010 7 7 [5,] Blond 3 30 5 8 attr(,class) [1] tabtab __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] random number generation
Hello Hadi, See ?rgamma The Gamma distribution usually takes two parameters, shape and scale, not the mean and st. deviation. If you have data, you can estimate those parameters using MLE methods, which are nicely provided in MASS: library(MASS) fitdistr(yourdata,Gamma) Once you have your parameters you can generate random values using rgamma i.e. rgamma(1000,10,1) will generate 1000 random samples from a Gamma distribution with shape = 10 and scale = 1. If you only have the mean and standard deviation you can approximate the shape and scale parameters using: scale=variance/mean shape=mean^2/var Remember the variance is equal to sd^2 I hope this helps, Francisco J. Zagmutt PS: Please read the posting guide (see the link at the bottom of this email). It really helps people trying to help you :-) Hadi Darzian Azizi wrote: Hi there, I am relatively new user of R. I need to generate random number following Gamma distribution with mean 14 und st.dev 3. I read the help-text but I can not understand it well. Regards, Azizi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Strange warning in summary.lm
Dear useRs, Lately I noticed a strange warning in the summary of a lm-object. Any idea what this warning is about? I'm using R 2.5.1 on Win XP pro. x - rnorm(100) y - rnorm(100) summary(lm(y~x)) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -1,77809 -0,68438 -0,04409 0,63891 2,30863 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -0,002170,09244 -0,0230,981 x0,013150,09628 0,1370,892 Residual standard error: 0,9236 on 98 degrees of freedom Multiple R-Squared: 0.0001903, Adjusted R-squared: -0.01001 F-statistic: 0.01866 on 1 and 98 DF, p-value: 0,8916 Warning message: NAs introduced by coercion in: as.double.default(Cf[okP]) Thanks, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be Do not put your faith in what statistics say until you have carefully considered what they do not say. ~William W. Watt A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] SLLOOOWWW function ...
At 12:32 17/07/2007, Johannes Graumann wrote: Does anybody have any insight into how to make this faster? I am not an expert on R programming by any means but I notice you are growing your new data frame row by row. I believe it is normally recommended to allocate enough space to start with. I suspect, that the rounding going on may be an issue, as is the stepping through data frame rows using integers ... If you have the patience to teach a noob, he will highly appreciate it ;0) Joh digit - 4 for (minute in seq(from=25,to=lrange[2])){ # Extract all data associtaed with the current time (minute) frame - subset(mylist,mylist[[Time]] == minute) # Sort by Intensity frame - frame[order(frame[[Intensity]],decreasing = TRUE),] # Establish output frame using the most intense candidate newframe - frame[1,] # Establish overlap-checking vector using the most intense candidate lowppm - round(newframe[1,][[Mass]]-newframe[1, [[Mass]]/1E6*ppmrange,digits=digit) highppm - round(newframe[1,][[Mass]]+newframe[1, [[Mass]]/1E6*ppmrange,digits=digit) presence - seq(from=lowppm,to=highppm,by=10^(-digit)) # Walk through the entire original frame and check whether peaks are overlap-free ... do so until max of 2000 entries for (int in seq(from=2,to=nrow(frame))) { if(nrow(newframe) 2000) { lowppm - round(frame[int,][[Mass]]-frame[int, [[Mass]]/1E6*ppmrange,digits=digit) highppm - round(frame[int,][[Mass]]+frame[int, [[Mass]]/1E6*ppmrange,digits=digit) windowrange - seq(from=lowppm,to=highppm,by=10^(-digit)) if (sum(round(windowrange,digits=digit) %in% round(presence,digits=digit)) 1) { newframe - rbind(newframe,frame[int,]) presence - c(presence,windowrange) } } else { break() } } Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Ideal number of clusters using the Fanny algorithm
Hello, Could someone please let me know the procedure for determining the 'best' solution with regards to the number of clusters using the Fanny algorithm for computing fuzzy clusters? The function requires a specification of the number of clusters a priori, but I am interested in determining what number of clusters would result in the ideal fit with the data. Any help/advice/pointers to resources on the WWW would be greatly appreciated. Thank you. Srikanth. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Flow Cytometry Standard, fcs format in R.
2007/7/16, Bernardo Rangel Tura [EMAIL PROTECTED]: On Fri, 2007-07-13 at 16:06 -0300, Horacio Castellini wrote: Hi all. How do I extract date from fcs format file with R. I.e I'd like make statistical analysis using R-program, but I don't know if there are R-packets for fcs format file, and using examples. Thanks. Hi Horacio! Is possible using rflowcyt or prada available in http://www.bioconductor.org In Rnews have article about this: http://cran.r-project.org/doc/Rnews/Rnews_2006-5.pdf Bernardo Rangel Tura, MD, Ph.D National Institute of Cardiology Rio de Janeiro - Brazil Thanks, but the format file wich datas are saving, it isn't flow cytometry standar. Leica Microsystems TCS SP2-AOBS equipped with a SP2-FCS2 Leica Microsystems workstation save its data in *.fcs file extention but I don't know what format type is it? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] can I run/launch an excel VBA macro from wihin R?
FYI, Here is a tip that Gabor Grothendieck sent to the r-com help-list. Thought others might find it helpful. http://mailman.csd.univie.ac.at/pipermail/rcom-l/2007-July/001717.html Subject: Re: [Rcom-l] running Excel/Visual Basic macro from within R[input] [input] [input] [input] mailing list [EMAIL PROTECTED] http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at}, lw_1184777019_4: { text: http://rcom.univie.ac.at;, extended: 0, startchar: 1766, endchar: 1789, start: 1766, end: 1789, extendedFrom: , weight: 1, type: [shortcuts:/us/instance/identifier/URL], category: [IDENTIFIER] ,context: More information (including a Wiki) at http://rcom.univie.ac.at __}, lw_1184777019_5: { text: [EMAIL PROTECTED], extended: 0, startchar: 1864, endchar: 1894, start: 1864, end: 1894, extendedFrom: , weight: 1, type: [shortcuts:/us/instance/identifier/email_address], category: [IDENTIFIER] ,context: mailing list [EMAIL PROTECTED] http://mailman.csd.univie.ac.at/mailman/listinfo}, lw_1184777019_6: { text: http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l;, extended: 0, startchar: 1896, endchar: 1950, start: 1896, end: 1950, extendedFrom: , weight: 1, type: [shortcuts:/us/instance/identifier/URL], category: [IDENTIFIER] ,context: mailing list [EMAIL PROTECTED] http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l More information (including a Wiki) at}, lw_1184777019_7: { text: http://rcom.univie.ac.at;, extended: 0, startchar: 1991, endchar: 2014, start: 1991, end: 2014, extendedFrom: , weight: 1, type: [shortcuts:/us/instance/identifier/URL], category: [IDENTIFIER] ,context: information (including a Wiki) at http://rcom.univie.ac.at} }; YAHOO.Shortcuts.overlaySpaceId = 97546169; YAHOO.Shortcuts.hostSpaceId = 97546168; classExec is a powerful free Windows utility that allows you to do this (and many other tasks) by giving you a general hook into Windows DDE in batch, i.e at the Windows command line: http://web.archive.org/web/20051218074743/http://home.wanadoo.nl/fvu/Projects/ClassExec/Web/classExec.htm See the example on that page and also google for ddeexecute to find relevant pages for the --command argument should you want to use it for other applications as well. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] sqlSave, ...colnames=F, using odbcConnectExcel .... I still get colnames in top row of exprted sheet
I am trying to save an R data.frame as an Excel sheet. I do NOT want the column names saved into row 1. I set colnames=F. However, it still seems that the colnames are saved into row 1. Is this a bug? Or am I coding incorrectly and.or misunderstanding this feature? #example code: sheet = c:/test2.xls temp=data.frame(matrix(data=NA,nrow=10,ncol=15)) temp[1,1] = 'sampletext.1.1' temp[1,2] = 'sampletext.1.2' library(RODBC) odbcClose(channel) file.remove(sheet) channel - odbcConnectExcel(sheet, readOnly=FALSE) sqlSave(channel, temp, p, fast=FALSE,rownames=F,colnames=F) odbcClose(channel) - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] [R-sig-DB] RODBC on Oracle DB
I think that you are on to something there Don. I just tried accessing a table from our Oracle server, which I do know exists, but for which I do not have access permissions. Using the following query in the Oracle Instant Client: select table_name from all_tables; I can get a list of all tables on the server, which includes a table called INCOMPATIBLE_USER_AGENTS, for which I do not have access permissions. When attempting to query the table in the Instant Client I get: SQL select * from INCOMPATIBLE_USER_AGENTS; select * from INCOMPATIBLE_USER_AGENTS * ERROR at line 1: ORA-00942: table or view does not exist When running the same query from R using RODBC I get: sqlQuery(db, select * from INCOMPATIBLE_USER_AGENTS) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: table or view does not exist\n So it looks like permission issues may be possible here. Eric, definitely confirm with your SysAdmins that you have appropriate permissions. HTH, Marc On Wed, 2007-07-18 at 07:43 -0700, Don MacQueen wrote: I believe I have seen that error message from Oracle when I tried to query a table for which I did not have select privileges (and when I knew for certain that the table existed). Ask your database administrator about the table, and make sure that you do have that privilege. What I am uncertain about is whether Oracle, when asked to list tables, returns a list that includes tables for which the user does not have select privileges. -Don At 9:24 AM +0200 7/17/07, [EMAIL PROTECTED] wrote: essai - odbcConnect(ORESTE_prod, uid=osis_r, pwd=12miss15 ,case=oracle) sqlTables(essai)$ORESTE ... 1315 NA ORESTE S_PROFESSIONS_OLDTABLE NA 1316 NA ORESTE S_PROVENANCESTABLE NA 1317 NA ORESTES_SEXESTABLE NA 1318 NA ORESTE S_SOUS_CLASSESTABLE NA 1319 NA ORESTE S_TYP_COLLEGESTABLE NA 1320 NA ORESTE S_TYP_ENSEIGNEMENTTABLE NA ... sqlQuery(essai, select * from S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n I have also tried the essai2 - odbcDriverConnect(connection=essai2) But with no succes. On Lun Juil 16 15:32 , Prof Brian Ripley [EMAIL PROTECTED] sent: The problem could be quoting, if Oracle is not standards-compliant. See the options in ?odbcConnect. If sqlQuery(essai, select * from S_TYP_COLLEGES) works, this is likely to be the problem. On Mon, 16 Jul 2007, [EMAIL PROTECTED] wrote: essai odbcGetInfo(essai) DBMS_Name DBMS_Ver Driver_ODBC_Ver Oracle 09.00.0121 03.51 Data_Source_Name Driver_Name Driver_Ver ORESTE_prodSQORA32.DLL 09.00.0101 ODBC_Ver Server_Name 03.52. weba sqlTables(essai) The result of this function is a liste of tables, one of them is called: S_TYP_COLLEGES. sqlFetch(essai,S_TYP_COLLEGES) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n sqlFetch(essai, S_TYP_COLLEGES, colnames=TRUE, rownames=FALSE) [1] [RODBC] ERROR: Could not SQLExecDirect [2] 42S02 942 [Oracle][ODBC][Ora]ORA-00942: Table ou vue inexistante\n What could be the problem here ? Any help is welcome Eric Röthlisberger, Neuchâtel __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Linear programming question
Hi everybody, consider please an optimization problem: minimize sum S1+S2 Subject to : y - x = A + S1 x - y = A + S2 and we want to add two more constraints: y - x = B - S3 x - y = B - S4 where A is a small constant value and B is a large constant value, S1 and S2 are surplus and S3 and S4 are slack variables. S3 and S4 have to be maximized in objective function. As objective function, is this correct? : minimize sum S1+ S2 - S3 -S4 where actually we want to minimize S1 and S2; and maximize S3 and S4. If it is not correct, what to do ? Thank you for any guide. Tobias - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] poor rbind performance
As Jim points out, building up a data frame by rbinding in a loop can be a slow way to do things in R. Here's an example of how you can easily read data frames into a list: # Create 3 files invisible(lapply(1:3, function(i) write.csv(file=paste(tmp,i,.csv,sep=), data.frame(i=2*i+(1:2),c=letters[2*i+(1:2)] # Read the files into a list of data frames list.of.dfs - lapply(paste(tmp,1:3,.csv,sep=), read.csv, row.names=1) # rbind the data frames myData - do.call(rbind, list.of.dfs) myData i c 1 3 c 2 4 d 3 5 e 4 6 f 5 7 g 6 8 h (and of course, these last two expressions can be composed into a single expression if you want) -- Tony Plate Aydemir, Zava (FID) wrote: Hi I rbind data frames in a loop in a cumulative way and the performance detriorates very quickly. My code looks like this: for( k in 1:N) { filename - paste(/tmp/myData_,as.character(k),.txt,sep=) myDataTmp - read.table(filename,header=TRUE,sep=,) if( k == 1) { myData - myDataTmp } else{ myData - rbind(myData,myDataTmp) } } Some more details: - the size of the stored text files is about 100,000 rows and 50 columns each - for k=1: rbind takes 0.0004 seconds - for k=2: rbind takes 13 seconds - for k=3: rbind takes 30 seconds - for k=4: rbind takes 36 seconds etc Any suggestions to improve speed? Thanks Zava This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 MySQL Configuration
Quick question about the configuration files relative to RMySQL (I've tried to get feedback directly from the author David James, but his email address was non-responsive): Documentation at http://cran.r-project.org/doc/packages/RMySQL.pdf on page 3 indicates that for windows machines the only place that the my.cnf file will be looked for is the root (C:\) directory. Is this read correct? When launching R, I've set the HOME directory elsewhere, but am unsuccessful in getting recognition of my group definitions in this way (only works when the file is in C:\ ) Does anybody know if there are plans to implement the default.file option noted on page 17 of the same documentation (noted as Currently unused)? If I set it now, I get Error in mysqlNewConnection(drv, ...): unused argument(s) (default.file ...) My goal is to eliminate plain text database passwords from my computer and at least put it on a secured network location, but I need to let RMySQL know how to find it. Thanks for your help. Regards, Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
Michael Assume your data frame is called data and your variable is called V1. Converting this to a factor is: data$V1 - factor(data$V1) Creating the classes can be done using ifelse(). Something like data$class - ifelse(data$V1 .21, A, ifelse(data$V1 .41, B, C)) Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ing. Michal Kneifl, Ph.D. Sent: Wednesday, July 18, 2007 1:37 PM To: r-help@stat.math.ethz.ch Subject: [R] Classification Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] set up automatic running of R
Hi useR, I am trying to find how to schedule an automatic run of R periodically, I have written some scripts to extract data which are updated monthly on another server, my os is xp. The goal is that my script will run at a scheduled time every month and record the results to some directories. Now the scripts are done, only thing I need is to know how to let R run my scripts at a certain time, say the first Sunday of each months. Could anyone give me some clues? Thanks a million in advance! Best, Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
Have a look at the recode function in the car package library(car) ?recode should give you what you need. --- Ing. Michal Kneifl, Ph.D. [EMAIL PROTECTED] wrote: Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] nested for loop
Hi, I am new to programming and R. I am reading the manual and R books by Dalgaard and Veranzo to help answer my questions but I am unable to figure out the following: I have a data file that contains 1080 data points. Here's a snippet of the file: [241] 0.3603704000 0.1640741000 0.2912963000 NA 0.0159259300 0.0474074100 I would like to break the file up into 30 consecutive data point segments and then write each segment into a separate data file. This is one version of code that I've tried. mons = c(1:12) data = scan(paste(C:/R/NWR.txt)) for (mon in mons) { for (i in c(1:30)) { for (j in data){ write((data),paste(mon,'NWR dc_dt_zi ppm meters per sec.txt',sep=''),ncol=1) } } } I think I'm really close, but no cigar. Thanks in advance for any help- S.Heck Graduate Research Assistant University of Colorado, Boulder __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear programming question
Tobias, Adding the first constraints yields: S1 + S2 = -2A Similarly adding the second set of constraints: S3 + S4 = 2B If A and B are positive (which you didn't specify) then The minimum of S1+S2 is -2A, and the maximum of S3+S4 is 2B. Thus, the minimum of S1+S2-S3-S4 is -2(A+B). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tobias Schlottmann Sent: Wednesday, July 18, 2007 1:24 PM To: r-help@stat.math.ethz.ch Subject: [R] Linear programming question Hi everybody, consider please an optimization problem: minimize sum S1+S2 Subject to : y - x = A + S1 x - y = A + S2 and we want to add two more constraints: y - x = B - S3 x - y = B - S4 where A is a small constant value and B is a large constant value, S1 and S2 are surplus and S3 and S4 are slack variables. S3 and S4 have to be maximized in objective function. As objective function, is this correct? : minimize sum S1+ S2 - S3 -S4 where actually we want to minimize S1 and S2; and maximize S3 and S4. If it is not correct, what to do ? Thank you for any guide. Tobias - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
maybe: x = c(.2, .1, .8, .3, .7, .6, .01, .2, .5, 1, 1) breaks = seq(0, 1, .2) LETTERS[1:(length(breaks)-1)][cut(x, breaks)] b On Jul 18, 2007, at 1:50 PM, Doran, Harold wrote: Michael Assume your data frame is called data and your variable is called V1. Converting this to a factor is: data$V1 - factor(data$V1) Creating the classes can be done using ifelse(). Something like data$class - ifelse(data$V1 .21, A, ifelse(data$V1 .41, B, C)) Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ing. Michal Kneifl, Ph.D. Sent: Wednesday, July 18, 2007 1:37 PM To: r-help@stat.math.ethz.ch Subject: [R] Classification Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
On Wed, 2007-07-18 at 19:36 +0200, Ing. Michal Kneifl, Ph.D. wrote: Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael See ?cut You can then do something like: DF MD 1 0.20 2 0.10 3 0.80 4 0.30 5 0.70 6 0.60 7 0.01 8 0.20 9 0.50 10 1.00 11 1.00 cut(DF$MD, breaks = c(seq(0, 1, .2)), labels = LETTERS[1:5]) [1] A A D B D C A A C E E Levels: A B C D E HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear programming question
Tobias, Just a clarification/correction to my solution: it makes no difference whether A and B are positive or negative. The minimum of S1+S2-S3-S4 is always -2(A+B). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ravi Varadhan Sent: Wednesday, July 18, 2007 1:52 PM To: 'Tobias Schlottmann'; r-help@stat.math.ethz.ch Subject: Re: [R] Linear programming question Tobias, Adding the first constraints yields: S1 + S2 = -2A Similarly adding the second set of constraints: S3 + S4 = 2B If A and B are positive (which you didn't specify) then The minimum of S1+S2 is -2A, and the maximum of S3+S4 is 2B. Thus, the minimum of S1+S2-S3-S4 is -2(A+B). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tobias Schlottmann Sent: Wednesday, July 18, 2007 1:24 PM To: r-help@stat.math.ethz.ch Subject: [R] Linear programming question Hi everybody, consider please an optimization problem: minimize sum S1+S2 Subject to : y - x = A + S1 x - y = A + S2 and we want to add two more constraints: y - x = B - S3 x - y = B - S4 where A is a small constant value and B is a large constant value, S1 and S2 are surplus and S3 and S4 are slack variables. S3 and S4 have to be maximized in objective function. As objective function, is this correct? : minimize sum S1+ S2 - S3 -S4 where actually we want to minimize S1 and S2; and maximize S3 and S4. If it is not correct, what to do ? Thank you for any guide. Tobias - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
You can use 'cut': x MD 1 0.20 2 0.10 3 0.80 4 0.30 5 0.70 6 0.60 7 0.01 8 0.20 9 0.50 10 1.00 11 1.00 cut(x$MD, breaks=seq(0,1,.2), include.lowest=TRUE, labels=LETTERS[1:5]) [1] A A D B D C A A C E E Levels: A B C D E On 7/18/07, Ing. Michal Kneifl, Ph.D. [EMAIL PROTECTED] wrote: Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Subsetting Enigma: More rows after dataframe[-list,]?
Quoting Johannes Graumann [EMAIL PROTECTED]: Hello again, I'm trying to purge the indexes in i.delete from frame and end up with more rows!? Please be so kind and let me know where I screw this up ... Joh i.delete [1] 40 45 165 212 253 270 280 287 301 352 421 433 463 467 487 [16] 517 537 542 573 594 596 612 614 621 635 650 696 699 707 732 [31] 738 776 826 891 892 936 937 935 940 976 988 995 1037 1043 1059 [46] 1081 1123 1128 1132 1140 1153 1155 1165 1176 1179 1200 1281 1289 1300 [61] 1320 1346 1356 1366 1369 1396 1406 1420 1428 1429 1471 1474 1475 1525 1540 [76] 1554 1565 1645 1667 1665 1706 1711 1724 1764 1788 1791 1805 1808 1847 1881 [91] 10 18 137 238 254 260 262 288 292 314 338 349 414 447 457 [106] 465 470 478 511 530 536 552 582 588 644 655 687 693 701 724 [121] 739 763 771 836 848 859 888 900 902 919 939 972 979 989 1000 [136] 1002 1015 1020 1026 1029 1032 1055 1060 1073 1088 1104 1117 1124 1130 1135 [151] 1144 1221 1225 1249 1251 1257 1376 1384 1386 1453 1487 1529 1532 1534 1605 [166] 1624 1633 1646 1648 1702 1787 1948 1951 length(i.delete) [1] 173 nrow(frame) [1] 1975 nrow(frame[-i.delete,]) [1] 1802 Hmmm... i.delete is a vector with 173 elements (indices). frame has originally 1975 rows, then you remove 173 (i.delete) and you end up with a new frame with 1802 rows (1975-173). It works as expected... you get LESS rows afterwards, not more. (?) :-) Jose -- Dr. Jose I. de las Heras Email: [EMAIL PROTECTED] The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374 Institute for Cell Molecular BiologyFax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Classification
On Wed, 2007-07-18 at 12:53 -0500, Marc Schwartz wrote: On Wed, 2007-07-18 at 19:36 +0200, Ing. Michal Kneifl, Ph.D. wrote: Hi, I am also a quite new user of R and would like to ask you for help: I have a data frame where all columns are numeric variables. My aim is to convert one columnt in factors. Example: MD 0.2 0.1 0.8 0.3 0.7 0.6 0.01 0.2 0.5 1 1 I want to make classes: 0-0.2 A 0.21-0.4 B 0.41-0.6 C . and so on So after classification I wil get: MD A A D B . . . and so on Please could you give an advice to a newbie? Thanks a lot in advance.. Michael See ?cut You can then do something like: DF MD 1 0.20 2 0.10 3 0.80 4 0.30 5 0.70 6 0.60 7 0.01 8 0.20 9 0.50 10 1.00 11 1.00 cut(DF$MD, breaks = c(seq(0, 1, .2)), labels = LETTERS[1:5]) [1] A A D B D C A A C E E Levels: A B C D E For precision, let's clean that up as I just realized that I left the remnants of c() in there from an alternative solution, which is not needed here: cut(DF$MD, breaks = seq(0, 1, .2), labels = LETTERS[1:5]) Marc __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] hist() Frequancy values
Quoting Manuele Pesenti [EMAIL PROTECTED]: I have seen that the hist() function plots an histogram of the frequency but I cannot find the value of the object hist that contains theese values... how is possible to get out them? thank you very mutch best regards Manuele if you add 'plot=FALSE', like this: hist(rnorm(100),plot=FALSE) instead of plotting the histogram, you get a list of values. The component $counts contains what you're looking for. You can give it a name: a-hist(rnorm(100),plot=FALSE), and treat it like any other list. (if you do a-hist(rnorm(100)) then you get both the values and the plot) check ?hist for details. Jose -- Dr. Jose I. de las Heras Email: [EMAIL PROTECTED] The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374 Institute for Cell Molecular BiologyFax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Spline - frequency response (again)
Is it really possible that nobody can help me with this? Is r-help too overwhelmed now? Any help appreciated - Jon On 7/16/07, Dr Carbon [EMAIL PROTECTED] wrote: Please preemptively excuse my ignorance. I'm trying to fit a cubic smoothing spline to a time series according to a method encountered in a paper. The authors state that they fit a spline whose frequency response is 50% at a wavelength of n years where n is 67% of the length of the time series. Is it possible to fit a spline like this in R using the spar parameter in smooth.spline? Or is there another spline function in R that works with frequency response? The time series I need to fit is similar to this: ts.sim - arima.sim(list(ar=c(0.5873,0.0873,0.1332,0.0746,-0.0794, 0.0953,0.0313,-0.1393,0.0401,0.2226,0.0024,-0.1030)), n = 350, sd = 0.02) I believe the spline I want to fit will look not unlike this (could be wrong): ts.plot(ts.sim) lines(smooth.spline(ts.sim,spar=0.75)$y,col='red',lwd=2) Can anybody help with this implementation. TIA, JC __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] set up automatic running of R
Just create a batch file, say myproc.bat with the line C:/pathtoR/bin/R CMD BATCH myscript.R and use the Windows task scheduler to schedule your job. (Drag your batch file into C:/WINDOWS/Tasks, change its name if you like, and right click to Properties to schedule it and set other attributes.) HTH, David L. Reiner Rho Trading Securities, LLC 550 W. Jackson Blvd #1000 Chicago, IL 60661-5704 312-244-4610 direct 312-244-4500 main 312-244-4501 fax -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Am Stat Sent: Wednesday, July 18, 2007 12:45 PM To: r-help@stat.math.ethz.ch Subject: [R] set up automatic running of R Hi useR, I am trying to find how to schedule an automatic run of R periodically, I have written some scripts to extract data which are updated monthly on another server, my os is xp. The goal is that my script will run at a scheduled time every month and record the results to some directories. Now the scripts are done, only thing I need is to know how to let R run my scripts at a certain time, say the first Sunday of each months. Could anyone give me some clues? Thanks a million in advance! Best, Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] nested for loop
This should create your files for you: x - 1:1080 # test data # create a vector of 30 consecutive values for spliting the data breaks - rep(1:ceiling(length(x) / 30), each=30)[1:length(x)] # now partition the data into 30 values and write them fileNo - 1 # initialize the file number invisible(lapply(split(x, breaks), function(.values){ write(.values, file=sprintf(NWRxx.%03d.txt, fileNo)) fileNo - fileNo + 1 # update the file number })) On 7/18/07, Sherri Heck [EMAIL PROTECTED] wrote: Hi, I am new to programming and R. I am reading the manual and R books by Dalgaard and Veranzo to help answer my questions but I am unable to figure out the following: I have a data file that contains 1080 data points. Here's a snippet of the file: [241] 0.3603704000 0.1640741000 0.2912963000 NA 0.0159259300 0.0474074100 I would like to break the file up into 30 consecutive data point segments and then write each segment into a separate data file. This is one version of code that I've tried. mons = c(1:12) data = scan(paste(C:/R/NWR.txt)) for (mon in mons) { for (i in c(1:30)) { for (j in data){ write((data),paste(mon,'NWR dc_dt_zi ppm meters per sec.txt',sep=''),ncol=1) } } } I think I'm really close, but no cigar. Thanks in advance for any help- S.Heck Graduate Research Assistant University of Colorado, Boulder __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 open an URL using RGtk2
On 7/18/07, d. sarthi maheshwari [EMAIL PROTECTED] wrote: Hi I am working on R 2.5.0 on window. I am trying to provide a Hyper-link to the user as a result, I have tried using gtkLinkButton to exercise the facility, however, i am not able to perform the required task, i.e. when I clicked on the LinkButton actually nothing happened. I have gone through the documentation for the same and found that GtkLinkButtonUriFunc is a function which is require to do something with the opening of the given URL. Further, I didn't find any other information regarding this. You can find documentation on this by typing help(GtkLinkButtonUriFunc). You might have to scroll down a little since the so-called user functions are described in the overview file for a type. This is the signature for that function: GtkLinkButtonUriFunc(button, link, user.data) So you can define such a function like: uri_hook - function(button, link, data) browseURL(link) and set it with gtkLinkButtonSetUriHook(uri_hook, NULL). A case could be made that this should be set as the default by RGtk2. Michael Following is my code: messlab - gtkLabelNew(str = Please wait!, show = TRUE) messwin - gtkWindowNew(type = NULL, show = TRUE) messwin$Add(messlab) gtkWindowResize(messwin, 250, 60) gtkWindowSetTitle(messwin, Graph Analysis) fihor - gtkHPanedNew(show = TRUE) fn - gtkLinkButtonNewWithLabel(http://cran.r-project.org/;, Result Link!) messwin$Remove(messlab) gtkLabelSetText(messlab, Result link is ::) gtkPanedAdd1(fihor, messlab) gtkPanedAdd2(fihor, fn) gtkPanedSetPosition(fihor, 100) gtkWindowSetTitle(messwin, Result Link) gtkWindowResize(messwin, 380, 60) messwin$Add(fihor) I am confused how to make this link workable on click? Your replies/suggestions are important to me. Please suggest solution. Thanks in advance. Divya Sarthi [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] derivative estimation using GAM
Hello, I have a question about Simon Wood's gam function. Suppose I have a simple model n-100 x - runif(n, 0, 1); y-x*x data-data.frame(x,y) ct-gam(y~ s(x,k = 5)) how could I estimate first derivative of the smooth. From what I understand, i could get coefficients of the fit from ct2-gam(y~ s(x,k = 5),control =gam.control(absorb.cons = FALSE)) coeff(ct2) to get unconstrained coefficient estimates for the model (this was suggested in response to a similar question in 2005), but how could I get derivative of the basis? Thanks! Roman Torgovitsky Doctoral Student Department of Biostatistics Harvard University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] lattice plot axis scaling
I want to generate a lattice plot of a multiple linear regression. I'm using the code: xyplot(y ~ x1 + x2 | status, data=datam, xlab=Peak separation,ylab=G/W,main=G/W vs Fuzzy peak separation: Threshold=1.8, groups=Fuzzy.gw.t.score1.8, subset=(status %in% c(control,patient,sibling)), panel=function(x,y,groups,subscripts,...){ panel.xyplot(x,y,groups=groups,subscripts=subscripts,...) panel.abline(tmp-lm(y~x),col = light blue,lwd=2) panel.abline(tmp-rlm(y~x),col = blue,lwd=2) good.id-groups[subscripts] fm - rlm(y[good.id] ~ x[good.id]) sm - summary(fm) panel.abline(reg = fm) panel.abline(tmp1-lm(y[good.id]~x[good.id]),col = pink,lwd=2) panel.abline(tmp1-rlm(y[good.id]~x[good.id]),col = red,lwd=2) slope - round(coef(fm)[2], 3) err - round(sm$coefficients[4], 3) message(Click on desired location) panel.text(pos-grid.locator(native), lab = paste(slope =,slope,+-,err),col=red) }) ___ The problem is that x1 varies from 1-3, while x2 varies from 20-60. The output scales both independent variables the same, so all the data in the y vs x1 plot are up against the left edge of the plot. How do I scale the x-axes separately? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] dates() is a great date function in R
Proper calendar dates in R are great for plotting and calculating. However for the non-wonks among us, they can be very frustrating. I have recently discussed the pains that people in my lab have had with dates in R. Especially the frustration of bringing date data into R from Excel, which we have to do a lot. Please find below a simple analgesic for R date importation that I discovered over the last 1.5 days (Learning new stuff in R is calculated in 1/2 days). The functiondates()gives the simplest way to get calendar dates into R from Excel that I can find. But straight importation of Excel dates, via a csv or txt file, can be a a huge pain (I'll give details for anyone who cares to know). My pain killer is: Consider that you have Excel columns in month, day, year format. Note that R hates date data that does not lead with the year. a. Load the chron library by typing library(chron) in the console. You know that you need this library from information revealed by performing the query, ?dates()in the Console window. This gives the R documentation help file for this and related time, date functions. In the upper left of the documentation, one sees dates(chron). This tells you that you need the library chron. b. Change the format dates in Excel to format general, which gives 5 digit Julian dates. Import the csv file (I useread.csv() with the Julian dates and other data of interest. c. Now, change the Julian dates that came in with the csv file into calendar dates with thedates() function. Below is my code for performing this activity, concerning an R data file called ss, ss holds the Julian dates, illustrated below from the column MPdate, ss$MPdate[1:5] [1] 34252 34425 34547 34759 34773 The dates() function makes calendar dates from Julian dates, dmp-dates(ss$MPdate,origin=c(month = 1, day = 1, year = 1900)) dmp[1:5] [1] 10/12/93 04/03/94 08/03/94 03/03/95 03/17/95 I would appreciate the comments of more sophisticated programmers who can suggest streamlining or shortcutting this operation. regards, Don -- View this message in context: http://www.nabble.com/dates%28%29-is-a-great-date-function-in-R-tf4105322.html#a11675205 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] set up automatic running of R
Create a .bat file with the commands to execute R BATCH and then create a scheduled task that will run at the desired time to call the batch file. On 7/18/07, Am Stat [EMAIL PROTECTED] wrote: Hi useR, I am trying to find how to schedule an automatic run of R periodically, I have written some scripts to extract data which are updated monthly on another server, my os is xp. The goal is that my script will run at a scheduled time every month and record the results to some directories. Now the scripts are done, only thing I need is to know how to let R run my scripts at a certain time, say the first Sunday of each months. Could anyone give me some clues? Thanks a million in advance! Best, Leon [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] maximum likelihood estimation
Hello! I need to perform maximum likelihood estimation on R, but I am not sure which command to use. I searched on google, and found an example using the function mlogl, but I couldn't find the package on R. Is there such function? Or how should i perform my mle? Thank you very much. -- View this message in context: http://www.nabble.com/maximum-likelihood-estimation-tf4103791.html#a11670424 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] dates() is a great date function in R
See the Other Applications section of the R News 4/1 help desk article on dates. On 7/18/07, Mr Natural [EMAIL PROTECTED] wrote: Proper calendar dates in R are great for plotting and calculating. However for the non-wonks among us, they can be very frustrating. I have recently discussed the pains that people in my lab have had with dates in R. Especially the frustration of bringing date data into R from Excel, which we have to do a lot. Please find below a simple analgesic for R date importation that I discovered over the last 1.5 days (Learning new stuff in R is calculated in 1/2 days). The functiondates()gives the simplest way to get calendar dates into R from Excel that I can find. But straight importation of Excel dates, via a csv or txt file, can be a a huge pain (I'll give details for anyone who cares to know). My pain killer is: Consider that you have Excel columns in month, day, year format. Note that R hates date data that does not lead with the year. a. Load the chron library by typing library(chron) in the console. You know that you need this library from information revealed by performing the query, ?dates()in the Console window. This gives the R documentation help file for this and related time, date functions. In the upper left of the documentation, one sees dates(chron). This tells you that you need the library chron. b. Change the format dates in Excel to format general, which gives 5 digit Julian dates. Import the csv file (I useread.csv() with the Julian dates and other data of interest. c. Now, change the Julian dates that came in with the csv file into calendar dates with thedates() function. Below is my code for performing this activity, concerning an R data file called ss, ss holds the Julian dates, illustrated below from the column MPdate, ss$MPdate[1:5] [1] 34252 34425 34547 34759 34773 The dates() function makes calendar dates from Julian dates, dmp-dates(ss$MPdate,origin=c(month = 1, day = 1, year = 1900)) dmp[1:5] [1] 10/12/93 04/03/94 08/03/94 03/03/95 03/17/95 I would appreciate the comments of more sophisticated programmers who can suggest streamlining or shortcutting this operation. regards, Don -- View this message in context: http://www.nabble.com/dates%28%29-is-a-great-date-function-in-R-tf4105322.html#a11675205 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] gamm (package mgcv) with large datasets
Dear list, I am interested in fitting a Generalized Additive Mixed Model with spatially correlated errors to a large, spatially indexed, data set (~4000 observations). My initial analysis was a Generalized Additive Model that included a two dimensional smooth term to model spatially correlated effect (i.e. s(latitude,longitude)). The problem is that the residuals of this model are still spatially correlated, so it seems that I should use a GAMM in which the spatial autocorrelation is modeled explicitly. The problem is that, as stated in the documentation of the mgcv package, my dataset is too large for the gamm function. Is anybody aware of an alternative approach to analyze this data? Julian M. Burgos Fisheries Acoustics Research Lab School of Aquatic and Fishery Science University of Washington 1122 NE Boat Street Seattle, WA 98105 Phone: 206-221-6864 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Neuman-Keuls
Hi Elyakhlifi, I'm not a statistics expert and so can't intuit what your code is doing easily. I also can't just run the code as supplied, as it uses variables and data structures you haven't specified. From a coding perspective, there are several issues though that will almost certainly make a difference. You need to read about SCOPE. Try isolating functions, and strictly define inputs and outputs. Your function magically uses variables E, exple, lst, lst1, E, and others. Don't do this! Try to make your functions a little more generic and restrict using global variables! try defining your function (and I would use a better name too, but that is personal preference!) to NK - function(x, E, exple) { lst- list() lst1-list() lst2-list() ... and then return(lst) } USE the result of the function by doing this: returned.lst - NK(whatever... ) and not expecting NK to magically set a variable in the global scope. It is possible to set variables in the parent scope from a function, but I would suggest you don't even look up how to do this! Best wishes, Mark On 18/07/07, elyakhlifi mustapha [EMAIL PROTECTED] wrote: hello, I have programmed this function to calculate the Neuman-Keuls test but I have a problem the function return an empty list and I don't know why. summary(fm1) E - sqrt((summary(fm1)[[1]][Residuals,Mean Sq])/length(LR)) lst - list() lst1 - list() lst2 - list() NK - function (x) { if (length(x) == 2) { Tstudent - t.test(subset(exple, groupe == names(x)[1])$vd,subset(exple, groupe == names(x)[2])$vd) t - as.numeric(Tstudent$statistic) if (t = Tstudent$conf.int[1:2][1] t = Tstudent$conf.int[1:2][2]) { lst1[[1]] - x lst - c(lst,lst1) } else { lst1[[1]] - x[1] lst2[[1]] - x[2] lst - c(lst,lst1) lst - c(lst,lst2) } } else { test - x[c(1,length(x))] Q - (as.numeric(test[2]) - as.numeric(test[1]))/E qtt - qtukey(0.95,length(x),df=41) if (Q qtt) { lst1[[1]] - range(x) lst - c(lst,lst1) } else { x1 - x[-length(x)] x2 - x[-1] NK(x1) NK(x2) } } return(lst) } with fm1 Call: aov(formula = vd ~ groupe, data = exple) Terms: groupe Residuals Sum of Squares 300.9871 27. Deg. of Freedom 2041 Residual standard error: 0.8115027 Estimated effects may be unbalanced Can you help me please? thanks. _ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- Dr. Mark Wardle Clinical research fellow and specialist registrar, Neurology Cardiff, UK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] maximum likelihood estimation
On Wed, Jul 18, 2007 at 08:08:50AM -0700, rach.s wrote: Hello! I need to perform maximum likelihood estimation on R, but I am not sure which command to use. I searched on google, and found an example using the function mlogl, but I couldn't find the package on R. Is there such function? Or how should i perform my mle? ^^^ :) library(stats4) ?mle G. [...] -- Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] lattice plot axis scaling
On 7/18/07, Alan S Barnett [EMAIL PROTECTED] wrote: I want to generate a lattice plot of a multiple linear regression. I'm using the code: xyplot(y ~ x1 + x2 | status, data=datam, xlab=Peak separation,ylab=G/W,main=G/W vs Fuzzy peak separation: Threshold=1.8, groups=Fuzzy.gw.t.score1.8, subset=(status %in% c(control,patient,sibling)), panel=function(x,y,groups,subscripts,...){ panel.xyplot(x,y,groups=groups,subscripts=subscripts,...) panel.abline(tmp-lm(y~x),col = light blue,lwd=2) panel.abline(tmp-rlm(y~x),col = blue,lwd=2) good.id-groups[subscripts] fm - rlm(y[good.id] ~ x[good.id]) sm - summary(fm) panel.abline(reg = fm) panel.abline(tmp1-lm(y[good.id]~x[good.id]),col = pink,lwd=2) panel.abline(tmp1-rlm(y[good.id]~x[good.id]),col = red,lwd=2) slope - round(coef(fm)[2], 3) err - round(sm$coefficients[4], 3) message(Click on desired location) panel.text(pos-grid.locator(native), lab = paste(slope =,slope,+-,err),col=red) }) ___ The problem is that x1 varies from 1-3, while x2 varies from 20-60. The output scales both independent variables the same, so all the data in the y vs x1 plot are up against the left edge of the plot. How do I scale the x-axes separately? Add scales = list(x = free) to your call. -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] passing a parameter to a file from command line
Hi, I have a file fileFoo.R, say that contains these two lines, invoking function foo that is specified in foo_details.R: source(foo_details.R) foo(parameter1) I want to specify and pass parameter1 in my command line when invoking R in linux: R --no-save fileFoo.R. How can I do that? And how can I retrieve the value of parameter1 in my fileFoo.R function (something analogous to perl: my $parameter1=$ARGV[0])? Thank you Zava This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] dates() is a great date function in R
On Wed, 2007-07-18 at 12:14 -0700, Mr Natural wrote: Proper calendar dates in R are great for plotting and calculating. However for the non-wonks among us, they can be very frustrating. I have recently discussed the pains that people in my lab have had with dates in R. Especially the frustration of bringing date data into R from Excel, which we have to do a lot. I've always found the following reasonably intuitive: Given the csv file that I've pasted in below, the following reads the csv file in, formats the dates and class Date and then draws a plot. I have dates in DD/MM/ format so year is not first - thus attesting to R not hating dates in this format ;-) ## read in csv data ## as.is = TRUE stops characters being converted to factors ## thus saving us an extra step to convert them back dat - read.csv(date_data.csv, as.is = TRUE) ## we convert to class Date ## format tells R how the dates are formatted in our character strings ## see ?strftime for the meaning and available codes dat$Date - as.Date(dat$Date, format = %d/%m/%Y) ## check this worked ok str(dat$Date) dat$Date ## see nicely formatted dates and not a drop of R-related hatred ## but just about the most boring graph I could come up with plot(Data ~ Date, dat, type = l) And you can keep your Excel file formatted as dates as well - bonus! Oh, and before you get Martin'd, it is the chron *package*! HTH G CSV file I used, generated in OpenOffice.org, but I presume it stores Dates in the same way as Excel?: Data,Date 1,01/01/2007 2,02/01/2007 3,03/01/2007 4,04/01/2007 5,05/01/2007 6,06/01/2007 7,07/01/2007 8,08/01/2007 9,09/01/2007 10,10/01/2007 11,11/01/2007 10,12/01/2007 9,13/01/2007 8,14/01/2007 7,15/01/2007 6,16/01/2007 5,17/01/2007 4,18/01/2007 3,19/01/2007 2,20/01/2007 1,21/01/2007 1,22/01/2007 2,23/01/2007 3,24/01/2007 Please find below a simple analgesic for R date importation that I discovered over the last 1.5 days (Learning new stuff in R is calculated in 1/2 days). The functiondates()gives the simplest way to get calendar dates into R from Excel that I can find. But straight importation of Excel dates, via a csv or txt file, can be a a huge pain (I'll give details for anyone who cares to know). My pain killer is: Consider that you have Excel columns in month, day, year format. Note that R hates date data that does not lead with the year. a. Load the chron library by typing library(chron) in the console. You know that you need this library from information revealed by performing the query, ?dates()in the Console window. This gives the R documentation help file for this and related time, date functions. In the upper left of the documentation, one sees dates(chron). This tells you that you need the library chron. b. Change the format dates in Excel to format general, which gives 5 digit Julian dates. Import the csv file (I useread.csv() with the Julian dates and other data of interest. c. Now, change the Julian dates that came in with the csv file into calendar dates with thedates() function. Below is my code for performing this activity, concerning an R data file called ss, ss holds the Julian dates, illustrated below from the column MPdate, ss$MPdate[1:5] [1] 34252 34425 34547 34759 34773 The dates() function makes calendar dates from Julian dates, dmp-dates(ss$MPdate,origin=c(month = 1, day = 1, year = 1900)) dmp[1:5] [1] 10/12/93 04/03/94 08/03/94 03/03/95 03/17/95 I would appreciate the comments of more sophisticated programmers who can suggest streamlining or shortcutting this operation. regards, Don -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] passing a parameter to a file from command line
Look at the commandArgs function to see if that does what you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aydemir, Zava (FID) Sent: Wednesday, July 18, 2007 2:00 PM To: R-help@stat.math.ethz.ch Subject: [R] passing a parameter to a file from command line Hi, I have a file fileFoo.R, say that contains these two lines, invoking function foo that is specified in foo_details.R: source(foo_details.R) foo(parameter1) I want to specify and pass parameter1 in my command line when invoking R in linux: R --no-save fileFoo.R. How can I do that? And how can I retrieve the value of parameter1 in my fileFoo.R function (something analogous to perl: my $parameter1=$ARGV[0])? Thank you Zava This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] odfWeave - How to Insert eps rather than png
If you create plots and use odfWeave to create an odf text document, the default for figures is png bitmap graphics. The only way I've found to insert eps graphics is to first create the eps graphic using the postscript driver and then use odfInsertPlot. I've tried to use getImageDefs and setImageDefs but I get an empty plot. Could someone show an example? Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] memory error with 64-bit R in linux
Hi netters, I'm using the 64-bit R-2.5.0 on a x86-64 cpu, with an RAM of 2 GB. The operating system is SUSE 10. The system information is: -uname -a Linux someone 2.6.13-15.15-smp #1 SMP Mon Feb 26 14:11:33 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux I used heatmap to process a matrix of the dim [16000,100]. After 3 hours of desperating waiting, R told me: cannot allocate vector of size 896 MB. I know the matrix is very big, but since I have 2 GB of RAM and in a 64-bit system, there should be no problem to deal with a vector smaller than 1 GB? (I was not running any other applications in my system) Does anyone know what's going on? Is there a hardware limit where I have to add more RAM, or is there some way to resolve it softwarely? Also is it possible to speed up the computing (I don't wanna wait another 3 hours to know I get another error message) Thank you in advance! _ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] dates() is a great date function in R
...just a follow up to reading time series data from CSV files. If you've got data like Gavin's (only with the dates in the first column) Date,Data 01/01/2007,1 02/01/2007,2 03/01/2007,3 04/01/2007,4 ... then you can use read.zoo() in package zoo: x - read.zoo(mydata.csv, sep = ,, format = %d/%m/%Y, header = TRUE) plot(x) which produces the time-series plot. This uses the Date class contained in base R rather than dates from chron. Concerning the different time/date classes, see the R News article Gabor already mentioned. For some more examples of using zoo/read.zoo see vignette(zoo-quickref, package = zoo) hth, Z On Wed, 18 Jul 2007, Gavin Simpson wrote: On Wed, 2007-07-18 at 12:14 -0700, Mr Natural wrote: Proper calendar dates in R are great for plotting and calculating. However for the non-wonks among us, they can be very frustrating. I have recently discussed the pains that people in my lab have had with dates in R. Especially the frustration of bringing date data into R from Excel, which we have to do a lot. I've always found the following reasonably intuitive: Given the csv file that I've pasted in below, the following reads the csv file in, formats the dates and class Date and then draws a plot. I have dates in DD/MM/ format so year is not first - thus attesting to R not hating dates in this format ;-) ## read in csv data ## as.is = TRUE stops characters being converted to factors ## thus saving us an extra step to convert them back dat - read.csv(date_data.csv, as.is = TRUE) ## we convert to class Date ## format tells R how the dates are formatted in our character strings ## see ?strftime for the meaning and available codes dat$Date - as.Date(dat$Date, format = %d/%m/%Y) ## check this worked ok str(dat$Date) dat$Date ## see nicely formatted dates and not a drop of R-related hatred ## but just about the most boring graph I could come up with plot(Data ~ Date, dat, type = l) And you can keep your Excel file formatted as dates as well - bonus! Oh, and before you get Martin'd, it is the chron *package*! HTH G CSV file I used, generated in OpenOffice.org, but I presume it stores Dates in the same way as Excel?: Data,Date 1,01/01/2007 2,02/01/2007 3,03/01/2007 4,04/01/2007 5,05/01/2007 6,06/01/2007 7,07/01/2007 8,08/01/2007 9,09/01/2007 10,10/01/2007 11,11/01/2007 10,12/01/2007 9,13/01/2007 8,14/01/2007 7,15/01/2007 6,16/01/2007 5,17/01/2007 4,18/01/2007 3,19/01/2007 2,20/01/2007 1,21/01/2007 1,22/01/2007 2,23/01/2007 3,24/01/2007 Please find below a simple analgesic for R date importation that I discovered over the last 1.5 days (Learning new stuff in R is calculated in 1/2 days). The functiondates()gives the simplest way to get calendar dates into R from Excel that I can find. But straight importation of Excel dates, via a csv or txt file, can be a a huge pain (I'll give details for anyone who cares to know). My pain killer is: Consider that you have Excel columns in month, day, year format. Note that R hates date data that does not lead with the year. a. Load the chron library by typing library(chron) in the console. You know that you need this library from information revealed by performing the query, ?dates()in the Console window. This gives the R documentation help file for this and related time, date functions. In the upper left of the documentation, one sees dates(chron). This tells you that you need the library chron. b. Change the format dates in Excel to format general, which gives 5 digit Julian dates. Import the csv file (I useread.csv() with the Julian dates and other data of interest. c. Now, change the Julian dates that came in with the csv file into calendar dates with thedates() function. Below is my code for performing this activity, concerning an R data file called ss, ss holds the Julian dates, illustrated below from the column MPdate, ss$MPdate[1:5] [1] 34252 34425 34547 34759 34773 The dates() function makes calendar dates from Julian dates, dmp-dates(ss$MPdate,origin=c(month = 1, day = 1, year = 1900)) dmp[1:5] [1] 10/12/93 04/03/94 08/03/94 03/03/95 03/17/95 I would appreciate the comments of more sophisticated programmers who can suggest streamlining or shortcutting this operation. regards, Don -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list
[R] multicollinearity in nlme models
I am working on a nlme model that has multiple fixed effects (linear and nonlinear) with a nonlinear (asymptotic) random effect. asymporig-function(x,th1,th2)th1*(1-exp(-exp(th2)*x)) asymporigb-function(x,th1b,th2b)th1b*(1-exp(-exp(th2b)*x)) mod.vol.nlme-nlme(fa20~(ah*habdiv+ads*ds+ads2*ds2+at*trout)+asymporig(da.p,th1,th2)+ asymporigb(vol,th1b,th2b), fixed=ah+ads+ads2+at+th1+th2+th1b+th2b~1, random=pdBlocked(list(th1~1,th2~1)), start=c(ah=.5524,ads=.8,ads2=-.1,at=-1,th1=2.542,th2=-7.117,th1b=2,th2b=-7), data=pca1.grouped,verbose=T) I am looking at potential multicollinearity among the fixed effects, in particular I am concerned about multicollinearity between da.p (drainage area) and vol (volume). How do I interpret the correlation reported in the summary command for th1 and th1b, which are the asymptotes for fa20~da.p and fa20~vol. It is -.50, but how is the correlation calculated? I have run the above model with out vol and the coefficients for the remaining variables are very similar (within the approx. 95% conf. interv.) to the coefficients in the above model and vol and da.p are significant, both suggesting multicollinearity is not severe?? I am interested in which variables influence fa20 (richness) not necessarily the model with the smallest residual sd. I do have Pinheiro and Bates, but do not find much reference to this type of information. Thanks for any suggestions or help. Dan summary # Nonlinear mixed-effects model fit by maximum likelihood Model: fa20 ~ (ah * habdiv + ads * ds + ads2 * ds2 + at * trout) + asymporig(da.p, th1, th2) + asymporigb(vol, th1b, th2b) Data: pca1.grouped AIC BIClogLik 3151.665 3248.518 -1555.832 Random effects: Composite Structure: Blocked Block 1: th1 Formula: th1 ~ 1 | bas th1 StdDev: 0.8125094 Block 2: th2 Formula: th2 ~ 1 | bas th2 Residual StdDev: 0.9468531 1.028757 Variance function: Structure: Different standard deviations per stratum Formula: ~1 | bas Parameter estimates: LSCDMSDMRNLMUMRD 1.000 0.7884995 1.2107482 1.4159803 1.0463657 1.3982966 1.2195945 1.1978807 MNSC 1.3858409 1.2006228 Fixed effects: ah + ads + ads2 + at + th1 + th2 + th1b + th2b ~ 1 Value Std.Error DFt-value p-value ah0.597032 0.1330044 920 4.488812 0 ads 1.283297 0.0874561 920 14.673614 0 ads2 -0.125186 0.0130289 920 -9.608281 0 at -0.731506 0.1394553 920 -5.245451 0 th1 2.363269 0.3385592 920 6.980373 0 th2 -3.910520 0.3575392 920 -10.937318 0 th1b 1.402536 0.2188125 920 6.409764 0 th2b -6.765038 0.2931669 920 -23.075723 0 Correlation: ah adsads2 at th1th2th1b ads -0.595 ads2 0.571 -0.974 at -0.092 -0.104 0.104 th1 0.010 -0.153 0.147 -0.020 th2 -0.012 -0.139 0.105 -0.015 -0.071 th1b 0.043 -0.110 0.070 0.084 -0.500 0.163 th2b -0.038 -0.032 -0.030 -0.016 -0.017 -0.225 -0.056 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.73841391 -0.63008005 0.03189713 0.68903314 3.90583424 Number of Observations: 937 Number of Groups: 10 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] creating a world map of eco-climatic zones
Hello R users: I would like to produce a world map with countries colored according to whether they fall into one of 7 eco-climatic zones. For simplicity, each country is allocated to exactly 1 eco-climatic zone. For this purpose I have looked at the map and mapdata packages, which contain world maps composed of polygons (1 for each country, it seems). Each of the polygons can be referred to by a region name in the map package. I am thinking, I would do something like map(region=c('Germany', 'Switzerland',...), fill=TRUE, col='blue') for each of the 7 eco-climatic zones. My question is, what are the names used in the world map dataset for each country and how can I get them? Perhaps there's also a smarter way to produce this map, in which case, your advise is greatly appreciated as well. Lastly, some countries (mostly large ones such as USA, Russia, Canada, China) fall into multiple eco-climatic zones. Assume I could get geographical coordinates for polygons describing the sub-country portion falling into a single eco-climatic zone, is there a way to improve the above map to show portions of countries belonging to a specific eco-climatic zone? Thanks! Tanja __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Saving a dataset permanently in R
HI: I'm still struggling with datasets, the more I read about it the more confussed I get. This is the scenario... In R console|Edit|Data Editor, I can find all the datasets available with the different packages, So to create a new dataset in the R console I use the following commands to create an empty data frame. My_Dataset - data.frame() My_Dataset - edit(My_dataset) The problem is that I can't copy my data into the dataframe. Is there any suggestions as of how I can transfer the data and how it can be saved so everytime I open R the dataset would be available.? Thanks Felipe D. Carrillo Fishery Biologist US Fish Wildlife Service Red Bluff, California 96080 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] memory error with 64-bit R in linux
Are you paging? That might explain the long run times. How much space are your other objects taking up? The matrix by itself should only require about 13MB if it is numeric. I would guess it is some of the other objects that you have in your working space. Put some gc() in your loop to see how much space is being used. Run it with a subset of the data and see how long it takes. This might give you an estimate of the time, and space, that might be needed for the entire dataset. Do a 'ps' to see how much memory your process is using. Do one every couple of minutes to see if it is growing. You can alway use Rprof() to get an idea of where time is being spent (use it on a small subset). On 7/18/07, zhihua li [EMAIL PROTECTED] wrote: Hi netters, I'm using the 64-bit R-2.5.0 on a x86-64 cpu, with an RAM of 2 GB. The operating system is SUSE 10. The system information is: -uname -a Linux someone 2.6.13-15.15-smp #1 SMP Mon Feb 26 14:11:33 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux I used heatmap to process a matrix of the dim [16000,100]. After 3 hours of desperating waiting, R told me: cannot allocate vector of size 896 MB. I know the matrix is very big, but since I have 2 GB of RAM and in a 64-bit system, there should be no problem to deal with a vector smaller than 1 GB? (I was not running any other applications in my system) Does anyone know what's going on? Is there a hardware limit where I have to add more RAM, or is there some way to resolve it softwarely? Also is it possible to speed up the computing (I don't wanna wait another 3 hours to know I get another error message) Thank you in advance! _ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] confidence intervals for multinomial
Hi All, I want to test an H0 hypothesis about the proportions of observed counts in k classes. I know that I can do this with the chisq.test. However, besides of the overall acceptance or rejection of the H0, I would like to know which of the k classes cause(s) rejection and I would like to know the observation-based confidence envelopes for the proportions for the k classes. My quick-and-dirty approach thus far is to do an initial chisq.test on the original k classes and then to lump data into two classes (=one of the original classes and all other original classes lumped into one new class) and do a binom.test. I interpret the result of the binom.test as indicating whether the current class might be the reason for the rejection of the overall H0. Additionally, it gives me a confidence envelope for this class. This approach seems fairly straightforward, but I just do not feel totally comfortable with it. I would feel so much better if there was something like a multinom.test, but to my knowledge there is none. Do you have any suggestions what I could rather do? For instance, I might follow a Monte Carlo-like approach: I simulate proportions for the k classes based on the proportions of observed counts with rmultinom. After exclusion of the most extreme values I construct my confidence envelope based on the remaining simulated proportions. Based on whether the hypothesized proportions fall into the observation-based confidence envelopes, I accept or reject. Do you think that either of these approaches is better or would you suggest doing something totally different? All comments and suggestions are highly appreciated. Kind regards, Michael PS: I guess my request parallels that of Matthias Schmidt from Apr 5, 2004, that was answered by Brian Ripley ... Michael Drescher Ontario Forest Research Institute Ontario Ministry of Natural Resources 1235 Queen St East Sault Ste Marie, ON, P6A 2E3 Tel: (705) 946-7406 Fax: (705) 946-2030 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Saving a dataset permanently in R
Where are you trying to copy data from? I would assume that with that script you are typing all the data in by hand. Why don't you put it in a text file and use read.table? By default, R will save your workspace on exit and then reload it on startup. Is this enough to save your data? You can also use the 'save' function to store explicit objects. On 7/18/07, Felipe Carrillo [EMAIL PROTECTED] wrote: HI: I'm still struggling with datasets, the more I read about it the more confussed I get. This is the scenario... In R console|Edit|Data Editor, I can find all the datasets available with the different packages, So to create a new dataset in the R console I use the following commands to create an empty data frame. My_Dataset - data.frame() My_Dataset - edit(My_dataset) The problem is that I can't copy my data into the dataframe. Is there any suggestions as of how I can transfer the data and how it can be saved so everytime I open R the dataset would be available.? Thanks Felipe D. Carrillo Fishery Biologist US Fish Wildlife Service Red Bluff, California 96080 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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 you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Can any one help me on format file data.
Horacio Castellini [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all. I'd like know what is the format file saved by Leica Microsystems TCS SP2-AOBS equipped with a SP2-FCS2 Leica Microsystems workstation its datas. Cause it save in *.fcs extention file but ins't flow cytometry standart format file... From a Google search for SP2-FCS2 Leica Microsystems I found this paper http://jcs.biologists.org/cgi/reprint/118/24/5825.pdf that talked about Fluorescence Correlation Spectroscopy (FCS) data. Is is possible you have Fluorescence Correlation Spectroscopy (FCS) data instead of flow cytometry (FCS) data? I've worked some with both types of FCS data. I wrote a ConfoCor 3 Fluroescence Correlation Spectroscopy FCS viewer in R: http://research.stowers-institute.org/efg/ScientificSoftware/Utility/FCSViewer/R.htm. The software that reads that older Fluroescence Correlation Spectroscopy FCS data was in Delphi http://research.stowers-institute.org/efg/ScientificSoftware/Utility/FCSViewer/index.htm. It would be a bit of a pain to read that older Fluroescence Correlation Spectroscopy FCS bit stream in R. But it'slikely Leica's format is different than Zeiss. I have also worked with some versions of flow cytometery FCS data (e.g., see http://research.stowers-institute.org/efg/ScientificSoftware/Utility/FCSExtract/index.htm). There are different versions of that FCS standard too. If you send me a small file, I'll see if I can recognize if it's a format I've seen. efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] creating a world map of eco-climatic zones
On 7/18/07, Tanja Srebotnjak [EMAIL PROTECTED] wrote: Hello R users: I would like to produce a world map with countries colored according to whether they fall into one of 7 eco-climatic zones. For simplicity, each country is allocated to exactly 1 eco-climatic zone. For this purpose I have looked at the map and mapdata packages, which contain world maps composed of polygons (1 for each country, it seems). Each of the polygons can be referred to by a region name in the map package. I am thinking, I would do something like map(region=c('Germany', 'Switzerland',...), fill=TRUE, col='blue') for each of the 7 eco-climatic zones. My question is, what are the names used in the world map dataset for each country and how can I get them? library(maps) wmap - map('world', plot = FALSE, fill = TRUE) str(wmap) List of 4 $ x: num [1:27636] -133 -132 -132 -132 -130 ... $ y: num [1:27636] 58.4 57.2 57.0 56.7 56.1 ... $ range: num [1:4] -180.0 190.3 -85.4 83.6 $ names: chr [1:2284] Canada South Africa Denmark Great Lakes:Superior, Huron, Michigan ... - attr(*, class)= chr map So wmap$names will give you the names you want. Perhaps there's also a smarter way to produce this map, in which case, your advise is greatly appreciated as well. If you construct a suitable color vector (with the same order as $names), you should be able to do the whole thing in one call. Lastly, some countries (mostly large ones such as USA, Russia, Canada, China) fall into multiple eco-climatic zones. Assume I could get geographical coordinates for polygons describing the sub-country portion falling into a single eco-climatic zone, is there a way to improve the above map to show portions of countries belonging to a specific eco-climatic zone? wmap$x and wmap$y are exactly that (coordinates of polygons, with NA's separating polygons). You should be able to add a few more, add suitable names, and supply the result as the 'database' argument to another call to map(). -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Is there a facility in R similar to MatLab syms that allows using unevaluated numeric symbols in matrices?
Hi, I'm trying to use R to get eigenvalues and eigenvectors of a matrix whose elements are of the form (2 * lambda), -(lambda + mu), etc. I'd like R to treat this matrix as a numeric matrix without treating lambda and mu as variable names but rather as some sort of atomic quantities (and hence give eigenvectors in terms of mu and/or lambda). MatLab and Mathematica both do this, but I'm not sure whether R does. Does anyone have any ideas about how to do this? Please let me know, Dylan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with heatmap - how to remove annoying X before numeric values?
Hello All, I have a simple question based on how things are labeled on my heat map; particularly, there is this annoying X that appears before the numeric value of all the labels of my columns. Let's say I have the following silly data, stored in temp.txt 190519101950199220112020 Gnat0.080.290.290.370.390.43 Snake 0.160.340.320.400.410.53 Bat 0.400.540.520.600.600.63 Cat 0.160.270.290.390.370.41 Dog 0.430.540.520.610.600.62 Lynx0.500.570.540.590.5 0.59 I use the following commands to generate my heatmap: heat - read.table('temp.txt') x - as.matrix(heat) heatmap.2(x, keysize=1.2, dendrogram=none, trace=none, Colv = FALSE, main = Silly Data, labCol= NULL, margin=c(7,8)) This generates a very nice heatmap, but there is one thing I have an issue with: How do I get rid of the 'X' that seems to come automatically before my numeric column values? I just want those columns to be labeled 1905, 1910, 1950, and so on. I cannot find anything in the heatmap.2 documentation that suggests how I should do this. Thank you very much for your time, and patience in reading this! Sincerely, Suzanne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] RAM, swap, Error: cannot allocate vector of size, Linux:
Dear Community, I am very new to the world of Linux and R and I have stumbled upon a problem that I cannot seem to resolve on my own. Here is the relevant background: I am working on a 64-bit Linux Fedora Core 6 OS. I using R version 2.5.1. I have 3.8 Gb of RAM and 1.9 Gb of swap. As I see it, there are no restraints on the amount of memory that R can use imposed by this particular OS build. When I type in the 'ulimit' command at the command line the response is 'unlimited'. Here is the problem: I have uploaded and normalized 48 ATH1 microarray slides using the justRMA function. library(affy) setwd(/Data/cel) Data-justRMA() The next step in my analysis is to calculate a distance matrix for my dataset using bioDist package. This is where I get my error. library(bioDist) x-cor.dist(exprs(Data)) Error: cannot allocate vector of size 3.9 Gb I used the following function to examine my memory limitations: mem.limits() nsize vsize NA NA I believe this means there isn't any specified limit to the amount of memory R can allocate to my task. I realize I only have 3.8 Gb of RAM but I would expect that R would use my 1.9 Gb of swap. Does R not use my swap space? Can I explicitly tell R to use my swap space for large tasks such as this? I was not able to find any information regarding this particular issue in the R Linux manual, Linux FAQ, or on previous listserv threads. Many of the users who had similar questions resolved their problems in a different manner. Thanks to anyone who thinks they can provide assistance! Max Graduate Student Molecular Plant Sciences Washington State University [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Estimating mixed logit using Maximum simulated likelihood
Hell all. I¡¯m trying to estimate mixed logit model using MSLE. In order to see that mixed logit model works better than simple logit model ( the logit model with fixed coefficient) I simulated a dataset with random coefficients and tried to fit the data with both mixed logit and simple logit model. Because my mixed logit model contains analytically intractable integrations, I applied simulated method (maximum simulated Likelihood estimation) to estimate parameters. I tested with both nlminb() and optim() function with ¡®L-BFGS-B¡¯ method. I had to use them because my problem is constrained optimization (I¡¯m trying to estimate underlying variance of random coefficients). The thing is that when I used nlminb(), it ended up with ¡®false convergence¡¯. When I used optim() with ¡®L-BFGS-B¡¯ method, I could get a set of parameter estimates and likelihood estimates. But the log likelihood value was worse than that from simple logit model (fixed coefficient logit model). (My conjecture was that mix logit model should give better result because the data was generated from random coefficient model). Here my question are that 1) Is it possible that mixed logit model gives poorer result than simple logit model even the dataset is generated from random coefficient model and why? 2) If mixed logit model should give better result (in terms of likelihood and other fitting criterion), I think there are some problems with programs. Is there any function doing mixed logit analysis in R environment? Thank you! [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a type of generalized inner product
Hi. I'm looking for an efficient way of writing a function(x,mat1,mat2). n-4 m-4 r-3 x - array(sample(1:1000)/10^4,rep.int(n,m)) mat1 - matrix(sample(1:1000)/10^4,n,n) mat2 - matrix(sample(1:1000)/10^4,n,n) It needs to work for *any* itegers n, r=m with output (in horrible gory detail) equivalent to: ans-array(0,rep.int(n,(m+1))) for(i1 in 1:n) for(i2 in 1:n) for(i3 in 1:n) for(i4 in 1:n) for(i5 in 1:n) ans[i1,i2,i3,i4,i5] - sum(x[i1,i2,,i3]*mat1[,i4]*mat2[,i5]) Notice how I take a pointwise product of x in the r^th slot of x with the 1^st slot of mat1 and mat2, and then sum out. This is the guts of what I want to do. It's kind of like an inner product %*% but on three objects instead of two. Although, the above is what I want to do for my application, in fact it would be nice to be able to do this for three (or more) arrays in three (or more) specified slots. We should also be able do it with outer and apply: y - outer(outer(x,mat1),mat2) len - length(dim(y)) ans2 - apply(y,c(1:len)[-c(r,len-3,len-1)],FUN=sum) But for some reason I can't get this to give the same answer as above even though dim(ans)=dim(ans2). I think apply is not doing what I think it is doing. Taking the double outer is bad news efficiency wise anyway. Any help, ideas, or direction will be greatly appreciated. Jeremy. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] 2 Biplot Questions
I have 2 questions about the Biplot function: Both of the questions refer to the following type of graph, which is a biplot of a principal component analysis: biplot(prcomp(dataset)) 1. Does anyone know how to change the appearance of data points on the biplot? As it is currently, for this type of graph, the label for each data point shows up on the graph - does anyone know how to get rid of those labels, say, and just make each piece of data represented by a point, the old-fashioned way? (Also, I want to be able to keep the labels for the red arrows on the graph, just not the data points - any suggestions? Is this even possible?) 2. What is the effect of scaling the biplot - for example, if I did: biplot(prcomp(USArrests), scale = TRUE) I get a different graph than if I enter the command above. I looked in the help pages, and I see that it says that when you scale it, the observations are scaled by lamda ^ (1-scale) where lambda are the singular values as computed by princomp. Can anyone explain what that means in layman's terms? Why would you want to scale the observations by lamda - what does that accomplish? And what is being scaled anyway: the principal components or the underlying data points? If anyone could help, that would be great. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] memory error with 64-bit R in linux
The dist object for the rows of the matrix will be 16000x16000, which if there are any copies will easily suck up all of your RAM. A more pertinent question is what use would a heatmap of that size be? How do you plan to visualize 16000 rows? In a pdf? You certainly couldn't publish such a thing, nor would it be useful as a picture in a presentation. You would probably be better off filtering down to a more reasonable number of rows (say 500 or less), and using that to make your heatmap. Best, Jim jim holtman wrote: Are you paging? That might explain the long run times. How much space are your other objects taking up? The matrix by itself should only require about 13MB if it is numeric. I would guess it is some of the other objects that you have in your working space. Put some gc() in your loop to see how much space is being used. Run it with a subset of the data and see how long it takes. This might give you an estimate of the time, and space, that might be needed for the entire dataset. Do a 'ps' to see how much memory your process is using. Do one every couple of minutes to see if it is growing. You can alway use Rprof() to get an idea of where time is being spent (use it on a small subset). On 7/18/07, zhihua li [EMAIL PROTECTED] wrote: Hi netters, I'm using the 64-bit R-2.5.0 on a x86-64 cpu, with an RAM of 2 GB. The operating system is SUSE 10. The system information is: -uname -a Linux someone 2.6.13-15.15-smp #1 SMP Mon Feb 26 14:11:33 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux I used heatmap to process a matrix of the dim [16000,100]. After 3 hours of desperating waiting, R told me: cannot allocate vector of size 896 MB. I know the matrix is very big, but since I have 2 GB of RAM and in a 64-bit system, there should be no problem to deal with a vector smaller than 1 GB? (I was not running any other applications in my system) Does anyone know what's going on? Is there a hardware limit where I have to add more RAM, or is there some way to resolve it softwarely? Also is it possible to speed up the computing (I don't wanna wait another 3 hours to know I get another error message) Thank you in advance! _ ?? MSN Hotmail? http://www.hotmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- James W. MacDonald, MS Biostatistician UMCCC cDNA and Affymetrix Core University of Michigan 1500 E Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] Any implementation of multiobjective optimization using evolutionary approach?
Hi I'm quite new to this area a bit but I'm wondering if there is any implementation of multi-objective optimization using evolutionary approach available in R? Any point to reference would be really appreciated. Thank you. - adschai __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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] R MySQL Configuration
Hi, You may specify a different default.file in the dbConnect() call to point to a non-default configuration file; dbConnect() simply passes this filename to the MySQL API, which does the appropriate thing (in particular you may want to double check the MySQL documentation regarding using this under Windows). For full details on the arguments to the dbConnect method try methods?dbConnect Hope this helps, -- David On 7/18/07, Mark Bulkeley [EMAIL PROTECTED] wrote: Quick question about the configuration files relative to RMySQL (I've tried to get feedback directly from the author David James, but his email address was non-responsive): Documentation at http://cran.r-project.org/doc/packages/RMySQL.pdf on page 3 indicates that for windows machines the only place that the my.cnf file will be looked for is the root (C:\) directory. Is this read correct? When launching R, I've set the HOME directory elsewhere, but am unsuccessful in getting recognition of my group definitions in this way (only works when the file is in C:\ ) Does anybody know if there are plans to implement the default.file option noted on page 17 of the same documentation (noted as Currently unused)? If I set it now, I get Error in mysqlNewConnection(drv, ...): unused argument(s) (default.file ...) My goal is to eliminate plain text database passwords from my computer and at least put it on a secured network location, but I need to let RMySQL know how to find it. Thanks for your help. Regards, Mark __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with heatmap - how to remove annoying X before numeric values?
read.table is doing that, not heatmap.2. Use read.table(temp.txt, header = TRUE, check.names = FALSE) On 7/18/07, Suzanne Matthews [EMAIL PROTECTED] wrote: Hello All, I have a simple question based on how things are labeled on my heat map; particularly, there is this annoying X that appears before the numeric value of all the labels of my columns. Let's say I have the following silly data, stored in temp.txt 190519101950199220112020 Gnat0.080.290.290.370.390.43 Snake 0.160.340.320.400.410.53 Bat 0.400.540.520.600.600.63 Cat 0.160.270.290.390.370.41 Dog 0.430.540.520.610.600.62 Lynx0.500.570.540.590.5 0.59 I use the following commands to generate my heatmap: heat - read.table('temp.txt') x - as.matrix(heat) heatmap.2(x, keysize=1.2, dendrogram=none, trace=none, Colv = FALSE, main = Silly Data, labCol= NULL, margin=c(7,8)) This generates a very nice heatmap, but there is one thing I have an issue with: How do I get rid of the 'X' that seems to come automatically before my numeric column values? I just want those columns to be labeled 1905, 1910, 1950, and so on. I cannot find anything in the heatmap.2 documentation that suggests how I should do this. Thank you very much for your time, and patience in reading this! Sincerely, Suzanne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Linear programming question
Hi Tobias, Could you please explain the role of x and y - are they somehow related to S1,S2,S3,S4? Are they constant? Are they additional variable? What was your original problem (without the slack variables)? Regards, Moshe. --- Tobias Schlottmann [EMAIL PROTECTED] wrote: Hi everybody, consider please an optimization problem: minimize sum S1+S2 Subject to : y - x = A + S1 x - y = A + S2 and we want to add two more constraints: y - x = B - S3 x - y = B - S4 where A is a small constant value and B is a large constant value, S1 and S2 are surplus and S3 and S4 are slack variables. S3 and S4 have to be maximized in objective function. As objective function, is this correct? : minimize sum S1+ S2 - S3 -S4 where actually we want to minimize S1 and S2; and maximize S3 and S4. If it is not correct, what to do ? Thank you for any guide. Tobias - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with heatmap - how to remove annoying X before numeric values?
Hi Suzanne, My solution (which I am sure is not the best) would be: heat - read.table('temp.txt') heat X1905 X1910 X1950 X1992 X2011 X2020 Gnat 0.08 0.29 0.29 0.37 0.39 0.43 Snake 0.16 0.34 0.32 0.40 0.41 0.53 Bat0.40 0.54 0.52 0.60 0.60 0.63 Cat0.16 0.27 0.29 0.39 0.37 0.41 Dog0.43 0.54 0.52 0.61 0.60 0.62 Lynx 0.50 0.57 0.54 0.59 0.50 0.59 a-names(heat) b-strsplit(a,split=X) w-unlist(b) w [1] 1905 1910 1950 1992 2011 2020 z - w[seq(2,length(w),by=2)] z [1] 1905 1910 1950 1992 2011 2020 names(heat) - z heat 1905 1910 1950 1992 2011 2020 Gnat 0.08 0.29 0.29 0.37 0.39 0.43 Snake 0.16 0.34 0.32 0.40 0.41 0.53 Bat 0.40 0.54 0.52 0.60 0.60 0.63 Cat 0.16 0.27 0.29 0.39 0.37 0.41 Dog 0.43 0.54 0.52 0.61 0.60 0.62 Lynx 0.50 0.57 0.54 0.59 0.50 0.59 Regards, Moshe. --- Suzanne Matthews [EMAIL PROTECTED] wrote: Hello All, I have a simple question based on how things are labeled on my heat map; particularly, there is this annoying X that appears before the numeric value of all the labels of my columns. Let's say I have the following silly data, stored in temp.txt 190519101950199220112020 Gnat0.080.290.290.370.390.43 Snake 0.160.340.320.400.410.53 Bat 0.400.540.520.600.600.63 Cat 0.160.270.290.390.370.41 Dog 0.430.540.520.610.600.62 Lynx0.500.570.540.590.5 0.59 I use the following commands to generate my heatmap: heat - read.table('temp.txt') x - as.matrix(heat) heatmap.2(x, keysize=1.2, dendrogram=none, trace=none, Colv = FALSE, main = Silly Data, labCol= NULL, margin=c(7,8)) This generates a very nice heatmap, but there is one thing I have an issue with: How do I get rid of the 'X' that seems to come automatically before my numeric column values? I just want those columns to be labeled 1905, 1910, 1950, and so on. I cannot find anything in the heatmap.2 documentation that suggests how I should do this. Thank you very much for your time, and patience in reading this! Sincerely, Suzanne [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.