Re: [R] weird vector size cannot be NA/NaN problem
Hi, I have to follow up my own question since this problem is getting quite disturbing and I fear that it also causes other functions to malfunction without notice. It occurs quite quite often when I manipulate the mentioned data set. It definitely is caused by the column entries which are Inf (caused by a value/0 operation) but I cannot reproduce the error. When I do a describe(c(5,3,76,4/0)), for example, the last value is Inf but the error is not thrown. But I can save the vector and load it and the error still occurs. Would someone be willing to look at that vector and maybe finds out the root of the problem? (I'll send the vector by email) As I said in the earlier email, the data is imported with read.dta of the foreign library and the only manipulation I do is dividing the values of two columns by each other. Thanks a million, Werner I have a weird problem with my data but I cannot really locate it and cannot make a small example data set do reproduce the problem. I basically divide one numerical column of a data frame with another. When I run describe() on that column, I get Error in vector(integer, length) : vector size cannot be NA/NaN The two original columns comprise many zero values and I think the particular row which causes the problem ends up with an Inf. I fear that other functions might also not be reliable for this data and that I have to repair it somehow. It actually happens with many of the variables from the various tables which originally are in Stata .dta format and which I import with the foreign library. I am working on windows XP and R 2.9.1 I assume that this description is too vague but if anybody has an idea, I would appreciate it. Thanks so much, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] weird vector size cannot be NA/NaN problem
Hi, I have a weird problem with my data but I cannot really locate it and cannot make a small example data set do reproduce the problem. I basically divide one numerical column of a data frame with another. When I run describe() on that column, I get Error in vector(integer, length) : vector size cannot be NA/NaN The two original columns comprise many zero values and I think the particular row which causes the problem ends up with an Inf. I fear that other functions might also not be reliable for this data and that I have to repair it somehow. It actually happens with many of the variables from the various tables which originally are in Stata .dta format and which I import with the foreign library. I am working on windows XP and R 2.9.1 I assume that this description is too vague but if anybody has an idea, I would appreciate it. Thanks so much, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Changing font to times for EMF graphics
Hi, sorry for the simple question. I am usually able to change the font for PDF graphics with pdf.options(family=Times) However, I have found no way yet to get an emf file with a times font. I also tried a detour by using pstoedit to convert a pdf with the desired font to an emf but even there the font does not appear as times. Is there a way to get a times font in an emf file or is it even a restriction of the file format? I am on Win XP and R 2.9.1. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] solving system of equations involving non-linearities
Hi, I would appreciate if someone could help me on track with this problem. I want to compute some parameters from a system of equations given a number of sample observations. The system looks like this: sum_i( A+b_i0 A+b_iC+d_i) = x sum_i( C+d_i0 C+d_iA+b_i) = y sum_i( exp(E+f_i) * ( A+b_i0 A+b_iC+d_i) = z A, C, E are free variables while the other letters represent values given from sample observations. The equations involve counts of the number of fulfilled conditions and therefore non-linearities. Furthermore, since I have many observations i, the equations will unlikely hold exactly and solving will require some closeness measure like the sum of the squared deviations or so. Is there any function in R suitable for solving this problem? Thanks so much for your help, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Insignificant variable improves AIC (multinom)?
Hi, I am trying to specify a multinomial logit model using the multinom function from the nnet package. Now I add another independent variable and it halves the AIC as given by summary(multinom()). But when I call Anova(multinom()) from the car package, it tells me that this added variable is insignificant (Pr(Chisq)=0.39). Thus, the improved AIC suggests to keep the variable but the Anova suggests to drop it. I am sure this is due to my lack of understanding of these models but could someone help me out with a pointer what my mistake is? I am not sure why you would expect the same answer from AIC and p-value. They are different questions. AIC attempts to answer a question about overall model fit. p-value for a particular variable attempts to answer whether that particular coefficient could be due to chance if the population value of the parameter was 0. One way these could give different answers is if the new variable affected the parameter estimates for the other parameters. It's yet another exemplar of the problems with using p-values for model selection HTH Peter Peter L. Flom, PhD Statistical Consultant www DOT peterflomconsulting DOT com Many thanks for the answers, Peter and Krzysztof! That was very enlightening. I have to read up on model selection. The thought I have to get my head around is that the added variable helps explaining the observed variability in the data and thus should be retained in the model. But since the coefficient is insignificant, I cannot interpret it and if I use this equation for predictions then I add a random value since I cannot reject that the coefficient is actually zero instead of what I estimated. One just never sees someone presenting regression coefficients which are not significant although model selection procedures are often based on the AIC... Have a good weekend, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Insignificant variable improves AIC (multinom)?
Hi, I am trying to specify a multinomial logit model using the multinom function from the nnet package. Now I add another independent variable and it halves the AIC as given by summary(multinom()). But when I call Anova(multinom()) from the car package, it tells me that this added variable is insignificant (Pr(Chisq)=0.39). Thus, the improved AIC suggests to keep the variable but the Anova suggests to drop it. I am sure this is due to my lack of understanding of these models but could someone help me out with a pointer what my mistake is? Thanks so much, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] portable R editor
Hi, I have been dreaming about a complete R environment on my USB stick for a long time. Now I finally want to realize it but what I am missing is a good, portable editor for R which has tabs and syntax highlighting, can execute code, has bookmarks and a little project file management facility pretty much like Tinn-R has those. I like Tinn-R but it seems like there is only a very old version of Tinn-R which works standalone. Can anyone recommend an adequate editor? Many thanks and all the best, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Set of standard city size symbols as known from atlases?
Hi, I am wondering exists a standard set of symbols to mark cities of different size classes on a map for R yet? In a standard atlas there are symbols like small filled circles, small filled circles with an outer circle, same with small squares, etc. which mark capitals and different size classes of cities. I know I can get different symbols with the pch option in plot but the question aims at if such more standard symbols of atlases are available. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R system on USB: how to enter relative R environment path in Eclipse/StatET?
Hi, I am trying to set up a portable R environment and wanted to use Eclipse and StatET as the editor. But when setting the R environment in StatET I cannot figure out how to enter a relative path. Has anybody succeeded in doing this? (eclipse and R are both in the common directory \programs on the usb key) Many thanks for any hints, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Methods for showing statistics over space
Hi, I have a question which is a little off-topic but then again, it should stay in the boundaries of what can be done with available R functions. Has anyone pointers to tutorials or the like where one can get inspiration on how to visualize some spatial statistics? I want to analyze different statistics of 60 counties in a country. I have a shape file for those counties thus I can produce a map. But what are good ways to make statistics, e.g. price levels, clear and so that the viewer also can make good relative comparisons of counties lying far apart? It should enable a clear, quick assessment of the spatial dispersion of the measure. One further restriction is, that the outcome has to be black-and-white printable. The options I have found considered so far are: - different gray scale colorings of the countries: very crude and gray scale might be also difficult in printing - small bar plots within each county: difficult to compare for counties far apart or one has to consider an exact scale - bubbles with differing sizes: not very intuitive If anybody has a pointer from the top of his head, that would be wonderful! Thanks a million and have a good weekend, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] retrieving matrix elements by giving pairs of row AND column numbers?
Hi, this is probably a very trivial question but I can't figure out the right terms to find the solution in the list archive. I have a matrix or a data.frame or the like: m - matrix(ncol=3,seq(1,9)) m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 and now I wonder if one can provide somehow two vectors, one containing row numbers, the other column numbers and thereby retrieve the corresponding elements? E.g., providing the 2 vectors c(1,2,3) and c(1,3,1) should return the matrix values c(1,8,3). I ran a couple of times into this problem and always used some awkward transformations to get around it. But as I know R, there is probably some slick way to do this. Thanks!!! Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] retrieving matrix elements by giving pairs of row AND column numbers?
I thought I've tried this already and that it doesn't work -- madness. Anyway, Jeff kindly sent me the solution: m[cbind(c(1,2,3),c(1,3,1))] does the trick. Thanks, Werner Hi, this is probably a very trivial question but I can't figure out the right terms to find the solution in the list archive. I have a matrix or a data.frame or the like: m - matrix(ncol=3,seq(1,9)) m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 and now I wonder if one can provide somehow two vectors, one containing row numbers, the other column numbers and thereby retrieve the corresponding elements? E.g., providing the 2 vectors c(1,2,3) and c(1,3,1) should return the matrix values c(1,8,3). I ran a couple of times into this problem and always used some awkward transformations to get around it. But as I know R, there is probably some slick way to do this. Thanks!!! Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] retrieving matrix elements by giving pairs of row AND column numbers?
Many thanks, Greg! Now I know why I thought that this does not work: I probably tried it with the string names of the columns and rows instead of their numbers. The former does not work (I think). Thanks to all again! Werner - Ursprüngliche Mail Von: Greg Snow [EMAIL PROTECTED] An: Werner Wernersen [EMAIL PROTECTED]; [EMAIL PROTECTED] [EMAIL PROTECTED] Gesendet: Mittwoch, den 22. Oktober 2008, 19:37:28 Uhr Betreff: RE: [R] retrieving matrix elements by giving pairs of row AND column numbers? Subscript using a 2 column matrix with the rows in the first column and the cols in the 2nd column, e.g.: x - matrix(1:9, 3) x[ cbind( c(1,2,3), c(3,2,1) ) ] [1] 7 5 3 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] project.org] On Behalf Of Werner Wernersen Sent: Wednesday, October 22, 2008 12:24 PM To: [EMAIL PROTECTED] Subject: [R] retrieving matrix elements by giving pairs of row AND column numbers? Hi, this is probably a very trivial question but I can't figure out the right terms to find the solution in the list archive. I have a matrix or a data.frame or the like: m - matrix(ncol=3,seq(1,9)) m [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 and now I wonder if one can provide somehow two vectors, one containing row numbers, the other column numbers and thereby retrieve the corresponding elements? E.g., providing the 2 vectors c(1,2,3) and c(1,3,1) should return the matrix values c(1,8,3). I ran a couple of times into this problem and always used some awkward transformations to get around it. But as I know R, there is probably some slick way to do this. Thanks!!! Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] factors in dynlm?
Hello, how can one use factors in dynlm? I would like to add month dummies to the equation. Or is creating 12 vectors the way to do it? Thanks a lot, Werner einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] dynlm and lm: should they give same estimates?
Hi, I was wondering why the results from lm and dynlm are not the same for what I think is the same model. I have just modified example 4.2 from the Pfaff book, please see below for the code and results. Can anyone tell my what I am doing wrongly? Many thanks, Werner set.seed(123456) e1 - rnorm(100) e2 - rnorm(100) y1 - ts(cumsum(e1)) y2 - ts(0.6*y1 + e2) lr.reg - lm(y2 ~ y1) error - ts(residuals(lr.reg)) error.lagged - error[-c(99, 100)] dy1 - diff(y1) dy2 - diff(y2) diff.dat - data.frame(embed(cbind(dy1, dy2), 2)) colnames(diff.dat) - c('dy1', 'dy2', 'dy1.1', 'dy2.1') ecm.reg - lm(dy2 ~ error.lagged + dy1.1 + dy2.1, data=diff.dat) ecm.dynreg - dynlm(d(y2) ~ L(error) + L(d(y1),1) + L(d(y2),1)) summary(ecm.reg) summary(ecm.dynreg) summary(ecm.reg) Call: lm(formula = dy2 ~ error.lagged + dy1.1 + dy2.1, data = diff.dat) Residuals: Min 1Q Median 3Q Max -2.9588 -0.5439 0.1370 0.7114 2.3065 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.003398 0.103611 0.0330.974 error.lagged -0.968796 0.158554 -6.110 2.24e-08 *** dy1.1 0.808633 0.112042 7.217 1.35e-10 *** dy2.1-1.058913 0.108375 -9.771 5.64e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.026 on 94 degrees of freedom Multiple R-Squared: 0.5464, Adjusted R-squared: 0.5319 F-statistic: 37.74 on 3 and 94 DF, p-value: 4.243e-16 summary(ecm.dynreg) Time series regression with ts data: Start = 3, End = 100 Call: dynlm(formula = d(y2) ~ L(error) + L(d(y1), 1) + L(d(y2), 1)) Residuals: Min 1Q Median 3Q Max -2.9588 -0.5439 0.1370 0.7114 2.3065 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.003398 0.103611 0.033 0.9739 L(error)-0.968796 0.158554 -6.110 2.24e-08 *** L(d(y1), 1) 0.245649 0.126996 1.934 0.0561 . L(d(y2), 1) -0.090117 0.105938 -0.851 0.3971 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 1.026 on 94 degrees of freedom Multiple R-Squared: 0.5464, Adjusted R-squared: 0.5319 F-statistic: 37.74 on 3 and 94 DF, p-value: 4.243e-16 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] map + some arbitrary locations' heights: some kind of perspective or contour plot possible?
Hi, I thought about this but programming it seems rather difficult so I was wondering if a function exists for this in R (as most of the times it turns out that it does): I have a map (shapefile) and for about 50 points on that map (GPS locations) I have heights. Is there a function which can make a perspective plot or contour plot or the like from this little data? Or maybe some function I can abuse? Thanks for any suggestions, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] syntax to restrict coefficient in lm()
Hi, I would like to estimate an error correction model with lm() but I don't find the correct syntax for that. The model (leaving out the time indices) looks like: dY = a0 - a1 * (Y - b1*X) + b0*dX + e the problem is the term - a1 * (Y - b1*X). How can I restrict a1 to be the same for both Y and -b1*X ? Thanks for considering my question! All the best, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R2HTML: output from for-loops
Hi, I am trying to prepare a report with R2HTML using HTMLStart(outdir=./html, filename=report, echo=T, HTMLframe=F) then, for instance, I want to get the output of a loop: for (i in 1:20) print(summary(rnorm(1000))) but only the first of summaries really ends up in the html file. What am I doing wrongly? Thanks, Werner __ Do You Yahoo!? Sie sin Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R2HTML, HTMLStart(): are plots send to HTML?
Hi, I just want to make sure that I really misunderstood the documentation: Is HTMLStart redirecting plots as well so that they are included in the HTML report? I tried the below and the plot is not included in the HTML file. Or did I miss some switch or so? Many thanks, Werner HTMLStart(outdir = c:/, filename = report) *** Output redirected to directory: c:/ *** Use HTMLStop() to end redirection.[1] TRUE HTML plot(1:10, 1:10) HTML HTMLStop() [1] c://report_main.html __ Do You Yaho Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] String search: Return closest match
Hi, I have to match names where names can be recorded with errors or additions. Now I am searching for a string search function which returns always the closest match. E.g. searching for Washington it should return only Washington but not Washington, D.C. But it also could be that the list contains only Hamburg but the record I am searching for is Hamburg OTM and then we still want to find Hamburg. Or maybe the list contains Hamburg and Hamberg but we are searching for Hamburg and thus only this should this one should be returned. agrep() returns all close matches but unfortunately does not return the degree of closeness otherwise selection would be easy. Is there such a function already implemented? Thanks a million for your help, Werner __ verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] String search: Return closest match
That works perfectly, great. Thanks a lot for that Richard! Werner - Ursprüngliche Mail Von: [EMAIL PROTECTED] [EMAIL PROTECTED] An: Werner Wernersen [EMAIL PROTECTED] CC: [EMAIL PROTECTED]; [EMAIL PROTECTED] Gesendet: Dienstag, den 26. August 2008, 14:10:11 Uhr Betreff: Re: [R] String search: Return closest match I have to match names where names can be recorded with errors or additions. Now I am searching for a string search function which returns always the closest match. E.g. searching for Washington it should return only Washington but not Washington, D.C. But it also could be that the list contains only Hamburg but the record I am searching for is Hamburg OTM and then we still want to find Hamburg. Or maybe the list contains Hamburg and Hamberg but we are searching for Hamburg and thus only this should this one should be returned. agrep() returns all close matches but unfortunately does not return the degree of closeness otherwise selection would be easy. Is there such a function already implemented? The Levenshtein distance is a common metric for determining how close two string are (in fact, agrep uses this). There's a function to calculate it on the R wiki. http://wiki.r-project.org/rwiki/doku.php?id=tips:data-strings:levenshtein You can use this to find the closest string. (If your set of cities is large, it may be quickest to use agrep to narrow the selection first, since the pure R implementation of levenshtein is likely to be slow.) Regards, Richie. Mathematical Sciences Unit HSL ATTENTION: This message contains privileged and confidential information intended for the addressee(s) only. If this message was sent to you in error, you must not disseminate, copy or take any action in reliance on it and we request that you notify the sender immediately by return email. Opinions expressed in this message and any attachments are not necessarily those held by the Health and Safety Laboratory or any person connected with the organisation, save those by whom the opinions were expressed. Please note that any messages sent or received by the Health and Safety Laboratory email system may be monitored and stored in an information retrieval system. Scanned by MailMarshal - Marshal's comprehensive email content security solution. Download a free evaluation of MailMarshal at www.marshal.com __ gt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] converting coordinates from utm to longitude / latitude
You were absolutely right. If I use south everything is fine. That once again proves the danger of intuition. I simply assumed since almost all of the map is on the northern half that the projection should use north as well. But that is apparently wrong. I couldn't find any description of these definition string parameters which could have been informative. Since I am not a geographer either, I probably used the wrong terms for searching. Anyway, now it works. Thanks so much for the help, Jim! Best regards, Werner - Ursprüngliche Mail Von: Jim Regetz [EMAIL PROTECTED] An: Werner Wernersen [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Gesendet: Mittwoch, den 20. August 2008, 03:08:48 Uhr Betreff: Re: converting coordinates from utm to longitude / latitude Werner Wernersen wrote: It would be nicer to convert directly the entire shapefile object to long/lat coordinates but if that is not possible, I will convert the other points to UTM. Hence, I am playing around with rgdal. library(rgdal) SP - SpatialPoints(cbind(32.29252, -0.3228500), proj4string=CRS(+proj=longlat)) spTransform(SP, CRS(+proj=utm +zone=36)) spTransform(SP, CRS(+proj=utm +zone=36)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 -35687.37 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +ellps=WGS84 This result corresponds with what I get when using convUL() but my map of that area in UTM coordinates does not extend to the negative. An external program converts the point to x=420994 y=9964407 which also seems correct with respect to the map. Fore sure, I am using the function wrongly somehow. Can anyone give me a hint? It looks like you are specifying 36S in your external program, and (implicitly) 36N in R. Using your SP from above, note the following: spTransform(SP, CRS(+proj=utm +zone=36 +north)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 -35687.37 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +ellps=WGS84 spTransform(SP, CRS(+proj=utm +zone=36 +south)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 9964313 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +south +ellps=WGS84 The latter gets in the ballpark of output from your external program. I'd speculate that the remaining differences owe to different assumptions about e.g. the datum (WGS84 for the R statements given above), but I must admit I'm not a geographer. Hope that helps, Jim That's very much appreciated! Thanks, Werner - Ursprüngliche Mail Von: Werner Wernersen [EMAIL PROTECTED] An: [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 20:28:29 Uhr Betreff: converting coordinates from utm to longitude / latitude Hi, is there a function in R to convert data read with read.shape and which is originally in UTM coordinates into longitude / latitude coordinates? I found the convUL() function from the PBSmapping package but I have no idea how I could apply that to the read.shape object. Many thanks, Werner __ fügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ Do ragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ber einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] converting coordinates from utm to longitude / latitude
After having figured out that I had to download the proj.dll file additionally (it would be nice if they actually added a note to their readme) and setting the +south parameter, the conversion of the shapfile from UTM to long/lat with the ogr2ogr utility from gdal worked perfectly. Thanks so much Dylan! Werner - Ursprüngliche Mail Von: Dylan Beaudette [EMAIL PROTECTED] An: r-help@r-project.org CC: Werner Wernersen [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 23:29:34 Uhr Betreff: Re: [R] converting coordinates from utm to longitude / latitude If you would like to convert the entire shapfile check out GDAL: http://www.gdal.org/ http://casoilresource.lawr.ucdavis.edu/drupal/node/98 Cheers, Dylan On Tuesday 19 August 2008, Werner Wernersen wrote: It would be nicer to convert directly the entire shapefile object to long/lat coordinates but if that is not possible, I will convert the other points to UTM. Hence, I am playing around with rgdal. library(rgdal) SP - SpatialPoints(cbind(32.29252, -0.3228500), proj4string=CRS(+proj=longlat)) spTransform(SP, CRS(+proj=utm +zone=36)) spTransform(SP, CRS(+proj=utm +zone=36)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 -35687.37 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +ellps=WGS84 This result corresponds with what I get when using convUL() but my map of that area in UTM coordinates does not extend to the negative. An external program converts the point to x=420994 y=9964407 which also seems correct with respect to the map. Fore sure, I am using the function wrongly somehow. Can anyone give me a hint? That's very much appreciated! Thanks, Werner - Ursprüngliche Mail Von: Werner Wernersen [EMAIL PROTECTED] An: [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 20:28:29 Uhr Betreff: converting coordinates from utm to longitude / latitude Hi, is there a function in R to convert data read with read.shape and which is originally in UTM coordinates into longitude / latitude coordinates? I found the convUL() function from the PBSmapping package but I have no idea how I could apply that to the read.shape object. Many thanks, Werner __ fügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ Do ragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 __ Do You Yahoo!? Sie sind Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] converting coordinates from utm to longitude / latitude
I forgot one more potentially time-saving hint if someone else wants to use org2org for such a conversion: I found that only GDAL for Windows 1.4.4 works together with the proj.dll file which is downloadable from proj.4 but version 1.5 does not. - Ursprüngliche Mail Von: Dylan Beaudette [EMAIL PROTECTED] An: r-help@r-project.org CC: Werner Wernersen [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 23:29:34 Uhr Betreff: Re: [R] converting coordinates from utm to longitude / latitude If you would like to convert the entire shapfile check out GDAL: http://www.gdal.org/ http://casoilresource.lawr.ucdavis.edu/drupal/node/98 Cheers, Dylan On Tuesday 19 August 2008, Werner Wernersen wrote: It would be nicer to convert directly the entire shapefile object to long/lat coordinates but if that is not possible, I will convert the other points to UTM. Hence, I am playing around with rgdal. library(rgdal) SP - SpatialPoints(cbind(32.29252, -0.3228500), proj4string=CRS(+proj=longlat)) spTransform(SP, CRS(+proj=utm +zone=36)) spTransform(SP, CRS(+proj=utm +zone=36)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 -35687.37 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +ellps=WGS84 This result corresponds with what I get when using convUL() but my map of that area in UTM coordinates does not extend to the negative. An external program converts the point to x=420994 y=9964407 which also seems correct with respect to the map. Fore sure, I am using the function wrongly somehow. Can anyone give me a hint? That's very much appreciated! Thanks, Werner - Ursprüngliche Mail Von: Werner Wernersen [EMAIL PROTECTED] An: [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 20:28:29 Uhr Betreff: converting coordinates from utm to longitude / latitude Hi, is there a function in R to convert data read with read.shape and which is originally in UTM coordinates into longitude / latitude coordinates? I found the convUL() function from the PBSmapping package but I have no idea how I could apply that to the read.shape object. Many thanks, Werner __ fügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ Do ragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 __ Do You Yahoo!? Sie sind Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] converting coordinates from utm to longitude / latitude
Hi, is there a function in R to convert data read with read.shape and which is originally in UTM coordinates into longitude / latitude coordinates? I found the convUL() function from the PBSmapping package but I have no idea how I could apply that to the read.shape object. Many thanks, Werner __ Do sragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] converting coordinates from utm to longitude / latitude
It would be nicer to convert directly the entire shapefile object to long/lat coordinates but if that is not possible, I will convert the other points to UTM. Hence, I am playing around with rgdal. library(rgdal) SP - SpatialPoints(cbind(32.29252, -0.3228500), proj4string=CRS(+proj=longlat)) spTransform(SP, CRS(+proj=utm +zone=36)) spTransform(SP, CRS(+proj=utm +zone=36)) SpatialPoints: coords.x1 coords.x2 [1,] 421274.4 -35687.37 Coordinate Reference System (CRS) arguments: +proj=utm +zone=36 +ellps=WGS84 This result corresponds with what I get when using convUL() but my map of that area in UTM coordinates does not extend to the negative. An external program converts the point to x=420994 y=9964407 which also seems correct with respect to the map. Fore sure, I am using the function wrongly somehow. Can anyone give me a hint? That's very much appreciated! Thanks, Werner - Ursprüngliche Mail Von: Werner Wernersen [EMAIL PROTECTED] An: [EMAIL PROTECTED] Gesendet: Dienstag, den 19. August 2008, 20:28:29 Uhr Betreff: converting coordinates from utm to longitude / latitude Hi, is there a function in R to convert data read with read.shape and which is originally in UTM coordinates into longitude / latitude coordinates? I found the convUL() function from the PBSmapping package but I have no idea how I could apply that to the read.shape object. Many thanks, Werner __ fügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com __ Do ragenden Schutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Threshold vector error correction models
Hi, is anyone aware of estimation functions for threshold vector error correction / threshold cointegration models? I didn't find anything for R using RSeek or Google. Thanks a lot for any pointers, Werner __ Do You Yahoo!? hutz gegen Massenmails. http://mail.yahoo.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Object-oriented programming in R for Java programmers?
Hi, I was wondering if anybody might have a reference for me: My R code is growing and getting more and more confusing. Thus, I figure it's time to switch to object-oriented again. I have done oo programming in C++ and Java before but the first few tutorial on R oo were a bit confusing for me. Is there any brief tutorial on oo programming in R especially for people who have done oo in Java or C++ before? That would be really helpful. Many thanks and have a great Sunday, Werner __ Dem pfiffigeren Posteingang. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RExcel - foreground server
Hi, I have a problem using RExcel with a foreground server: in RExcel menu as well as in the window called by set server the foreground server option is grayed out. I have installed the rcom package and also tried to open R and type require(rcom), as explained on http://sunsite.univie.ac.at/rcom/excel/index.html, but it does not help. What am I missing? Many thanks, Werner __ Dem pfiffigeren Posteingang. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Set of well distinguishable line types?
That's a nice set of line types! I'll use these now. I thought because there are so many sophisticated color schemes there might be some line style schemes as well. Thanks for your help Jim and Richard, Werner --- Richard Pearson [EMAIL PROTECTED] schrieb: I've used the following to get a few different line types. However, I'd be interested to hear from someone with expertise in creating line types that are maximally distinguishable by human eyes. ltys = c(22, 44, 13, 1343, 73, 2262, 12223242, F282, F4448444, 224282F2, F1) Best wishes Richard. Jim Lemon wrote: Werner Wernersen wrote: Hi, I am plotting several lines into one plot and would like them to be distinguishable in print later on as well. Thus, my question is: Is there a larger set of such line types available like the sets available for colors? Maybe somebody has already put in the work to define some additional good looking and distinguishable line types. Hi Werner, If you look at lty, there is an option for defining broken line types by strings of up to 8 hexadecimal digits, e.g. abline(h=1,lty=28f8) gives a line like the centerline used in mechanical drawing. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Richard D. Pearson [EMAIL PROTECTED] School of Computer Science, http://www.cs.man.ac.uk/~pearsonr University of Manchester, Tel: +44 161 275 6178 Oxford Road, Mob: +44 7971 221181 Manchester M13 9PL, UK.Fax: +44 161 275 6204 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Set of well distinguishable line types?
Hi, I am plotting several lines into one plot and would like them to be distinguishable in print later on as well. Thus, my question is: Is there a larger set of such line types available like the sets available for colors? Maybe somebody has already put in the work to define some additional good looking and distinguishable line types. Many thanks for your help, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave - print \n ?
Thanks for your comments! I think using just one backslash for \n is correct because otherwise I get a \n literally printed out in the generated .tex code. But what I'm trying to get is just a line break, thus that the .tex code continues on a new line from the point where I put the \n. All the best, Werner --- Abhijit Dasgupta [EMAIL PROTECTED] schrieb: you haven't escaped the \ for the \n, I think. Your line should be cat(\\hline \\n). You did escape the \ for hline, though. Abhijit Dasgupta, Ph.D Assistant Professor | Division of Biostatistics Dept of Pharmacology and Experimental Therapeutics | Thomas Jefferson University 1015 Chestnut St | Suite M100 | Philadelphia PA 19107 Ph: (215) 503-9201 | Fax: (215) 503-3804 adasgupt (at) mail (dot) jci (dot) tju (dot) edu The documents accompanying this transmission may contain confidential health or business information. This information is intended for the use of the individual or entity named above. If you have received this information in error, please notify the sender immediately and arrange for the return or destruction of these documents. Werner Wernersen wrote: Hi, this is probably quite stupid but I have no clue what's wrong. Let's say I write the function hline - function() { cat(\\hline \n) } and call hline() from within a Sweave chunk. Why is there no carriage return after the \hline in the resulting tex file? if I call hline() hline() in the chunk, then I get \hline \hline in the tex code without a linebreak in between. Thanks for any hints, Werner E-Mails jetzt auf Ihrem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Lesen Sie Ihre E-Mails jetzt einfach von unterwegs. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Sweave - print \n ?
Hi, this is probably quite stupid but I have no clue what's wrong. Let's say I write the function hline - function() { cat(\\hline \n) } and call hline() from within a Sweave chunk. Why is there no carriage return after the \hline in the resulting tex file? if I call hline() hline() in the chunk, then I get \hline \hline in the tex code without a linebreak in between. Thanks for any hints, Werner E-Mails jetzt auf Ihrem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Sweave does not parse \Sexpr{}
Hi, has anybody encountered and solved the following problem? I continued work now on a different computer where I have also used Sweave successfully before. I can run Sweave() and it generates a .tex file. All code chunks are processed and translated to Latex perfectly fine but somehow only the \Sexpr{} tags are not parsed. This is an example .Rnw: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} And this is the resulting .tex: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} Can anybody give me a hint what's wrong? Many thanks, Werner Lesen Sie Ihre E-Mails auf dem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave does not parse \Sexpr{}
Sorry about the lack of detail. Some facts: - code chunks are processed fine - Sweave.sty file is in the same directory as the test.Rnw file - all running on Windows 2000 Professional Here is the full session detail: Sweave(test.Rnw, debug=T) Writing to file test.tex Processing code chunks ... You can now run LaTeX on 'test.tex' sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58 svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] tools_2.6.2 Thanks, Werner --- Duncan Murdoch [EMAIL PROTECTED] schrieb: Werner Wernersen wrote: Hi, has anybody encountered and solved the following problem? I continued work now on a different computer where I have also used Sweave successfully before. I can run Sweave() and it generates a .tex file. All code chunks are processed and translated to Latex perfectly fine but somehow only the \Sexpr{} tags are not parsed. This is an example .Rnw: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} And this is the resulting .tex: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} Can anybody give me a hint what's wrong? No. That file works for me, and you've given no details about how you ran Sweave, what version you were using, etc. Duncan Murdoch Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sweave does not parse \Sexpr{}
I am not aware of that I have ever used R2HTML. However, your suggestion worked! Using Sweave(test.Rnw, syntax=SweaveSyntaxNoweb) does the trick and now the \Sexpr{} tags are being parsed again. Many, many thanks Max! All the best, Werner --- Max Kuhn [EMAIL PROTECTED] schrieb: Have you used R2HTML lately? If so, please see the Sweave FAQ http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html#x1-18000A.16 Max On Wed, Mar 19, 2008 at 7:15 AM, Werner Wernersen [EMAIL PROTECTED] wrote: Sorry about the lack of detail. Some facts: - code chunks are processed fine - Sweave.sty file is in the same directory as the test.Rnw file - all running on Windows 2000 Professional Here is the full session detail: Sweave(test.Rnw, debug=T) Writing to file test.tex Processing code chunks ... You can now run LaTeX on 'test.tex' sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=German_Germany.1252;LC_CTYPE=German_Germany.1252;LC_MONETARY=German_Germany.1252;LC_NUMERIC=C;LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58 svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] tools_2.6.2 Thanks, Werner --- Duncan Murdoch [EMAIL PROTECTED] schrieb: Werner Wernersen wrote: Hi, has anybody encountered and solved the following problem? I continued work now on a different computer where I have also used Sweave successfully before. I can run Sweave() and it generates a .tex file. All code chunks are processed and translated to Latex perfectly fine but somehow only the \Sexpr{} tags are not parsed. This is an example .Rnw: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} And this is the resulting .tex: \documentclass{article} \usepackage{Sweave} \begin{document} What is \Sexpr{3*3}? \end{document} Can anybody give me a hint what's wrong? No. That file works for me, and you've given no details about how you ran Sweave, what version you were using, etc. Duncan Murdoch Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Max E-Mails jetzt auf Ihrem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] glm.fit: fitted probabilities numerically 0 or 1 occurred
Hi, could anyone explain to me what this warning message exactly means and what the consequences are? Is it due to the fact that there are very extreme observations / outliers included or what is the reason for it? Thanks so much, Werner Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rrp.impute: for what sizes does it work?
Hi, I have a survey dataset of about 2 observations where for 2 factor variables I have about 200 missing values each. I want to impute these using 10 possibly explanatory variables which are a mixture of integers and factors. Since I was quite intrigued by the concept of rrp I wanted to use it but it takes ages and terminates with an error. First time it stopped complaining about too little memory which I increased then from 1.5 to 2GB. Now it terminates after a long time with this: Error in nn[[i]] : subscript out of bounds Has anybody encountered this problem before, is it due to my data? Could you recommend another package for such imputation? I looked at the aregImpute in Hmisc but I don't really understand what it is doing. Thanks a lot, Werner E-Mails jetzt auf Ihrem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rrp.impute: for what sizes does it work?
rrp is working! Sorry, it was my mistake... fiddling around to find out what the problem is I forgot to re-include the variables which are to be imputed. It seems like this case is not caught but the algorithm finishes with the mentioned error. Anyway, I am still a little fuzzy about imputation and browsing the web I found no clear recommendations regarding this topic. Which R function would you recommend for imputing categorical variables / factors? Many thanks, Werner Hi, I have a survey dataset of about 2 observations where for 2 factor variables I have about 200 missing values each. I want to impute these using 10 possibly explanatory variables which are a mixture of integers and factors. Since I was quite intrigued by the concept of rrp I wanted to use it but it takes ages and terminates with an error. First time it stopped complaining about too little memory which I increased then from 1.5 to 2GB. Now it terminates after a long time with this: Error in nn[[i]] : subscript out of bounds Has anybody encountered this problem before, is it due to my data? Could you recommend another package for such imputation? I looked at the aregImpute in Hmisc but I don't really understand what it is doing. Thanks a lot, Werner Lesen Sie Ihre E-Mails jetzt einfach von unterwegs. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column name handling and long labels
Somehow, I don't get how the labels of Hmisc work. My expectation was that if I use the following code and then the print method, I would get an output where the headers are replaced by the labels but I get the normal variable names. How can I get the labels as headers instead in the printed table? df - data.frame(x=seq(1,3),y=seq(4,6)) df - upData(df, labels=c(x=X1,y=X2)) print(df2) Thanks again, Werner Hi, I have two loosely related questions which could make my live again a bit easier: 1) Is there a simple way to select a range of columns in a data frame using column names? I am thinking of something like mydf[1,col4:col8] Try this using builtin data frame anscombe which has columns x1 to x4 followed by y1 to y4: subset(anscombe, select = x3:y2) 2) I have a data frame with many columns and they all have short variable names which is good in most cases but sometimes it would be nice to have also a longer descriptive name / label attached to the variable which could then be used for printing and latex output. Has anybody come up with a convenient way to do that? Right now, I am using always match or merge in case of row names. See ?label in package Hmisc. Many thanks, Werner Lesen Sie Ihre E-Mails auf dem Handy. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Custom LaTeX tables
Thanks for the answers! I will play around a bit and maybe I really need to write a custom wrapper than. Best, Werner --- Gabor Grothendieck [EMAIL PROTECTED] schrieb: On Tue, Feb 26, 2008 at 10:58 AM, Werner Wernersen [EMAIL PROTECTED] wrote: Hello, I am very happy that I have Sweave and R to write my papers. But I still have to do some tables by hand since I have not found out how I can customize the latex tables produced by R further (I mainly use xtable()). Like for instance, I have a table which needs an extra row every few rows as a group header and sometimes I want some extra horizontal lines in the table and also a multicolumn heading. How do you guys cope with such cases, do you set the table by hand in the end or have you found a neat way to deal with this? Many thanks and regards, Werner A few options are: - Hmisc latex() supports multicolumn headings and group headings although the large number of arguments may be daunting - xtable (and Hmisc's latex too) supports a style of combining latex fragments with the xtable. The add.to.row= argument on print.xtable is the one to notice. e.g. using the builtin BOD data frame this adds a 2nd row of headings and a group heading: print(xtable(BOD, align = r|r|r|), include.rownames = FALSE, add.to.row = list(pos = list(0, 3), command = c(\\multicolumn{1}{|c|}{(days)} \\multicolumn{1}{|c|}{(mg/l)} , \\hline \\multicolumn{2}{|l|}{Special Values} \\hline ))) - given the freedom from restrictions I find its often just best to do it manually in latex or if you have many tables with the same format in a report to generate a report-specific table layout wrapper that emits the latex you need. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Custom LaTeX tables
Hello, I am very happy that I have Sweave and R to write my papers. But I still have to do some tables by hand since I have not found out how I can customize the latex tables produced by R further (I mainly use xtable()). Like for instance, I have a table which needs an extra row every few rows as a group header and sometimes I want some extra horizontal lines in the table and also a multicolumn heading. How do you guys cope with such cases, do you set the table by hand in the end or have you found a neat way to deal with this? Many thanks and regards, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] column name handling and long labels
Hi, I have two loosely related questions which could make my live again a bit easier: 1) Is there a simple way to select a range of columns in a data frame using column names? I am thinking of something like mydf[1,col4:col8] 2) I have a data frame with many columns and they all have short variable names which is good in most cases but sometimes it would be nice to have also a longer descriptive name / label attached to the variable which could then be used for printing and latex output. Has anybody come up with a convenient way to do that? Right now, I am using always match or merge in case of row names. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column name handling and long labels
Thank you very much, Henrique! The comment function is exactly what I was looking for. Regarding 1) why example was bad: The column names don't follow an easy pattern but are more like s8v2, s12v3, s6v1 etc. Kind regards, Werner --- Henrique Dallazuanna [EMAIL PROTECTED] schrieb: Try this: 1) mydf[1,paste(col, 4:8, sep=)] 2) You can use comment function: comment(mydf) - c(Column number1, Column number2) or comment(mydf$col1) - Column number1 etc then comment(mydf) and comment(mydf$col1) to see the labels __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] column name handling and long labels
That's perfect! The subset way is very easy to use and I have to play around a bit more with label() which seems quite complex. Thanks a million, Werner --- Gabor Grothendieck [EMAIL PROTECTED] schrieb: On Thu, Feb 21, 2008 at 6:09 AM, Werner Wernersen [EMAIL PROTECTED] wrote: Hi, I have two loosely related questions which could make my live again a bit easier: 1) Is there a simple way to select a range of columns in a data frame using column names? I am thinking of something like mydf[1,col4:col8] Try this using builtin data frame anscombe which has columns x1 to x4 followed by y1 to y4: subset(anscombe, select = x3:y2) 2) I have a data frame with many columns and they all have short variable names which is good in most cases but sometimes it would be nice to have also a longer descriptive name / label attached to the variable which could then be used for printing and latex output. Has anybody come up with a convenient way to do that? Right now, I am using always match or merge in case of row names. See ?label in package Hmisc. Many thanks, Werner Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Connecting from Excel to running R session?
Hi, I haven't used RExcel before but from what I've read in the instructions so far it seems like I cannot connect from RExcel to an already running R session, can I? The background is that usually I use Tinn-R and start R from there but occasionally I get the sudden desire to push the data to Excel to do a few things there. Thanks for any hints, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sqldf error
Hi, sqldf sounds like a very useful package but I don't even get the example to run: a1s - sqldf(select * from warpbreaks limit 6) Error in combine(FUN(...)) : argument value is missing, with no default I am using R 2.6.1 on Windows Vista Business and have updated all packages. Some help would be very much appreciated. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sqldf error
I cleaned up the environment and restarted everything and it does work. But I have no idea what it is what is different now. Anyway, it works! Thanks a lot Gabor! Best, Werner I can't reproduce your error: library(sqldf) sqldf(select * from warpbreaks limit 6) breaks wool tension 1 26A L 2 30A L 3 54A L 4 25A L 5 70A L 6 52A L R.version.string # Vista [1] R version 2.6.2 alpha (2008-01-26 r44181) A few things to try: 1. maybe you have some other package loaded that is interfering? The error occurs in 'combine' but combine is not a function in sqldf nor in RSQLite, DBI or proto -- the packages on which it depends. Try it from a new session. Be sure you don't have an .Rprofile file that is loading other packages. Rgui --vanilla library(sqldf) sqldf(...command...) 2. Try issuing the source statement in example 6 on the sqldf home page first (that will get you the development version) and try that. I doubt that will solve it but its worth a try. http://sqldf.googlecode.com On Jan 29, 2008 5:58 AM, Werner Wernersen [EMAIL PROTECTED] wrote: Hi, sqldf sounds like a very useful package but I don't even get the example to run: a1s - sqldf(select * from warpbreaks limit 6) Error in combine(FUN(...)) : argument value is missing, with no default I am using R 2.6.1 on Windows Vista Business and have updated all packages. Some help would be very much appreciated. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] micEcon: selection(,method=ml) . Predict method?
Hi, as I read, maximum likelihood is the better method for estimating selection-biased models. But I also want to predict from that model. Is there any predict method for the selection function when using maximum likelihood estimation in micEcon? I couldn't find any. Many thanks, Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Linear model with svyglm
Hi, I am a bit unclear if svyglm with family=gaussian is actually a normal linear model including weighting. The goal is to estimate a normal linear model using sample inflation weights. Can anybody illuminate me a bit on this? Thanks a lot! Werner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.