Re: [R] R kicking us out
On Tuesday 13 June 2006 13:00, Erin Hodgess wrote: Dear R People: I am using R for teaching purposes in a large classroom. Each computer has its own copy of R. However, every once in a while, about half of us will get thrown out of R, for no apparent reason. By the way, it has happened in other classrooms as well. Has anyone else run into this, please? If so, how have you solved this problem, please? Thanks in advance! R for Windows You will need to provide a good deal more information before a useful answer is likely. For instance, what operating system do these computers use? If the computers are all running networked in a lab, is there some automatic maintenance being run? What hardware specifications (CPU, memory, harddisk storage, etc.)? What size data sets are being used? And, more importantly, what does kicking you out actually mean in terms of computer behaviour? Does R simply crash? When you about half of us is it always the same half? Does it occur at the same time of day? There are far too many unknowns for a diagnosis. JD __ 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
[R] Decimal series how to make.........
Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[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
Re: [R] Decimal series how to make.........
On 14 Jun 2006, anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, You want the seq() function. Look it up by typing ?seq About the : - watch out for the difference between 1:4-1 and 1:(4-1) (Go ahead and try) best Niels i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[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 __ 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
Re: [R] Decimal series how to make.........
?seq anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[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 -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Centre for Resource and Environmental Studies The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au F: +61 2 6125 0757 CRICOS Provider # 00120C __ 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
[R] A whine and a request
guRus and useRs, As I instruct my students: With R what is difficult in anything else, is easy, usually one line of code; but, what is easy in anything else, is *^%$%#$... (translation: next to impossible) in R. I just ran into such a case that has, to put it mildly, driven me to use spreadsheets (if that is not a sign of complete desperation, I don't know what is). It has nothing to do with particular versions of R or what OS I am using, but something more fundamental. Here it is. First, I have a very large data-set (the size, though, is not the issue) that at base has a single binary response (score 0/1) for each line of the data. Different, large blocks of the data correspond to the responses of single participants to stimuli differing in feature x, where the distribution of particular differences in feature x is different for each participant. Table (and ftable) commands are great for reducing these data to isolate the Freqs with which particular x values occur within each participant, which is what I want, including how the frequency with which the participant responded 1 (or 0) to that level of feature x. So, assiduous use of table() gives me more or less what I want: within participant, the values of x, the associated frequencies of 0 responses to those values of x, and the associated frequencies of 1 responses to those values of x. Now, what I WANT is the simple regression of the proportion of 1 responses (out of the sum of 0 and 1 responses) to each value of x on the values of x. What table() gives me is close, but useless, as I can't access the columns. But, applying data.frame() to the results from table, gives me access to the columns as variables, but returns the (re)expanded data, which does not allow me to compute the simple proportions I want. After too many hours of trying way too many desperate commands, I gave up. I printed the table(), copied it to the clipboard, pasted it into a spreadsheet, computed the proportions, fixed the header, saved it as a text file, and the read it back into R to do the regressions. There has got to be an easier way. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ 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
Re: [R] missing value where TRUE/FALSE needed
Hi as nobody has any of your variables and can not reproduce your code you has to track your problems yourself. R is kindly provided you with hint for it. a-1 b-2 value-2 if(value=avalue=b) print(right) else print(wrong) [1] right b-NA if(value=avalue=b) print(right) else print(wrong) Error in if (value = a value = b) print(right) else print(wrong) : missing value where TRUE/FALSE needed So one of your variables is NA when evaluating if statement and logical statement evaluates to NA but if expects true/false value. Besides I wonder if you cannor get rid of for cycle. On 13 Jun 2006 at 12:19, Peter Lauren wrote: Date sent: Tue, 13 Jun 2006 12:19:42 -0700 (PDT) From: Peter Lauren [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] missing value where TRUE/FALSE needed I am using R 2.3.0 and trying to run the following code. BinCnt=round(ShorterVectorLength/10) BinMatrix=matrix(nrow=BinCnt, ncol=2) Increment=(VectorRange[2]-VectorRange[1])/BinCnt BinMatrix[1,1]=VectorRange[1] BinMatrix[1,2]=VectorRange[1]+Increment for (i in 2:BinCnt) { BinMatrix[i,1]=BinMatrix[i-1,2] BinMatrix[i,2]=BinMatrix[i,2]+Increment } # Count entries in each bin Histogram=vector(length=BinCnt, mode=numeric) for (i in 1:BinCnt) Histogram[i]=0 VectorLength=length(FormerVector) for (i in 1:VectorLength) { Value=FormerVector[i] for (j in 1:BinCnt) if (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) { Histogram[j]=Histogram[j]+1 break; } } Unfotunately, at if (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) I get the following error message Error in if (Value = BinMatrix[j, 1] Value = BinMatrix[j, 2]) { : missing value where TRUE/FALSE needed I inserted browser() just before the call and (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) returned FALSE. Is there a bug in my code or a bug in my version of R? Neither. The code does not suit your data. HTH Petr Many thanks in advance, Peter. __ 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 Petr Pikal [EMAIL PROTECTED] __ 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
Re: [R] 2 Courses Near You - (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor, (2) R/Splus Fundamentals and Programming Techniques
On Tue, 2006-06-13 at 21:34 +0200, Uwe Ligges wrote: ... and again I wonder which courses are near. This leads at once to the question: which metric is in use?. Possibly this: ### Great Circle distances ### Use different sign to N and S, and to E and W ### (does not matter which sign) ### Lat and long must be in degrees + decimals (sorry) globedis - function(lat0, lon0, lat1, lon1, km = TRUE) { phi0 - pi/180*lat0 phi1 - pi/180*lat1 lambda - pi/180*(lon0 - lon1) delta - sin(phi0) * sin(phi1) + cos(phi0) * cos(phi1) * cos(lambda) delta - acos(delta) dist - 60*180/pi*delta dist - dist %% 10800 if (km) dist - 1.852 * dist dist } Which says that Boston is nearest to my office (6100km). The other alternatives are Baltimore 6720km, Chicago 6800km, Raleigh 7050km and San Francisco 8240km. In more practical metric of flight time, Baltimore is closest (OUL - BWI 12h55min), but Boston and Chicago are not much further away (OUL - BOS 14h00min, OUL-CHI 14h15min). cheers, jari oksanen Probably some football related metric: FIFA WM takes place in Dortmund and commercials say something like the world is our guest ... Now, let's escape from football to Austria and Vienna's useR!2006 conference! Uwe Ligges [EMAIL PROTECTED] wrote: XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce: (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor *** San Francisco / July 17-18, 2006 *** *** Chicago / July 24-25, 2006 *** *** Baltimore / July 27-28, 2006 *** *** Raleigh / July 17-18, 2006 *** *** Boston/ July 27-28, 2006 *** http://www.xlsolutions-corp.com/RSmicro (2) R/Splus Fundamentals and Programming Techniques *** San Francisco / July 10-11, 2006 *** *** Houston / July 13-14, 2006 *** *** San Diego / July 17-18, 2006 *** *** Chicago / July 20-21, 2006 *** *** New York City / July 24-25, 2006 *** *** Boston/ July 27-28, 2006 *** http://www.xlsolutions-corp.com/Rfund.htm Ask for group discount and reserve your seat Now - Earlybird Rates. Payment due after the class! Email Sue Turner: [EMAIL PROTECTED] Interested in our Advanced Programming class? (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor Course Outline: - R/S System: Overview; Installation and Demonstration - Data Manipulation and Management - Graphics; Enhancing Plots, Trellis - Writing Functions - Connecting to External Software - R/S Packages and Libraries (e.g. BioConductor) - BioConductor: Overview; Installation and Demonstration - Array Quality Inspection - Correction and Normalization; Affymetrix and cDNA arrays - Identification of Differentially Expressed Genes - Visualization of Genomic Information - Clustering Methods in R/Splus - Gene Ontology (GO) and Pathway Analysis - Inference, Strategies for Large Data (2) R/Splus Fundamentals and Programming Techniques Course outline. - An Overview of R and S - Data Manipulation and Graphics - Using Lattice Graphics - A Comparison of R and S-Plus - How can R Complement SAS? - Writing Functions - Avoiding Loops - Vectorization - Statistical Modeling - Project Management - Techniques for Effective use of R and S - Enhancing Plots - Using High-level Plotting Functions - Building and Distributing Packages (libraries) - Connecting; ODBC, Rweb, Orca via sockets and via Rjava Email us for group discounts. Email Sue Turner: [EMAIL PROTECTED] Phone: 206-686-1578 Visit us: www.xlsolutions-corp.com/training.htm Please let us know if you and your colleagues are interested in this class to take advantage of group discount. Register now to secure your seat! Cheers, Elvis Miller, PhD Manager Training. XLSolutions Corporation 206 686 1578 www.xlsolutions-corp.com [EMAIL PROTECTED] 2 Courses - (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor (2) R/Splus Fundamentals and Programming Techniques Interest in our R/Splus Advanced Programming? Email us for upcoming courses. __ 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 __ 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 -- Jari Oksanen -- Dept Biology, Univ Oulu,
[R] R ``literal'' comand
I know I am luddite when it comes to list-based languages, such as R. But, even these beasts must occasionally want to access objects at a literal level. For example, to a naive twit like me, x--print (y) should deposit in x a literal print out of y; that is, x should contain the *results* of applying the print method to y (e.g., something like a tab (or space)-delimited flat sheet). Sadly, no. It contains a copy of y. That is, x--print(y) == x--y. I spend more time fighting with all the list crapola (technical term for, uh, crapola) in each object than I ever manage successfully to use the object. To cut through the, uh, technical stuff, every now and again I would just like to get a simple flat object back with NO list baggage. Something like: z=literal(x), where literal() returns a flat spreadsheet-like structure with named columns and rows. Data.frame() comes close, but it always *interprets* the object first, which means it is usually quite different from what one saw with the simple print(y). Yeah, I know, I will now get a flood of emails telling me to get with the program and to learn to love y[[1]] and S4 methods or some such, or, worse: why not just write the program myself? I agree. I am an ignorant twit. But, aside from saving (or copying from the screen: my current solution) the data to a text file to remove all the list, uh, stuff (and ignoring the no doubt great pleasure to be had by chiming in to agree with my exalted twittedness), what does one do? -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ 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
[R] could someone tell me how to implement a multiple comparison test for proportions in a 2xc crosstabulation
Dear all, I wanna to do multiple comparison test for proportions (multiple chi squre ?), could someone tell me how in R, thank you! __ 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
[R] matrix log
Dear R users, Has anyone implemented a matrix log function in R similar to the function logm() in Matlab? I did a quick R site search and browsed the contributed packages to no avail. The octave function is far too simplistic and fails for the Matlab test matrix. Ideally, the code of Cheng, Higham, and Laub (2001) or something similar could be utilized. Just checking before I spend time porting code. cheers... Brandon Translational Medicine Genetics GlaxoSmithKline [[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
Re: [R] R ``literal'' comand
capture.output(...) If you want a single string, with newlines: paste(capture.output(...), collapse = \n) -- Bjørn-Helge Mevik __ 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
[R] set.seed
Hi R users, Sorry for a simple question: I found different people use different i in set.seed(i), are there any rules to choose an i or one can choose as he likes? Thanks Xiaohua __ 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
Re: [R] Decimal series how to make.........
On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 10:05:56 -- XFMail -- __ 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
Re: [R] A whine and a request
I'm not sure if I understand your problem exactly, so I'm taking a wild guess: When you coerce a 2-d table object to data frame, what you get are three columns: the two class variables and the frequencies. If so, this might help: x - sample(1:2, 20, replace=TRUE) y - sample(1:3, 20, replace=TRUE) tab - table(x, y) as.data.frame(tab) x y Freq 1 1 12 2 2 12 3 1 27 4 2 22 5 1 33 6 2 34 as.data.frame(unclass(tab)) 1 2 3 1 2 7 3 2 2 2 4 Andy _ From: [EMAIL PROTECTED] on behalf of John Vokey Sent: Wed 6/14/2006 2:53 AM To: r-help@stat.math.ethz.ch Subject: [R] A whine and a request [Broadcast] guRus and useRs, As I instruct my students: With R what is difficult in anything else, is easy, usually one line of code; but, what is easy in anything else, is *^%$%#$... (translation: next to impossible) in R. I just ran into such a case that has, to put it mildly, driven me to use spreadsheets (if that is not a sign of complete desperation, I don't know what is). It has nothing to do with particular versions of R or what OS I am using, but something more fundamental. Here it is. First, I have a very large data-set (the size, though, is not the issue) that at base has a single binary response (score 0/1) for each line of the data. Different, large blocks of the data correspond to the responses of single participants to stimuli differing in feature x, where the distribution of particular differences in feature x is different for each participant. Table (and ftable) commands are great for reducing these data to isolate the Freqs with which particular x values occur within each participant, which is what I want, including how the frequency with which the participant responded 1 (or 0) to that level of feature x. So, assiduous use of table() gives me more or less what I want: within participant, the values of x, the associated frequencies of 0 responses to those values of x, and the associated frequencies of 1 responses to those values of x. Now, what I WANT is the simple regression of the proportion of 1 responses (out of the sum of 0 and 1 responses) to each value of x on the values of x. What table() gives me is close, but useless, as I can't access the columns. But, applying data.frame() to the results from table, gives me access to the columns as variables, but returns the (re)expanded data, which does not allow me to compute the simple proportions I want. After too many hours of trying way too many desperate commands, I gave up. I printed the table(), copied it to the clipboard, pasted it into a spreadsheet, computed the proportions, fixed the header, saved it as a text file, and the read it back into R to do the regressions. There has got to be an easier way. -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html http://www.gnu.org/philosophy/no-word-attachments.html -Dr. John R. Vokey __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html http://www.R-project.org/posting-guide.html __ 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
Re: [R] could someone tell me how to implement a multiple comparison test for proportions in a 2xc crosstabulation
?p.adjust It's the function used to Adjust P-values for Multiple Comparisons. 2006/6/14, xingwang ye [EMAIL PROTECTED]: Dear all, I wanna to do multiple comparison test for proportions (multiple chi squre ?), could someone tell me how in R, thank you! __ 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 -- 黄荣贵 Deparment of Sociology Fudan 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
Re: [R] Cramer-von Mises normality test
Hi Robert, On Tue, 13 Jun 2006, Robert Powell wrote: I've been running some normality tests using the nortest package. For some of my datasets the Cramer-von Mises normality test generates an extremely high probability (e.g., 1.637e+31) and indicates normality when the other tests do not. Is there something I'm misunderstanding or potentially a bug in the code? Below are the results of the tests and then, below that, I've provided that column of the datafile. Well, I can't answer all of your questions, but I did try your sample and at least your installation does the same thing as mine. That is, for your sample data, I got the same results. Each test is slightly different and looks for different characteristics. So, it is not unusual for one test to indicate normality, but another one doesn't. Granted, the difference in p-value is quite large... I plotted the histogram of your data and to me, it doesn't look very normal...not very scientific, I know... If you can locate it, I suggest finding the book Testing for Normality which the Nortest package cites. It is quite good and might explain something to you...unfortunately, neither it nor any source I've found gives a simple table that says: Use test X if you want to see if the Y property of the distribution is normal. (Various tests seems to place different emphasis on different things...) Ray __ 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
Re: [R] set.seed
set.seed is used to set the random number seed. When we use functions ,say runif, to generate random number ,we almost get different set of random number. runif(5) [1] 0.2096388 0.3427873 0.5455948 0.7694844 0.4287647 runif(5) [1] 0.6864617 0.5218690 0.7965364 0.9030520 0.4324572 But in some cases,we want the results reproducible.so we use set.seed before generate the number. set.seed(100) runif(5) [1] 0.30776611 0.25767250 0.55232243 0.05638315 0.46854928 set.seed(100) runif(5) [1] 0.30776611 0.25767250 0.55232243 0.05638315 0.46854928 So if you set the same random number seed before you generate the number,you get the same result.(That's why we call it pesudo-random number.) As for what the i in set.seed(i) should be,I don't think it is a serious matter. 2006/6/14, Xiaohua Dai [EMAIL PROTECTED]: Hi R users, Sorry for a simple question: I found different people use different i in set.seed(i), are there any rules to choose an i or one can choose as he likes? Thanks Xiaohua __ 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 -- 黄荣贵 Deparment of Sociology Fudan 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
Re: [R] could someone tell me how to implement a multiple comparison test for proportions in a 2xc crosstabulation
Maybe you want the package multcomp. On 6/14/06, xingwang ye [EMAIL PROTECTED] wrote: Dear all, I wanna to do multiple comparison test for proportions (multiple chi squre ?), could someone tell me how in R, thank you! __ 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 -- 此致 敬礼! 华孝挺 浙江大学核农所 杭州,中国 310029 __ 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
Re: [R] set.seed
ronggui wrote: set.seed is used to set the random number seed. When we use functions ,say runif, to generate random number ,we almost get different set of random number. As for what the i in set.seed(i) should be,I don't think it is a serious matter. The help for set.seed tells you all you need to know. 'i' must be a single value interpreted as an integer. You can give it a decimal number, but it makes it an integer: set.seed(pi) runif(2) [1] 0.1680415 0.8075164 set.seed(3) runif(2) [1] 0.1680415 0.8075164 But not too big an 'integer': set.seed(1e100) Error in set.seed(1e+100) : supplied seed is not a valid integer In addition: Warning message: NAs introduced by coercion because 1e100 isn't represented as an integer internally (in C/Fortran code, its a 'float' or'double precision' type of thing. For me it takes signed 32 bit integers, so the limits are +/- 2147483647: set.seed(2147483647) set.seed(-2147483647) set.seed(-2147483648) Error in set.seed(-2147483648) : supplied seed is not a valid integer In addition: Warning message: NAs introduced by coercion set.seed(2147483648) Error in set.seed(2147483648) : supplied seed is not a valid integer In addition: Warning message: NAs introduced by coercion A 32 bit integer gives you over 4 billion possible random sequences. Is that enough? Barry __ 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
[R] how to make a series with decimal increment
Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance with regards anil kumar ANIL KUMAR( METEOROLOGIST) LRF SECTION NATIONAL CLIMATE CENTER ADGM(RESEARCH) INDIA METEOROLOGICAL DEPARTMENT SHIVIJI NAGAR PUNE-411005 INDIA MOBILE +919422023277 [EMAIL PROTECTED] [[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
[R] write data from function into external table
Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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
[R] R internal clock time discrepancy
Dear R: I'm trying to map some time series data on to dates and because I'm using R's strptime' facility I get an hour's break in my time series: my readings for between 1am and 2am on 27th March 2005 won't map onto anything (I'm using a data logger to record temperature and other things in a forest). As far as I know, the clock's didn't change on 27th March 2005 so why is this happening? start=strptime(2005-03-27 00:00,%Y-%m-%d %H:%M) end=strptime(2005-03-27 02:30,%Y-%m-%d %H:%M) seq(from=start,to=end,by=30*60) [1] 2005-03-27 00:00:00 GMT Standard Time 2005-03-27 00:30:00 GMT Standard Time 2005-03-27 02:00:00 GMT Standard Time [4] 2005-03-27 02:30:00 GMT Standard Time as.numeric(seq(from=start,to=end,by=30*60)) [1] 881600 883400 885200 887000 as.numeric(seq(from=start,to=end,by=30*60))/(30*60) [1] 617712 617713 617714 617715 Any help much appreciated! Toby Marthews ___ For super low premiums, click here http://www.webmail.co.za/dd.pwm http://www.webmail.co.za the South African FREE email service __ 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
Re: [R] write data from function into external table
maybe you're looking for something like, test - 1:3 testfct - function(x){ x[1] - 100 x } test testfct(1) testfct(test) 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: Sebastian Leuzinger [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, June 14, 2006 12:41 PM Subject: [R] write data from function into external table Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 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
Re: [R] write data from function into external table
What is your desired output ? This will clarify the problem greatly. Perhaps, this might be of some use : f - function(v, pos, val=100){ v[pos] - val; return(v) } test - 1:3 test - f(test, 1) test [1] 100 2 3 Regards, ADai On Wed, 2006-06-14 at 12:41 +0200, Sebastian Leuzinger wrote: Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 __ 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
[R] Estimate region of highest probabilty density
Estimate region of highest probabilty density Dear R-community I have data consisting of x and y. To each pair (x,y) a z value (weight) is assigned. With kde2d I can estimate the densities on a regular grid and based on this make a contour plot (not considering the z-values). According to an earlier post in the list I adjusted the kde2d to kde2d.weighted (see code below) to estimate the densities of x and y considering their weights z. There's also a piece of code with artificial data. Now my question: Does a function exist which calculates the value of the level corresponding to a certain percentage of the volume (i.e. above this level e.g. 95% of the total volume lie, the (parameter) region of highest probability density)? And secondly: How is it in the case of n parameters, when I don't want to plot it anymore but estimate quantiles for each parameter considering also the weight z (to each set of parameters c(v,w,x,y) a weight z is assigned)? Many thanks in advance, I am very grateful for any hint Chris # MASS::kde2d copied and modified # === library(MASS) kde2d.weighted - function (x, y, w, h, n = n, lims = c(range(x), range(y))) { nx - length(x) if (length(y) != nx) stop(data vectors must be the same length) gx - seq(lims[1], lims[2], length = n) # gridpoints x gy - seq(lims[3], lims[4], length = n) # gridpoints y if (missing(h)) h - c(bandwidth.nrd(x), bandwidth.nrd(y)); if (missing(w)) w - numeric(nx)+1; h - h/4 ax - outer(gx, x, -)/h[1] # distance of each point to each grid point in x-direction ay - outer(gy, y, -)/h[2] # distance of each point to each grid point in y-direction z - (matrix(rep(w,n), nrow=n, ncol=nx, byrow=TRUE)*matrix(dnorm(ax), n, nx)) %*% t(matrix(dnorm(ay), n, nx))/(sum(w) * h[1] * h[2]) # z is the density return(list(x = gx, y = gy, z = z)) } # Generate artificial data # x - runif(2,-5,5) y - runif(2,-5,5) z - dnorm(x, mean=0, sd=1)*dnorm(y, mean=0, sd=1) # plot data # = library(Rcmdr) scatter3d(x=x,z=y,y=z,surface=FALSE,xlab=x,ylab=z,zlab=y,bg.col=black) temp0 - kde2d(x=x, y=y, n = 100, lims=c(range(x),range(y))) contour(x=temp0$x, y=temp0$y, z=temp0$z, xlab=x, ylab=y, main=z) temp - kde2d.weighted(x=x, y=y, w=z, n = 100, lims=c(range(x),range(y))) contour(x=temp$x, y=temp$y, z=temp$z, xlab=x, ylab=y, main=z, col=red, add=TRUE) °°° Christoph Ort Eawag - aquatic research Environmental Engineering Überlandstrasse 133 CH-8600 Dübendorf phone: +41-44-823-5041 fax: +41-44-823-5389 cell: +41-79-218-9242 mailto:[EMAIL PROTECTED] http://www.eawag.ch/~ortchris/ http://www.eawag.ch °°° Christoph Ort Eawag - aquatic research Environmental Engineering Überlandstrasse 133 CH-8600 Dübendorf phone: +41-44-823-5041 fax: +41-44-823-5389 cell: +41-79-218-9242 mailto:[EMAIL PROTECTED] http://www.eawag.ch/~ortchris/ http://www.eawag.ch __ 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
Re: [R] Decimal series how to make.........
On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. __ 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
Re: [R] write data from function into external table
Here are two alternatives. See ?- testfct1 - function() test[1] - 100 # following one can be written more compactly as # testfct2 - function(test) replace(test, 1, 100) testfct2 - function(test) { test[1] - 100; test } # test test - 1:3; testfct1(); test test - 1:3; test - testfct2(test); test On 6/14/06, Sebastian Leuzinger [EMAIL PROTECTED] wrote: Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 __ 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
Re: [R] write data from function into external table
Thanks for the hints, they are useful to me. However, I still do not understand why my approach fails. In a user defined function, R does not seem to want to write into an object defined outside this function. (see my first example below). I guess there is some logic behind this. On Wednesday 14 June 2006 14:22, you wrote: Here are two alternatives. See ?- testfct1 - function() test[1] - 100 # following one can be written more compactly as # testfct2 - function(test) replace(test, 1, 100) testfct2 - function(test) { test[1] - 100; test } # test test - 1:3; testfct1(); test test - 1:3; test - testfct2(test); test On 6/14/06, Sebastian Leuzinger [EMAIL PROTECTED] wrote: Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 -- Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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
[R] lmer binomial model overestimating data?
Hi folks, Warning: I don't know if the result I am getting makes sense, so this may be a statistics question. The fitted values from my binomial lmer mixed model seem to consistently overestimate the cell means, and I don't know why. I assume I am doing something stupid. Below I include code, and a binary image of the data is available at this link: http://www.cas.muohio.edu/~stevenmh/tf.RdataBin This was done with `Matrix' version 0.995-10 and `lme4' version 0.995-2. and R v. 2.3.1 on a Mac, OS 10.4.6. The binomial model below (mod) was reduced from a more complex one by first using AIC, BIC and LRT for random effects, and then relying on Helmert contrasts and AIC, BIC, and LRT to simplify fixed effects. Maybe this was wrong? load(tf.RdataBin) library(lme4) options(contrasts=c(contr.helmert, contr.poly)) mod - lmer(tfb ~ reg+nutrient+amd +reg:nutrient+ + (1|rack) + (1|popu) + (1|gen), data=dat.tb2, family=binomial, method=Laplace) summary(mod) Generalized linear mixed model fit using Laplace Formula: tfb ~ reg + nutrient + amd + reg:nutrient + (1 | rack) + (1 | popu) + (1 | gen) Data: dat.tb2 Family: binomial(logit link) AICBIC logLik deviance 402.53 446.64 -191.26 382.53 Random effects: Groups NameVariance Std.Dev. gen(Intercept) 0.3850.621 popu (Intercept) 0.5480.741 rack (Intercept) 0.4010.633 number of obs: 609, groups: gen, 24; popu, 9; rack, 2 Estimated scale (compare to 1) 0.80656 Fixed effects: Estimate Std. Error z value Pr(|z|) (Intercept) 2.391 0.5744.17 3.1e-05 reg1 0.842 0.4521.86 0.06252 reg2 0.800 0.2413.32 0.00091 nutrient1 0.788 0.1974.00 6.3e-05 amd1 -0.540 0.139 -3.88 0.00010 reg1:nutrient10.500 0.2272.21 0.02734 reg2:nutrient1 -0.176 0.146 -1.21 0.22794 Correlation of Fixed Effects: (Intr) reg1 reg2 ntrnt1 amd1 rg1:n1 reg1 0.169 reg2-0.066 -0.191 nutrient10.178 0.231 -0.034 amd1-0.074 -0.044 -0.052 -0.078 reg1:ntrnt1 0.157 0.307 -0.180 0.562 -0.002 reg2:ntrnt1 -0.028 -0.154 0.236 0.141 0.033 -0.378 X - mod @ X fitted - X %*% fixef(mod) unlogitH - function(x) {( 1 + exp(-x) )^-1} (result - data.frame(Raw.Data=with(dat.tb2, + tapply(tfb, list(reg:nutrient:amd), + mean ) ), + Fitted.Estimates=with(dat.tb2, + tapply(fitted, list(reg:nutrient:amd), + function(x) unlogitH(mean(x)) ) ) )) Raw.Data Fitted.Estimates SW:1:unclipped 0.50877 0.69520 SW:1:clipped0.41304 0.43669 SW:8:unclipped 0.67273 0.85231 SW:8:clipped0.52830 0.66233 NL:1:unclipped 0.9 0.81887 NL:1:clipped0.53571 0.60578 NL:8:unclipped 0.96552 0.98830 NL:8:clipped0.96154 0.96635 SP:1:unclipped 0.98649 0.98361 SP:1:clipped0.92537 0.95328 SP:8:unclipped 1.0 0.99308 SP:8:clipped0.95890 0.97992 ### Perhaps the cell SP:8:clipped = 1.0 is messing up the fit? pdf(RawAndFitted.pdf) par(mar=c(8,3,2,2), las=2) barplot(t(result), beside=TRUE ) box(); title(Fractions of Plants Producing Fruits) legend(topleft, c(Raw Data, Fitted Values), +fill=gray.colors(2), bty=n ) dev.off() quartz 2 _ platform powerpc-apple-darwin8.6.0 arch powerpc os darwin8.6.0 system powerpc, darwin8.6.0 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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
Re: [R] write data from function into external table
On Wed, 14 Jun 2006, Sebastian Leuzinger wrote: Thanks for the hints, they are useful to me. However, I still do not understand why my approach fails. In a user defined function, R does not seem to want to write into an object defined outside this function. (see my first example below). I guess there is some logic behind this. I think the general programming concept you are looking for is scope, see sec. 10.7 in the R intro: http://cran.r-project.org/doc/manuals/R-intro.html#Scope There's more (and more technical) about it in the R Language Definition. best Niels On Wednesday 14 June 2006 14:22, you wrote: Here are two alternatives. See ?- testfct1 - function() test[1] - 100 # following one can be written more compactly as # testfct2 - function(test) replace(test, 1, 100) testfct2 - function(test) { test[1] - 100; test } # test test - 1:3; testfct1(); test test - 1:3; test - testfct2(test); test On 6/14/06, Sebastian Leuzinger [EMAIL PROTECTED] wrote: Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 -- Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 __ 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
Re: [R] write data from function into external table
If functions don't modify their environment then its generally easier to debug programs so it encourarges better programming. On 6/14/06, Sebastian Leuzinger [EMAIL PROTECTED] wrote: Thanks for the hints, they are useful to me. However, I still do not understand why my approach fails. In a user defined function, R does not seem to want to write into an object defined outside this function. (see my first example below). I guess there is some logic behind this. On Wednesday 14 June 2006 14:22, you wrote: Here are two alternatives. See ?- testfct1 - function() test[1] - 100 # following one can be written more compactly as # testfct2 - function(test) replace(test, 1, 100) testfct2 - function(test) { test[1] - 100; test } # test test - 1:3; testfct1(); test test - 1:3; test - testfct2(test); test On 6/14/06, Sebastian Leuzinger [EMAIL PROTECTED] wrote: Dear list, My apologies if a solution / explanation to this already exists on the list, but it is difficult to assign it to a certain keyword. test-c(1:3) testfct - function(x) {test[1]-100} test [1] 1 2 3 testfct(1) [1] 1 2 3 Basically, I would like to write data into an external table that the function does not know. Why is this not working / what alternatives exist? Thanks, Sebastian Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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 -- Sebastian Leuzinger University of Basel, Department of Environmental Science Institute of Botany Schönbeinstr. 6 CH-4056 Basel ph0041 (0) 61 2673511 fax 0041 (0) 61 2673504 email [EMAIL PROTECTED] web http://pages.unibas.ch/botschoen/leuzinger __ 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
[R] number of iteration s exceeded maximum of 50
Hi all, I found r-site-research not work for me these days. When I was doing nls( ) , there was an error number of iterations exceeded maximum of 50. I set number in nls.control which is supposed to control the number of iterations but it didn't work well. Could anybody with this experience tell me how to fix it? Thanks in advance! Leaf [[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
Re: [R] Decimal series how to make.........
On 14-Jun-06 Gabor Grothendieck wrote: On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. On those lines, I'd settle for (0:10)/10 -- I always make a point of putting ranges like 0:10 in (...) since there are too many traps for the unwary. Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 14:46:24 -- XFMail -- __ 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
[R] fclustIndex(package e1071) error: LaPack Routine dgesv
Dear colleagues: Despite my best efforts, I have not been able to understand/overcome an error message I received while running the fclustIndex command in package e1071, which produces validity measures for the fuzzy c-means clustering algorithm. I am relatively new to R-- and still depend heavily on Rcmdr-- and so I apologize in advance if there is an obvious answer to my question: My code is as follows: library(e1071) Dataset - read.dta(/Users/chris/Desktop/Fuzzy Cluster.dta, convert.dates=TRUE, convert.factors=TRUE, missing.type=TRUE, convert.underscore=TRUE, warn.missing.labels=TRUE) row.names(Dataset) - as.character(Dataset$cntry) Dataset$cntry - NULL cl - cmeans(Dataset, 4, 20, verbose=TRUE, method=cmeans) resultindexes - fclustIndex(cl, Dataset, index= all) resultindexes I am receiving the following error message: ERROR: Lapack routine dgesv I have tried running the example for fclustIndex and it works fine. The code above is based on the example from the manual (below). I also checked that I have the latest version installed. I have also had no trouble running similar commands from other packages which leads me to believe that everything is installed/compiled properly-- where have I gone wrong? The description of fclustIndex in the e1071 .pdf is available via the following link: http://rweb.stat.umn.edu/R/library/e1071/html/fclustIndex.html I thank you in advance for your time and help. Sincerely, Christopher Bail __ 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
[R] lmer and mixed effects logistic regression
I'm using FC4 and R 2.3.1 to fit a mixed effects logistic regression. The response is 0/1 and both the response and the age are the same for each pair of observations for each subject (some observations are not paired). For example: id response age 10 30 10 30 21 55 21 55 30 37 41 52 50 39 50 39 etc. I get the following error: (lmer(response~(1|id)+age,data=gdx,family=binomial)) Error in deviance(.Call(mer_coefGets, x, pars, 2, PACKAGE = Matrix)) : Leading minor of order 2 in downdated X'X is not positive definite Similar problem if I use quasibinomial. If I use glm, of course it thinks I have roughly twice the number of subjects so the standard errors would be smaller than they should be. I used SAS's NLMIXED and it converged without problems giving me parameter estimates close to what glm gives, but with larger standard errors. glmmPQL(MASS) gives very different parameter estimates. Is it reasonable to fit a mixed effects model in this situation? Is there some way to give starting values for lmer and/or glmmPQL? 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
Re: [R] missing value where TRUE/FALSE needed
Hi Petr, You are correct. There was an NA in BinMatrix. I made the mistake of only looking at the earlier entries. My problem was in this loop for (i in 2:BinCnt) { BinMatrix[i,1]=BinMatrix[i-1,2] BinMatrix[i,2]=BinMatrix[i,2]+Increment } It should have been for (i in 2:BinCnt) { BinMatrix[i,1]=BinMatrix[i-1,2] BinMatrix[i,2]=BinMatrix[i,1]+Increment } Thanks very much, Peter. --- Petr Pikal [EMAIL PROTECTED] wrote: Hi as nobody has any of your variables and can not reproduce your code you has to track your problems yourself. R is kindly provided you with hint for it. a-1 b-2 value-2 if(value=avalue=b) print(right) else print(wrong) [1] right b-NA if(value=avalue=b) print(right) else print(wrong) Error in if (value = a value = b) print(right) else print(wrong) : missing value where TRUE/FALSE needed So one of your variables is NA when evaluating if statement and logical statement evaluates to NA but if expects true/false value. Besides I wonder if you cannor get rid of for cycle. On 13 Jun 2006 at 12:19, Peter Lauren wrote: Date sent:Tue, 13 Jun 2006 12:19:42 -0700 (PDT) From: Peter Lauren [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject: [R] missing value where TRUE/FALSE needed I am using R 2.3.0 and trying to run the following code. BinCnt=round(ShorterVectorLength/10) BinMatrix=matrix(nrow=BinCnt, ncol=2) Increment=(VectorRange[2]-VectorRange[1])/BinCnt BinMatrix[1,1]=VectorRange[1] BinMatrix[1,2]=VectorRange[1]+Increment for (i in 2:BinCnt) { BinMatrix[i,1]=BinMatrix[i-1,2] BinMatrix[i,2]=BinMatrix[i,2]+Increment } # Count entries in each bin Histogram=vector(length=BinCnt, mode=numeric) for (i in 1:BinCnt) Histogram[i]=0 VectorLength=length(FormerVector) for (i in 1:VectorLength) { Value=FormerVector[i] for (j in 1:BinCnt) if (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) { Histogram[j]=Histogram[j]+1 break; } } Unfotunately, at if (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) I get the following error message Error in if (Value = BinMatrix[j, 1] Value = BinMatrix[j, 2]) { : missing value where TRUE/FALSE needed I inserted browser() just before the call and (Value=BinMatrix[j,1] Value=BinMatrix[j,2]) returned FALSE. Is there a bug in my code or a bug in my version of R? Neither. The code does not suit your data. HTH Petr Many thanks in advance, Peter. __ 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 Petr Pikal [EMAIL PROTECTED] __ 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
[R] merge dataframes with conditions formulated as logical expressions
I have a data.frame df containing two variables: GRP: Factor VAL: num I have a data.frame dp containing: GRP: Factor MIN.VAL: num MAX.VAL: num VAL2: num with several rows per GRP where dp[i-1, MAX.VAL] dp[i, MIN.VAL] within the same GRP. I want to create df[i, VAL2] - dpp[z, VAL2] withi along df and dpp - subset( dp, GRP = df[i, GRP] ) so that it is true for each i: df[i, VAL] dpp[z, MIN.VAL] and df[i, VAL] = dpp[z, MAX.VAL] Is there an easy/efficient way to do that? Example: df - data.frame( GRP=c( A, A, B ), VAL=c( 10, 100, 200 ) ) dp - data.frame( GRP=c( A, A, B, B ), MIN.VAL=c( 1, 50, 1, 70 ), MAX.VAL=c( 49, 999, 59, 999 ), VAL2=c( 1.1, 2.2, 3.3, 4.4 ) ) The result should be: df$VAL2 - c( 1.1, 2.2, 4.4 ) Thanks - Wolfram __ 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
Re: [R] data set size question
If you need to analyze something bigger than memory can hold, one option is the biglm package which will fit linear regression models (and a lot of different analyses can be restructured as linear regression models) on blocks of data so that the entire dataset is not in memory all at the same time. I tested it out with a database with over 23 million rows and it worked great. It computed the exact same answers (to about 7 decimal places, I didn't bother to look beyond that) as a couple of other methods used for the same values. Hope this helps, -- 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 Carl Hauser Sent: Tuesday, June 13, 2006 9:22 PM To: r-help@stat.math.ethz.ch Subject: [R] data set size question Hi there, I'm very new to R and am only in the beginning stages of investigating it for possible use. A document by John Maindonald at the r-project website entitled Using R for Data Analysis and Graphics: Introduction, Code and Commentary contains the following paragraph, The R system may struggle to handle very large data sets. Depending on available computer memory, the processing of a data set containing one hundred thousand observations and perhaps twenty variables may press the limits of what R can easily handle. This document was written in 2004. My questions are: Is this still the case? If so, has anyone come up with creative solutions to mitigate these limitations? If you work with large data sets in R, what have your experiences been? From what I've seen so far, R seems to have enormous potential and capabilities. I routinely work with data sets of several hundred thousand to several million. It would be unfortunate if such potential and capabilities were not realized because of (effective) data set size limitations. Please tell me it ain't so. Thanks for any help or suggestions. Carl [[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 __ 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
[R] positioning of separate y-axis labels in xyplot
I like the functionality provided by outer=TRUE, but when it comes time to place separate xlabs or ylabs, I always end up 'eyeballing' it on a case-by-case basis. For example, ##begin example require(lattice) cars.lo - loess(dist ~ speed, cars) print(xyplot(cars.lo$residuals+cars.lo$fitted~cars.lo$x, strip=FALSE, outer=TRUE, layout=c(1,2), ylab=, scales=list(y=list(relation=free,rot=0)), panel=function(x,y,panel.number,...){ if(panel.number==1){ panel.xyplot(x,y) panel.abline(h=0) }else{ panel.xyplot(x,y=cars.lo$y) panel.xyplot(x,y,type=l) } })) require(grid) trellis.focus(panel, 1, 1, clip.off=TRUE, highlight=FALSE) grid.text(residuals, x=unit(0, npc) + unit(-2, lines),rot=90) trellis.focus(panel, 1, 2, clip.off=TRUE, highlight=FALSE) grid.text(fitted, x=unit(0, npc) + unit(-2, lines),rot=90) ## end example In this case, a distance of -2 lines happens to be enough, but one has to make the plot to know this. I'm interested in learning how one can place the ylabs without fear of overlapping the tick labels; i.e., how to use the exact space allocated by ylab=. I'm thinking it must involve viewports? Ben __ 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
Re: [R] Decimal series how to make.........
I agree although if you use this construct a lot then you will likely want to adopt the easier-to-write 0:10/10 style as an idiom. I find this is particularly the case with rq from the quantreg package where its convenient to use it in specifying the tau= arg: library(quantreg) data(engel) rq(y ~ x, data = engel, tau = 1:9/10) On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 Gabor Grothendieck wrote: On 6/14/06, Ted Harding [EMAIL PROTECTED] wrote: On 14-Jun-06 anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) As well as the use of 'seq' which other have suggested, a nice clean technique is s - 0.1*(0:10) which also is easier to type than s - seq(0,1,by=0.1) or 0:10/10 which is even easier to type although perhaps not as clear. On those lines, I'd settle for (0:10)/10 -- I always make a point of putting ranges like 0:10 in (...) since there are too many traps for the unwary. Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 14-Jun-06 Time: 14:46:24 -- XFMail -- __ 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 __ 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
[R] storing/retrieving simulation data
Hi all, Would someone please provide efficient code for sending Monte Carlo simulation results and/or graphs run by run to an output file. This is followed by pulling the file back in for subsequent analyses. This is probably topic-specific, so here is a basic example. Suppose I want to examine R2 in multiple regression given X1 and X2. I set the 2 betas and run 10,000 simulations of N=500. This is done separately for 3 different correlations between X1 and X2 and for 2 distributions. Each of the 6 sets of results should be stored separately. I then want to pull in the 6 files to compare R2 between them. What is the most efficient way to export and then import the results? I was using SAS but got tired of the DATA/PROC step problems, and I hear that R is simpler to implement. Thanks in advance, Jeff Miller [[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
[R] data managment
First I would really like to thank the mailing list for help I got in the past, as a new to R I am really needing some support on hoe to code the following problem. I am trying to sort some data I have in a big file. The file has 4 columns and 19000 rows. An example of it looks like this:- G 0.892 A 0.108 G 0.883 T 0.117 T 0.5 C 0.5 A 0.617 G 0.383 G 0.925 A 0.075 A 0.967 G 0.033 C 0.883 T 0.117 C 0.633 T 0.367 G 0.95 A 0.05 C 0.742 G 0.258 G 0.875 T 0.125 T 0.167 C 0.833 C 0.792 A 0.208 Columns one and three are alphabets while three and four are their corresponding values. I wanted to sort this data so that my first and third columns are in alphabetic order. For example in the first row the order is G then A. This is not in alphabetic order therefore we swap them along with their values and it becomes: A0.108 G 0.892 Row two looks fine but row three needs the same rearrangement as row one. And the final out put looks like: A 0.108 G 0.892 G 0.883 T 0.117 C 0.5 T 0.5 A 0.617 G 0.383 A 0.075 G 0.925 A 0.967 G 0.033 C 0.883 T 0.117 C 0.633 T 0.367 A 0.05 G 0.95 C 0.742 G 0.258 G 0.875 T 0.125 C 0.833 T 0.167 A 0.208 C 0.792 Please some help with the relevant command names or a technique to code this task. Thank you in advance Regards Hannes [[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
Re: [R] positioning of separate y-axis labels in xyplot
On 6/14/06, Benjamin Tyner [EMAIL PROTECTED] wrote: I like the functionality provided by outer=TRUE, but when it comes time to place separate xlabs or ylabs, I always end up 'eyeballing' it on a case-by-case basis. For example, ##begin example require(lattice) cars.lo - loess(dist ~ speed, cars) print(xyplot(cars.lo$residuals+cars.lo$fitted~cars.lo$x, strip=FALSE, outer=TRUE, layout=c(1,2), ylab=, scales=list(y=list(relation=free,rot=0)), panel=function(x,y,panel.number,...){ if(panel.number==1){ panel.xyplot(x,y) panel.abline(h=0) }else{ panel.xyplot(x,y=cars.lo$y) panel.xyplot(x,y,type=l) } })) require(grid) trellis.focus(panel, 1, 1, clip.off=TRUE, highlight=FALSE) grid.text(residuals, x=unit(0, npc) + unit(-2, lines),rot=90) trellis.focus(panel, 1, 2, clip.off=TRUE, highlight=FALSE) grid.text(fitted, x=unit(0, npc) + unit(-2, lines),rot=90) ## end example For the record, one alternative is something like with(cars.lo, xyplot(residuals + fitted ~ x, strip=FALSE, strip.left = TRUE, outer=TRUE, layout=c(1,2), ylab=, scales=list(y=list(relation=free,rot=0)), panel=function(x,y,panel.number,...){ if (panel.number==1){ panel.xyplot(x,y) panel.abline(h=0) }else{ panel.xyplot(x,y=cars.lo$y) panel.xyplot(x,y,type=l) } })) In this case, a distance of -2 lines happens to be enough, but one has to make the plot to know this. I'm interested in learning how one can place the ylabs without fear of overlapping the tick labels; i.e., how to use the exact space allocated by ylab=. I'm thinking it must involve viewports? There is a single viewort for ylab, which you can get to with downViewport(trellis.vpname(ylab)) or trellis.focus(ylab) (the latter currently doesn't work because of a bug). This viewport spans all the panels, but you could place your labels suitably if you know how many rows of panels you have. BTW, ylab = may not actually create this viewport, but ylab = should be safe. 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
Re: [R] merge dataframes with conditions formulated as logical expressions
You have discontinuity between your MIN.VAL and MAX.VAL for a given group. If this is true in practise, then you may want to check and report when VAL is in the discontinuous region. Here is my solution that ignores that (and only uses MIN.VAL and completely disrespecting MAX.VAL). Not very elegant but should do the trick. df - data.frame( GRP=c( A, A, B ), VAL=c( 10, 100, 200 ) ) dp - data.frame( GRP=c( A, A, B, B ), MIN.VAL=c( 1, 50, 1, 70 ), MAX.VAL=c( 49, 999, 59, 999 ), VAL2=c( 1.1, 2.2, 3.3, 4.4 ) ) x - split(df, df$GRP) y - split(dp, dp$GRP) out - NULL for(g in names(x)){ xx - x[[g]] yy - y[[g]] w - cut(xx$VAL, breaks=c(yy$MIN.VAL, Inf), labels=F) tmp - cbind(xx, yy[w, VAL2]) colnames(tmp) - c(GRP, VAL, VAL2) out - rbind(out, tmp) } out Regards, Adai On Wed, 2006-06-14 at 16:55 +0200, Wolfram Fischer wrote: I have a data.frame df containing two variables: GRP: Factor VAL: num I have a data.frame dp containing: GRP: Factor MIN.VAL: num MAX.VAL: num VAL2: num with several rows per GRP where dp[i-1, MAX.VAL] dp[i, MIN.VAL] within the same GRP. I want to create df[i, VAL2] - dpp[z, VAL2] withi along df and dpp - subset( dp, GRP = df[i, GRP] ) so that it is true for each i: df[i, VAL] dpp[z, MIN.VAL] and df[i, VAL] = dpp[z, MAX.VAL] Is there an easy/efficient way to do that? Example: df - data.frame( GRP=c( A, A, B ), VAL=c( 10, 100, 200 ) ) dp - data.frame( GRP=c( A, A, B, B ), MIN.VAL=c( 1, 50, 1, 70 ), MAX.VAL=c( 49, 999, 59, 999 ), VAL2=c( 1.1, 2.2, 3.3, 4.4 ) ) The result should be: df$VAL2 - c( 1.1, 2.2, 4.4 ) Thanks - Wolfram __ 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 __ 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
[R] appending
All, In the function below I have 24 individuals and 6 calculations per individual. The 6 calculations are collected each time in a 1:24 loop when calculating delta. I'd like to collect all 144 = 24*6 calculations in one vector (delta.patient.comb). The function works as is via indexing, but is there an easier way to collect the measurements via appendinng the 6 measurements each time to the current set? I couldn't find anything in Intro to R on appending. cheers, Dave ps - please respond directly to [EMAIL PROTECTED] creatine.function.new = function(delta.0.Y.0, gamma, comp.LIS.frm, comp.CAND.frm) { ## function to calcuate the delta.i, i.e. the percent ## leftover ## gamma = rate of Cr going into bucket, e.g., mg/hr ## delta.0.Y.0 = product of delta.0 and Y.0 at baseline ## Y.1 = delta.0.Y.0 + gamma delta = numeric(6) delta.patient = numeric(24) delta.patient.comb = numeric(144) ## for (k in 1:24) { ## each patient patient.k.CAND = which(comp.CAND.frm$Patient_no == k) Ucr.CAND.patient.k = comp.CAND.frm$Ucr[patient.k.CAND] C = Ucr.CAND.patient.k ## 6 observed creatanine values for each patient delta[1] = (Y.1 - C[1])/Y.1 Y.i = Y.1 delta.i = delta[1] for (i in 1:5) {## six measurments per patient Y.i.plus.1 = delta.i * Y.i + gamma delta.i.plus.1 = (Y.i.plus.1 - C[i+1])/Y.i.plus.1 delta[i+1] = delta.i.plus.1 delta.i = delta[i+1] Y.i = Y.i.plus.1 } delta.patient[k] = list(delta) delta.patient.comb[(6*(k-1)+1):(6*(k-1)+ 6)] = delta } list(delta.patient, delta.patient.comb) } __ 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
Re: [R] how to make a series with decimal increment
On Tue, 2006-06-13 at 05:24 +, anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 i tryed this statement s-0:0.1:1 but this giving an error megssage. but by default increment 1 it is taking ,so what to do ,, i want to use this varible in for loop.. like for(j in s) thanks in advance with regards anil kumar Hi Anil, see ?seq for the solution, which is: s - seq(0, 1, by = 0.1) for(i in s) { print(i) } if you need the sequence for something else, if not: for(i in seq(0, 1, by = 0.1)) { print(i) } Note the braces { } are superfluous here but you'll need them if you are doing anything more complicated in your loop. HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% * Note new Address, Telephone Fax numbers from 6th April 2006 * %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson ECRC ENSIS [t] +44 (0)20 7679 0522 UCL Department of Geography [f] +44 (0)20 7679 0565 Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. [w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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
[R] FireFox Upgrade Breaks R(?)
Just upgraded Firefox to the current (1.5.0.4) release on a RedHat 7.3 system. R now whines that /usr/lib/i386/libjavaplugin_nscp.so doesn't exist. Well, no, the referenced i386 subdir (and plugin) exists in the JRE directory tree, not at the top level of /usr/lib. And, if I restore the previous Firefox, R is all better. Never touched R itself during the process. Thanks. -- Tim Evans, TKEvans.com, Inc.|5 Chestnut Court [EMAIL PROTECTED] |Owings Mills, MD 21117 http://www.tkevans.com/ |443-394-3864 http://www.come-here.com/News/ | __ 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
Re: [R] appending
Hi David, It would be helpful if you supply a little data, upon which this would operate. Hank On Jun 14, 2006, at 12:31 PM, Afshartous, David wrote: All, In the function below I have 24 individuals and 6 calculations per individual. The 6 calculations are collected each time in a 1:24 loop when calculating delta. I'd like to collect all 144 = 24*6 calculations in one vector (delta.patient.comb). The function works as is via indexing, but is there an easier way to collect the measurements via appendinng the 6 measurements each time to the current set? I couldn't find anything in Intro to R on appending. cheers, Dave ps - please respond directly to [EMAIL PROTECTED] creatine.function.new = function(delta.0.Y.0, gamma, comp.LIS.frm, comp.CAND.frm) { ## function to calcuate the delta.i, i.e. the percent ## leftover ## gamma = rate of Cr going into bucket, e.g., mg/hr ## delta.0.Y.0 = product of delta.0 and Y.0 at baseline ## Y.1 = delta.0.Y.0 + gamma delta = numeric(6) delta.patient = numeric(24) delta.patient.comb = numeric(144) ## for (k in 1:24) { ## each patient patient.k.CAND = which(comp.CAND.frm$Patient_no == k) Ucr.CAND.patient.k = comp.CAND.frm$Ucr[patient.k.CAND] C = Ucr.CAND.patient.k ## 6 observed creatanine values for each patient delta[1] = (Y.1 - C[1])/Y.1 Y.i = Y.1 delta.i = delta[1] for (i in 1:5) {## six measurments per patient Y.i.plus.1 = delta.i * Y.i + gamma delta.i.plus.1 = (Y.i.plus.1 - C[i+1])/Y.i.plus.1 delta[i+1] = delta.i.plus.1 delta.i = delta[i+1] Y.i = Y.i.plus.1 } delta.patient[k] = list(delta) delta.patient.comb[(6*(k-1)+1):(6*(k-1)+ 6)] = delta } list(delta.patient, delta.patient.comb) } __ 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 Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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
[R] graph
Bonjour, Je veux savoir comment je peux avoir avec R deux graphiques en un seul graphique? Exemple Hi, I want to know how I can have with R two graphs in only one graph? Example x-seq(0,4,0.1) plot(x,dnorm(x),type=l) plot(x,dgamma(x,2,0.5),typ=p) 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
Re: [R] graph
On Wed, Jun 14, 2006 at 07:23:53PM +0200, Ahmed Elhabti wrote: [...] Hi, I want to know how I can have with R two graphs in only one graph? Example x-seq(0,4,0.1) plot(x,dnorm(x),type=l) plot(x,dgamma(x,2,0.5),typ=p) in the last line, use 'points' instead of 'plot': x-seq(0,4,0.1) plot(x,dnorm(x),type=l) points(x,dgamma(x,2,0.5),type=p) Gabor Thanks [...] -- 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
[R] A question about stepwise procedures: step function
Dear all, I tried to use step function to do model selection, but I got an error massage. What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it? *** all-data.frame(z1,z2,z3) fit.model.all- coxph(Surv(t,cen) ~z1+z2+z3,data=all) reg.model.all-step(fit.model.all) Start: AIC= 689.1 Surv(t, cen) ~ z1 + z2 + z3 Error in as.data.frame.default(data) : cannot coerce class function into a data.frame *** Thanks a lot! Jia __ 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
Re: [R] appending
Hank, Attached is the dataframe that can be supplied for the argument comp.CAND.frm. The argument for comp.LIS.frm can be deleted since it currently isn't used. The other arguments can be set as: delta.0.Y.0 = 50 gamma = 40. cheers, dave -Original Message- From: Martin Henry H. Stevens [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 14, 2006 1:23 PM To: Afshartous, David Cc: r-help@stat.math.ethz.ch Subject: Re: [R] appending Hi David, It would be helpful if you supply a little data, upon which this would operate. Hank On Jun 14, 2006, at 12:31 PM, Afshartous, David wrote: All, In the function below I have 24 individuals and 6 calculations per individual. The 6 calculations are collected each time in a 1:24 loop when calculating delta. I'd like to collect all 144 = 24*6 calculations in one vector (delta.patient.comb). The function works as is via indexing, but is there an easier way to collect the measurements via appendinng the 6 measurements each time to the current set? I couldn't find anything in Intro to R on appending. cheers, Dave ps - please respond directly to [EMAIL PROTECTED] creatine.function.new = function(delta.0.Y.0, gamma, comp.LIS.frm, comp.CAND.frm) { ## function to calcuate the delta.i, i.e. the percent ## leftover ## gamma = rate of Cr going into bucket, e.g., mg/hr ## delta.0.Y.0 = product of delta.0 and Y.0 at baseline ## Y.1 = delta.0.Y.0 + gamma delta = numeric(6) delta.patient = numeric(24) delta.patient.comb = numeric(144) ## for (k in 1:24) { ## each patient patient.k.CAND = which(comp.CAND.frm$Patient_no == k) Ucr.CAND.patient.k = comp.CAND.frm$Ucr[patient.k.CAND] C = Ucr.CAND.patient.k ## 6 observed creatanine values for each patient delta[1] = (Y.1 - C[1])/Y.1 Y.i = Y.1 delta.i = delta[1] for (i in 1:5) {## six measurments per patient Y.i.plus.1 = delta.i * Y.i + gamma delta.i.plus.1 = (Y.i.plus.1 - C[i+1])/Y.i.plus.1 delta[i+1] = delta.i.plus.1 delta.i = delta[i+1] Y.i = Y.i.plus.1 } delta.patient[k] = list(delta) delta.patient.comb[(6*(k-1)+1):(6*(k-1)+ 6)] = delta } list(delta.patient, delta.patient.comb) } __ 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 Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ 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
Re: [R] data managment
This 'applies' a function to each row to reverse columns if necessary: x V1V2 V3V4 1 G 0.892 A 0.108 2 G 0.883 T 0.117 3 T 0.500 C 0.500 4 A 0.617 G 0.383 5 G 0.925 A 0.075 6 A 0.967 G 0.033 7 C 0.883 T 0.117 8 C 0.633 T 0.367 9 G 0.950 A 0.050 10 C 0.742 G 0.258 11 G 0.875 T 0.125 12 T 0.167 C 0.833 13 C 0.792 A 0.208 str(x) `data.frame': 13 obs. of 4 variables: $ V1: chr G G T A ... $ V2: num 0.892 0.883 0.5 0.617 0.925 0.967 0.883 0.633 0.95 0.742 ... $ V3: chr A T C G ... $ V4: num 0.108 0.117 0.5 0.383 0.075 0.033 0.117 0.367 0.05 0.258 ... t(apply(x, 1, function(z){ + if (z[1] z[3]) return(z) + else return(z[c(3,4,1,2)]) + })) [,1] [,2][,3] [,4] 1 A 0.108 G 0.892 2 G 0.883 T 0.117 3 C 0.500 T 0.500 4 A 0.617 G 0.383 5 A 0.075 G 0.925 6 A 0.967 G 0.033 7 C 0.883 T 0.117 8 C 0.633 T 0.367 9 A 0.050 G 0.950 10 C 0.742 G 0.258 11 G 0.875 T 0.125 12 C 0.833 T 0.167 13 A 0.208 C 0.792 On 6/14/06, yohannes alazar [EMAIL PROTECTED] wrote: First I would really like to thank the mailing list for help I got in the past, as a new to R I am really needing some support on hoe to code the following problem. I am trying to sort some data I have in a big file. The file has 4 columns and 19000 rows. An example of it looks like this:- G 0.892 A 0.108 G 0.883 T 0.117 T 0.5 C 0.5 A 0.617 G 0.383 G 0.925 A 0.075 A 0.967 G 0.033 C 0.883 T 0.117 C 0.633 T 0.367 G 0.95 A 0.05 C 0.742 G 0.258 G 0.875 T 0.125 T 0.167 C 0.833 C 0.792 A 0.208 Columns one and three are alphabets while three and four are their corresponding values. I wanted to sort this data so that my first and third columns are in alphabetic order. For example in the first row the order is G then A. This is not in alphabetic order therefore we swap them along with their values and it becomes: A0.108 G 0.892 Row two looks fine but row three needs the same rearrangement as row one. And the final out put looks like: A 0.108 G 0.892 G 0.883 T 0.117 C 0.5 T 0.5 A 0.617 G 0.383 A 0.075 G 0.925 A 0.967 G 0.033 C 0.883 T 0.117 C 0.633 T 0.367 A 0.05 G 0.95 C 0.742 G 0.258 G 0.875 T 0.125 C 0.833 T 0.167 A 0.208 C 0.792 Please some help with the relevant command names or a technique to code this task. Thank you in advance Regards Hannes [[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 -- Jim Holtman Cincinnati, OH +1 513 646 9390 (Cell) +1 513 247 0281 (Home) What is the problem you are trying to solve? [[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
Re: [R] how to make a series with decimal increment
Gavin Simpson wrote on 6/14/2006 12:44 PM: On Tue, 2006-06-13 at 05:24 +, anil kumar rohilla wrote: Hi List, I am new to this Rsoftware, i want to make a sereis for example which is having values like this, s- 0,0.1,0.2,0.3,0.4,1 [...] Hi Anil, see ?seq for the solution, which is: s - seq(0, 1, by = 0.1) for(i in s) { print(i) } I don't know if R avoids this somehow, but in many languages, generated noninteger sequences are sometimes one item shorter than expected, because of rounding errors. For that reason, I would prefer to generate an integer sequence and then form a noninteger one from it. For example: s - (1:10) / 10 Another option in R would be using the argument length.out, as in s = seq(from = 0.1, to = 1, length.out = 10) ...Mike -- Michael H. Prager, Ph.D. Population Dynamics Team NOAA Center for Coastal Habitat and Fisheries Research NMFS Southeast Fisheries Science Center Beaufort, North Carolina 28516 USA http://shrimp.ccfhrb.noaa.gov/~mprager/ __ 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
Re: [R] bubbleplot for matrix
Here's an example. By the way, I find that it's more convenient (where applicable) to keep the data in 3 vectors/factors rather than one matrix/data frame. a - matrix(sample(1:5,100,replace=TRUE),nrow=10,dimnames=list(1:10,5*1:10)) x - y - z - vector() for (i in 1:nrow(a)) { x - c(x,rep(rownames(a)[i],ncol(a))) y - c(y,colnames(a)) z - c(z,a[i,]) } symbols(as.numeric(x),as.numeric(y),z,inches=0.2,bg=khaki) text(as.numeric(x),as.numeric(y),labels=z) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Albert Vilella Sent: Tuesday, June 13, 2006 7:11 AM To: r-help@stat.math.ethz.ch Subject: [R] bubbleplot for matrix Hi all, I would like to ask if it is possible to use bubbleplot for a 20x20 matrix, instead of a dataframe with factors in columns. The idea would be to get a tabular representation with bubbles like in Rnews_2006_2 article, which look very nice. Thanks in advance, Albert. __ 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 __ 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
[R] Saving R graphics with version 2.3.1
HI ! I´ve installed the latest R version (2.3.1) and I´ve had problems to save my graphics as JPEG, PNG and the others available formats. R saves the file with no extension. Then, I have to open this file using an image visualizer and save it as PNG, for instance. Previous R versions work without problems. Has everyone had a similar problem? Is it a bug of R 2.3.1? Thanks in advance. Ilka Afonso Reis __ 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
Re: [R] Multiple lag.plots per page
Prof Brian Ripley wrote: On Wed, 14 Jun 2006, Gad Abraham wrote: Prof Brian Ripley wrote: On Tue, 13 Jun 2006, Gad Abraham wrote: Prof Brian Ripley wrote: On Tue, 13 Jun 2006, Gad Abraham wrote: Hi, I'm trying to plot several lag.plots on a page, however the second plot replaces the first one (although it only takes up the upper half as it should): par(mfrow=c(2,1)) a-sin(1:100) b-cos(1:100) lag.plot(a) lag.plot(b) What's the trick to this? lag.plot itself calls par(mfrow). The trick is to get one call to do the plots you want: lag.plot(cbind(a,b)) Thanks, that works great for multiple lag.plots. Is it possible to have a lag.plot and another type of plot on the same page? The second plot() always replaces the lag.plot for me. Yes, if the other plot is second, e.g par(mfrow=c(2,1)) a-sin(1:100) lag.plot(a) par(mfg=c(2,1)) # move to second plot plot(1:10) Following from my previous questions, lag.plot doesn't recognise some of the standard plot variables, e.g. xaxt=n doesn't remove the x-axis, and setting xlab causes an error: lag.plot(sin(1:100), xlab=foo) Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, : formal argument xlab matched by multiple actual arguments Is this a bug or a feature? feature. Note that the help page says ...: Further arguments to 'plot.ts'. and not `graphical parameters'. Also, how can I make lag.plot behave nicely when plotted with other plots on the same page? it takes up more room than it's allocated by par(mfrow). Really you are not using it for its intended purpose, multiple plots at different lags. (Notice the plurals in the title and the description on the help page.) Why not use plot.ts directly? If you want to pursue lag.plot, try the version in R-devel which works better for single-plot displays. OK, I've experimented with plot.ts and it does what I need it to. Thanks for your help, Gad -- Gad Abraham Department of Mathematics and Statistics University of Melbourne Victoria 3010, Australia email: [EMAIL PROTECTED] web: http://www.ms.unimelb.edu.au/~gabraham __ 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
[R] How to change the margin widths in png-plots?
Hello, I have tried to change the margin widths so that mtext (here sd of consecutive pc intervals, look at the picture) and plot(...,xlab=bar) fits to the picture. Here is an example: http://users.utu.fi/attenka/margins.png This doesn't help: par(mar=c(5.1, 7.1, 4.1, 2.1)) And here are the commands: png(filename=/Users/kone/Vaitostutkimus/Pictures/ BachBWV60_sd_cons_pc_int.png, width = 2800, height = 1200,pointsize = 12, bg = white); plot(Compo_SD_succ_int_array_vector,ylim=c(0.40,1.9),col=white,xlab=b ar,ylab=, cex.lab=3, cex.axis=2); mtext(sd of consecutive pc intervals, side=2, line=0, padj=-1.8,at=1.2, cex=3) lines(Compo_SD_succ_int_array_vector,col=1,lty=1,lwd=2); text(2,0.93,labels=*,cex=3) # an asterisk... dev.off(); What do I do next? Atte Tenkanen, Turku Finland [[alternative text/enriched 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
[R] How to change the margin widths in png-plots?
Hello, I have tried to change the margin widths so that mtext (here sd of consecutive pc intervals, look at the picture) and plot(...,xlab=bar) fits to the picture. Here is an example: http://users.utu.fi/attenka/margins.png This doesn't help: par(mar=c(5.1, 7.1, 4.1, 2.1)) And here are the commands: png(filename=/Users/kone/Vaitostutkimus/Pictures/ BachBWV60_sd_cons_pc_int.png, width = 2800, height = 1200,pointsize = 12, bg = white); plot(Compo_SD_succ_int_array_vector,ylim=c(0.40,1.9),col=white,xlab=b ar,ylab=, cex.lab=3, cex.axis=2); mtext(sd of consecutive pc intervals, side=2, line=0, padj=-1.8,at=1.2, cex=3) lines(Compo_SD_succ_int_array_vector,col=1,lty=1,lwd=2); text(2,0.93,labels=*,cex=3) # an asterisk... dev.off(); What do I do next? Atte Tenkanen, Turku Finland __ 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
Re: [R] Garch Warning
Your example is not reproducible. Have you tried walking through the code line by line after debug(garch)? After you've tried that, if you'd still like help from this listserve, please submit a simple, self-contained / reproducible example, as suggested the posting guide! www.R-project.org/posting-guide.html. hope this helps. spencer graves Arun Kumar Saha wrote: Dear all R-users, I wanted to fit a Garch(1,1) model to a dataset by: garch1 = garch(na.omit(dat)) But I got a warning message while executing, which is: Warning message: NaNs produced in: sqrt(pred$e) The garch parameters that I got are: garch1 Call: garch(x = na.omit(dat)) Coefficient(s): a0 a1 b1 1.212e-04 1.001e+00 1.111e-14 Can any one please tell me that why got this message? What is the remedy? Thanks and Regards [[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 __ 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
Re: [R] Garch Warning
Dear Spencer, Can you be more clear on your suggestion? On 6/15/06, Spencer Graves [EMAIL PROTECTED] wrote: Your example is not reproducible. Have you tried walking through the code line by line after debug(garch)? After you've tried that, if you'd still like help from this listserve, please submit a simple, self-contained / reproducible example, as suggested the posting guide! www.R-project.org/posting-guide.html. hope this helps. spencer graves Arun Kumar Saha wrote: Dear all R-users, I wanted to fit a Garch(1,1) model to a dataset by: garch1 = garch(na.omit(dat)) But I got a warning message while executing, which is: Warning message: NaNs produced in: sqrt(pred$e) The garch parameters that I got are: garch1 Call: garch(x = na.omit(dat)) Coefficient(s): a0 a1 b1 1.212e-04 1.001e+00 1.111e-14 Can any one please tell me that why got this message? What is the remedy? Thanks and Regards [[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 [[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
[R] MDS with missing data?
Hello I will be applying MDS (actually Isomap) to make a psychological concept map of the similarities between N concepts. I would like to scale to a large number of concepts, however, the resulting N*(N-1) pairwise similarities is prohibitive for a user survey. I'm thinking of giving people random subsets of the pairwise similarities. Does anyone have recommendations for this situation? My current thoughts are to either 1) use nonmetric/gradient descent MDS which seems to allow missing data, or 2) devise some scheme whereby the data that are ranked in common by several people is used to derive a scaling factor for each person's ratings. Thanks for any advice, __ 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
Re: [R] MDS with missing data?
Dear Context Grey, On 15 Jun 2006, at 6:42, context grey wrote: I will be applying MDS (actually Isomap) to make a psychological concept map of the similarities between N concepts. So actually, how do you do isomap? RSiteSearch gave me one hit of isomap. I only ask, because I've implemented a working version of isomap (not ready for prime time yet, but a proof that it works). If isomap already is available in R, I won't do anything more with the function. I don't understand the rest of the question, but isomap really may be able to work with NA dissimilarities: just replace them with shortest path distances via non-missing dissimilarities. In fact, you don't need but some ('k') non-missing dissimilarities per item, since that is how isomap works. Your dissimilarity structure may become disconnected, of course, but that's common in isomap. If you mean that your raw data has NA, then you may select a dissimilarity function that can handle NA input and produce finite dissimilarities (I think daisy in the cluster package does this). Somehow I feel I answered to quite a different question than you asked. Sorry. I would like to scale to a large number of concepts, however, the resulting N*(N-1) pairwise similarities is prohibitive for a user survey. I'm thinking of giving people random subsets of the pairwise similarities. Does anyone have recommendations for this situation? My current thoughts are to either 1) use nonmetric/gradient descent MDS which seems to allow missing data, or Not the isoMDS function in MASS. if N(N-1) is a problem, then nonmetric MDS may not be the solution. 2) devise some scheme whereby the data that are ranked in common by several people is used to derive a scaling factor for each person's ratings. Thanks for any advice, _ Cheers, Green Power -- Green Power, Oulu, Finland __ 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
Re: [R] Saving R graphics with version 2.3.1
Hi, Have a jpeg() your plot function dev.off() That will direct your graphs to a file called Rplots.jpg. Look for function jpeg and png. On 6/14/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: HI ! I´ve installed the latest R version (2.3.1) and I´ve had problems to save my graphics as JPEG, PNG and the others available formats. R saves the file with no extension. Then, I have to open this file using an image visualizer and save it as PNG, for instance. Previous R versions work without problems. Has everyone had a similar problem? Is it a bug of R 2.3.1? Thanks in advance. Ilka Afonso Reis __ 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 -- Ritwik Sinha Graduate Student Epidemiology and Biostatistics Case Western Reserve University http://darwin.cwru.edu/~rsinha [[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
Re: [R] merge dataframes with conditions formulated as logical expressions
--- Reply to: --- Date:14.06.06 16:17 (+) From:Adaikalavan Ramasamy [EMAIL PROTECTED] Subject: Re: [R] merge dataframes with conditions formulated as logical expressions You have discontinuity between your MIN.VAL and MAX.VAL for a given group. If this is true in practise, then you may want to check and report when VAL is in the discontinuous region. Your solution without concerning discontinuity is better because it is more general. Here is my solution that ignores that (and only uses MIN.VAL and completely disrespecting MAX.VAL). Not very elegant but should do the trick. df - data.frame( GRP=c( A, A, B ), VAL=c( 10, 100, 200 ) ) dp - data.frame( GRP=c( A, A, B, B ), MIN.VAL=c( 1, 50, 1, 70 ), MAX.VAL=c( 49, 999, 59, 999 ), VAL2=c( 1.1, 2.2, 3.3, 4.4 ) ) x - split(df, df$GRP) y - split(dp, dp$GRP) out - NULL for(g in names(x)){ xx - x[[g]] yy - y[[g]] w - cut(xx$VAL, breaks=c(yy$MIN.VAL, Inf), labels=F) tmp - cbind(xx, yy[w, VAL2]) colnames(tmp) - c(GRP, VAL, VAL2) out - rbind(out, tmp) } out Regards, Adai Thanks for this solution. I did not yet try to program a conventional solution because I thought there would be a nice shortcut in R to solve the problem comparably elegantly as in SQL: select df.*, dp.VAL2 from df, dp where df.GRP = dp.GRP and df.VAL dp.MIN_VAL and df.VAL = dp.MAX_VAL Wolfram On Wed, 2006-06-14 at 16:55 +0200, Wolfram Fischer wrote: I have a data.frame df containing two variables: GRP: Factor VAL: num I have a data.frame dp containing: GRP: Factor MIN.VAL: num MAX.VAL: num VAL2: num with several rows per GRP where dp[i-1, MAX.VAL] dp[i, MIN.VAL] within the same GRP. I want to create df[i, VAL2] - dpp[z, VAL2] withi along df and dpp - subset( dp, GRP = df[i, GRP] ) so that it is true for each i: df[i, VAL] dpp[z, MIN.VAL] and df[i, VAL] = dpp[z, MAX.VAL] Is there an easy/efficient way to do that? Example: df - data.frame( GRP=c( A, A, B ), VAL=c( 10, 100, 200 ) ) dp - data.frame( GRP=c( A, A, B, B ), MIN.VAL=c( 1, 50, 1, 70 ), MAX.VAL=c( 49, 999, 59, 999 ), VAL2=c( 1.1, 2.2, 3.3, 4.4 ) ) The result should be: df$VAL2 - c( 1.1, 2.2, 4.4 ) Thanks - Wolfram __ __ 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