Re: [R] Can not load msm package
John Sorkin wrote: windows XP R 2.6.0 What about upgrading to some recent version of R? I have tried to install the msm package several times. How? Using the menu? Or with install.packages(msm) ? Which mirror did you choose? Each time the installation appears to work. I then go to PACKAGES-LOAD PACKAGE but the msm package does not appear in the SELECT ONE dialog box. Can someone suggest how I can get msm to run on my system? Thanks, John What happens if you say library(msm) Does install.packages(msm) report any error message? Uwe Ligges Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:6}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Subset: data frames and factor levels
Hi! I'm doing: etni - subset(etni, NAMECOM!=Maniquisito) where etni is a data.frame, NAMECOM a factor and Maniquisito labels a row that I want to delete. The problem is that while the row is deleted, the factor level is still there (I can see Maniquisito if I do levels(etni$NAMECOM) ). I know I can get the appropriate levels by: levels(factor(etni$NAMECOM)) so I could etni$NAMECOM - factor(etni$NAMECOM) but there are other columns in etni that are factors as well. Do I have to take care of each factor column? Should not subset take care of recalculating the factor levels automatically? Thanks! Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Subset: data frames and factor levels
On Tuesday 01 April 2008 09:43:00 am Agustin Lobo wrote: AL I'm doing: AL etni - subset(etni, NAMECOM!=Maniquisito) AL AL where etni is a data.frame, NAMECOM a factor and Maniquisito labels AL a row that I want to delete. AL AL The problem is that while the row is deleted, the factor level is still AL there (I can see Maniquisito if I do levels(etni$NAMECOM) ). See http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels Stefan -- Microeconomics University of Erfurt __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] comparison of intercepts and slopes in linear regression
Hi all, I would like to make a 2-by-2 comparison of intercepts and slopes from linear regression models. Can you advise me on that? All the best, Diogo André Alagador [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Subset: data frames and factor levels
Thanks, problem solved thanks to your hints, but, within subset(), drop=T still keeps the unused levels (I'm using 2.6.1 on win). Agus Stefan Grosse escribió: On Tuesday 01 April 2008 09:43:00 am Agustin Lobo wrote: AL I'm doing: AL etni - subset(etni, NAMECOM!=Maniquisito) AL AL where etni is a data.frame, NAMECOM a factor and Maniquisito labels AL a row that I want to delete. AL AL The problem is that while the row is deleted, the factor level is still AL there (I can see Maniquisito if I do levels(etni$NAMECOM) ). See http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_levels Stefan -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] access networked PCs directories/files with R ?
access networked PCs directories/files with R ? Dear group, I would like to know if there is an easy way to access several networked PCs directories/files from one PC with R ? Concerned OS is windows. I can for instance use dir() on my current PC. Is there a way to do dir() on a connected PC ? (Is there a special syntax for the path ?) (read.table() or readLines() work with URLs I imagine it may also work on connected shared PCs) Thanks for any help. Vincent __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] spatial cross-correlation
Dear Javier, It seems to me that you want to calculate cross variograms. You can do that with the gstat package. Have a look at the example in ?gstat libary(gstat) data(meuse) # let's do some manual fitting of two direct variograms and a cross variogram g - gstat(id = ln.zinc, formula = log(zinc)~1, locations = ~x+y, data = meuse) g - gstat(g, id = ln.lead, formula = log(lead)~1, locations = ~x+y, data = meuse) # examine variograms and cross variogram: plot(variogram(g)) # enter direct variograms: g - gstat(g, id = ln.zinc, model = vgm(.55, Sph, 900, .05)) g - gstat(g, id = ln.lead, model = vgm(.55, Sph, 900, .05)) # enter cross variogram: g - gstat(g, id = c(ln.zinc, ln.lead), model = vgm(.47, Sph, 900, .03)) # examine fit: plot(variogram(g), model = g$model, main = models fitted by eye) # see also demo(cokriging) for a more efficient approach g[ln.zinc] g[ln.lead] g[c(ln.zinc, ln.lead)] g[1] g[2] HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens [EMAIL PROTECTED] Verzonden: dinsdag 1 april 2008 11:23 Aan: r-help@r-project.org Onderwerp: [R] spatial cross-correlation Hi; I cannot find in the R html documentation a way to evaluate cross-correlation in 2D data sets. I would like to evaluate cross-correlation in a series of moving windows between two maps. i,e, specify several windows inside the complete 2D spatial matrixes and for each one ofthese windows evaluate the 2D cross-correlation (commonly conducted in the spectral domain). Thanks in advance and best wishes, Javier GP - __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] filtering out duplicates creating a dataframe with unique id
try the following: dat - data.frame( id = gl(10, 5), y = rnorm(50), time = rep(1:5, 10), sex = gl(2, 25, labels = c(male, female)), age = round(rep(runif(10, 18, 55), each = 5), 1) ) dat[tapply(row.names(dat), dat$id, head, n = 1), ] dat[!duplicated(dat$id), ] I hope it helps. Best, Dimitris Dimitris Rizopoulos 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: Bob Green [EMAIL PROTECTED] To: r-help@r-project.org Sent: Tuesday, April 01, 2008 11:37 AM Subject: [R] filtering out duplicates creating a dataframe with unique id Hello, I am working on a dataframe that contains a number of duplicates (e.g a person may have more than one court appearance). There are 539 rows. If I run the code: length(unique(Feb25$ Patient.Id)) this indicates there are 508 unique individuals. I have been unable to work out how to filter out rows where there is a duplicate id so that the resulting dataframe consists only of the one id per person, and this id, is the first one thartappears. I was also interested in creating a data frame that consisted of these removed duplicates. Any assistance with the code to do this is much appreciated, regards Bob Green __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] spatial cross-correlation
Hi; I cannot find in the R html documentation a way to evaluate cross-correlation in 2D data sets. I would like to evaluate cross-correlation in a series of moving windows between two maps. i,e, specify several windows inside the complete 2D spatial matrixes and for each one ofthese windows evaluate the 2D cross-correlation (commonly conducted in the spectral domain). Thanks in advance and best wishes, Javier GP - __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] access networked PCs directories/files with R ?
On Tue, 1 Apr 2008, mel wrote: access networked PCs directories/files with R ? Dear group, I would like to know if there is an easy way to access several networked PCs directories/files from one PC with R ? Concerned OS is windows. I can for instance use dir() on my current PC. Is there a way to do dir() on a connected PC ? (Is there a special syntax for the path ?) If it works at all, the usual syntax will work. E.g. dir(reeve\\temp) [1] biblio.tex R (that's \\reeve\temp, the share \temp on machine 'reeve'). (read.table() or readLines() work with URLs I imagine it may also work on connected shared PCs) No, because MS has not implemented the RFC1738 for URLs to apply to remote machines. See ?url. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] GeoDa spdep
Steve Schachterle steve.schachterle at gmail.com writes: My question is in regard to the spdep and GeoDa packages. Do you know how to extract a neighborhood/adjacency matrix from R? I need a matrix that has all the neighborhoods on the X and Y axis, and then a r=1 when the neighborhoods touch, and a r=0 when neighborhoods don't touch. I think the Moran's I functions use a matrix like this when they estimate Moran's I. I can estimate Moran's I, but I can't figure out how to extract the matrix. I've been trying to do this for months and I just can't get it. Look at the help for listw2mat or equivalently nb2mat in spdep - they make square matrices from spatial weight and spatial neighbour list objects respectively. The output matrix will be very sparse. As far as I know, you can make such matrices by reading GeoDa GAL or GWT files into R, and then convert them to matrices as just described. Denizens of the GeoDa openspace list, or R's very own R-sig-geo could have helped quickly if you'd asked. Roger Thank you so much. The R project is an invaluable gift to the scientific and statistical community. Steve __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] filtering out duplicates creating a dataframe with unique id
Hello, I am working on a dataframe that contains a number of duplicates (e.g a person may have more than one court appearance). There are 539 rows. If I run the code: length(unique(Feb25$ Patient.Id)) this indicates there are 508 unique individuals. I have been unable to work out how to filter out rows where there is a duplicate id so that the resulting dataframe consists only of the one id per person, and this id, is the first one thartappears. I was also interested in creating a data frame that consisted of these removed duplicates. Any assistance with the code to do this is much appreciated, regards Bob Green __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] lmer function :method=AGQ
I am using the lmer function from the lme4 package. I wrote the following statement, specifying the method to be adaptive Gaussian quadrature. I am getting an error saying method = AGQ not yet implemented for supernodal representation. Please help. How can i implement AGQ. fit-lmer(response~beta1+(1|patient),family=binomial,method=AGQ,data=data.2) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 the lower bound of normal distribution to 0 ?
Tom Cohen [EMAIL PROTECTED] skrev:Thanks Prof Brian for your suggestion. I should know that for right-skewed data, one should generate the samples from a lognormal. My problem is that x and y are two instruments that were thought to be measured the same thing but somehow show a wide confidence interval of the difference between the two intruments.This may be true that these two measure differently but can also due to the small number of observations, so the idea is if I increases the sample size then I may get better precision between the two instrument by generating samples based on the means and standard deviations from x and y. I am using 'urlnorm' which allows sampling from truncated distribution since I want the samples to take values from 0 to the max(x) respectively max(y). I am unsure how to specify the means and standard deviations in 'urlnorm'. Based on x- and y-values I have standard deviations sd_x=0.3372137, sd_y=0.5120841 and the means mean_x=0.3126667 mean_y=0.4223137 which are not on log scale as required in urlnorm. To covert sd_x, sd_y and mean_x, mean_y on a log-scale I did sd_logx=sqrt(log(1.3372137))=0.54, sd_logy=sqrt(log(1.5120841))=0.64, mean_logx=-(0.54^2)/2 and mean_logy=-(0.64^2)/2. Can anyone tell if these are correctly calculated? Are these the values to be specified in urlnorm? Do the lower respectively upper bound have to be on the log-scale as well or which scale? set.seed(7) for(i in 1:len){ s1[[i]]-cbind.data.frame(x=urlnorm(n*i,meanlog=mean_logx,sdlog=sd_logx, lb=0, ub=max(x)), y=urlnorm(n*i,meanlog=mean_logy,sdlog=sd_logy, lb=0, ub=max(y))) } Thanks again for any suggetions. Prof Brian Ripley [EMAIL PROTECTED] skrev: On Thu, 27 Mar 2008, Tom Cohen wrote: Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both instruments are non-negative, so if using rnorm I would get some negative values. Is there any options to determine the lower bound of normal distribution to be 0 or can I simulate the samples in different ways to avoid the negative values? Well, that would not be a normal distribution. If you want a _truncated_ normal distribution it is very easy by inversion. E.g. trunc_rnorm - function(n, mean = 0, sd = 1, lb = 0) { lb - pnorm(lb, mean, sd) qnorm(runif(n, lb, 1), mean, sd) } but I suggest you may rather want samples from a lognormal. dat id x y 75 101 0.134 0.1911315 79 102 0.170 0.1610306 76 103 0.134 0.1911315 84 104 0.170 0.1610306 74 105 0.134 0.1911315 80 106 0.170 0.1610306 77 107 0.134 0.1911315 81 108 0.170 0.1610306 82 109 0.170 0.1610306 78 111 0.170 0.1610306 83 112 0.170 0.1610306 85 113 0.097 0.278 2 201 1.032 1.5510434 1 202 0.803 1.0631001 5 203 1.032 1.5510434 mu-apply(dat[,-1],2,mean) sigma-apply(dat[,-1],2,sd) len-5 n-20 s1-vector(list,len) set.seed(7) for(i in 1:len){ s1[[i]]-cbind.data.frame(x=rnorm(n*i,mean=mu[1],sd=sigma[1]), y=rnorm(n*i,mean=mu[2],sd=sigma[2])) } Thanks for any help, Tom - S?? efter k??leken! [[alternative HTML version deleted]] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 - Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. - Låna pengar utan säkerhet. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] set the lower bound of normal distribution to 0 ?
Dear Tom, In my opinion you should first transform your data to the log-scale and then calculate the mean and st.dev. of the log-transformed data. Because mean(log(x)) is not equal to log(mean(x)). HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 [EMAIL PROTECTED] www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Tom Cohen Verzonden: dinsdag 1 april 2008 14:17 Aan: [EMAIL PROTECTED] Onderwerp: [R] set the lower bound of normal distribution to 0 ? Tom Cohen [EMAIL PROTECTED] skrev:Thanks Prof Brian for your suggestion. I should know that for right-skewed data, one should generate the samples from a lognormal. My problem is that x and y are two instruments that were thought to be measured the same thing but somehow show a wide confidence interval of the difference between the two intruments.This may be true that these two measure differently but can also due to the small number of observations, so the idea is if I increases the sample size then I may get better precision between the two instrument by generating samples based on the means and standard deviations from x and y. I am using 'urlnorm' which allows sampling from truncated distribution since I want the samples to take values from 0 to the max(x) respectively max(y). I am unsure how to specify the means and standard deviations in 'urlnorm'. Based on x- and y-values I have standard deviations sd_x=0.3372137, sd_y=0.5120841 and the means mean_x=0.3126667 mean_y=0.4223137 which are not on log scale as required in urlnorm. To covert sd_x, sd_y and mean_x, mean_y on a log-scale I did sd_logx=sqrt(log(1.3372137))=0.54, sd_logy=sqrt(log(1.5120841))=0.64, mean_logx=-(0.54^2)/2 and mean_logy=-(0.64^2)/2. Can anyone tell if these are correctly calculated? Are these the values to be specified in urlnorm? Do the lower respectively upper bound have to be on the log-scale as well or which scale? set.seed(7) for(i in 1:len){ s1[[i]]-cbind.data.frame(x=urlnorm(n*i,meanlog=mean_logx,sdlog=sd_logx, lb=0, ub=max(x)), y=urlnorm(n*i,meanlog=mean_logy,sdlog=sd_logy, lb=0, ub=max(y))) } Thanks again for any suggetions. Prof Brian Ripley [EMAIL PROTECTED] skrev: On Thu, 27 Mar 2008, Tom Cohen wrote: Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both instruments are non-negative, so if using rnorm I would get some negative values. Is there any options to determine the lower bound of normal distribution to be 0 or can I simulate the samples in different ways to avoid the negative values? Well, that would not be a normal distribution. If you want a _truncated_ normal distribution it is very easy by inversion. E.g. trunc_rnorm - function(n, mean = 0, sd = 1, lb = 0) { lb - pnorm(lb, mean, sd) qnorm(runif(n, lb, 1), mean, sd) } but I suggest you may rather want samples from a lognormal. dat id x y 75 101 0.134 0.1911315 79 102 0.170 0.1610306 76 103 0.134 0.1911315 84 104 0.170 0.1610306 74 105 0.134 0.1911315 80 106 0.170 0.1610306 77 107 0.134 0.1911315 81 108 0.170 0.1610306 82 109 0.170 0.1610306 78 111 0.170 0.1610306 83 112 0.170 0.1610306 85 113 0.097 0.278 2 201 1.032 1.5510434 1 202 0.803 1.0631001 5 203 1.032 1.5510434 mu-apply(dat[,-1],2,mean) sigma-apply(dat[,-1],2,sd) len-5 n-20 s1-vector(list,len) set.seed(7) for(i in 1:len){ s1[[i]]-cbind.data.frame(x=rnorm(n*i,mean=mu[1],sd=sigma[1]), y=rnorm(n*i,mean=mu[2],sd=sigma[2])) } Thanks for any help, Tom - S?? efter k??leken! [[alternative HTML version deleted]] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 - Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. - Låna pengar utan säkerhet. [[alternative
Re: [R] lmer function :method=AGQ
On Tuesday 01 April 2008 02:20:39 pm Boikanyo Makubate wrote: BM I am using the lmer function from the lme4 package. I wrote the BM following statement, specifying the method to be adaptive Gaussian BM quadrature. I am getting an error saying method = AGQ not yet BM implemented for supernodal representation. Please help. How can i BM implement AGQ. This has been answered yesterday by Douglas Bates who is the lme4 developer: http://www.nabble.com/lmer-function.-td16398022.html#a16398022 Why do you think that reposting with the very same text will yield any better answer than this? Stefan -- Microeconomics University of Erfurt __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Subset: data frames and factor levels
Try drop.levels in library gdata. Weidong Gu, Department of Medicine University of Alabama, Birmingham 1900 University Blvd., Birmingham, Alabama 35294 Email: [EMAIL PROTECTED] PH: (205)-975-9053 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Agustin Lobo Sent: Tuesday, April 01, 2008 3:26 AM To: Stefan Grosse Cc: r-help@r-project.org Subject: Re: [R] Subset: data frames and factor levels Thanks, problem solved thanks to your hints, but, within subset(), drop=T still keeps the unused levels (I'm using 2.6.1 on win). Agus Stefan Grosse escribió: On Tuesday 01 April 2008 09:43:00 am Agustin Lobo wrote: AL I'm doing: AL etni - subset(etni, NAMECOM!=Maniquisito) AL AL where etni is a data.frame, NAMECOM a factor and Maniquisito labels AL a row that I want to delete. AL AL The problem is that while the row is deleted, the factor level is still AL there (I can see Maniquisito if I do levels(etni$NAMECOM) ). See http://wiki.r-project.org/rwiki/doku.php?id=tips:data-manip:drop_unused_ levels Stefan -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] comparison of intercepts and slopes in linear regression
Sorry if cross-posting Hi all, I would like to make a 2-by-2 comparison of intercepts and slopes from linear regression models. Can you advise me on that? All the best, Diogo André Alagador [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SiZer plots in R
Try: http://www.math.usu.edu/~minnotte/research/software/sizer.r Note that I haven't tried it... sewatkins wrote: Hello, I am a graduate student at UNC Chapel Hill, and I am attempting to create a SiZer plot for a nonparametric analysis. I have found the file to use this program in Matlab, however I was hoping to find a package to use this in R. Does anyone know of a package that can create this type of graph? Thanks, Stephanie You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/SiZer-plots-in-R-tp16404151p16418412.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SiZer plots in R
See also the CRAN package feature, by Tarn Duong and Matt Wand: http://cran.r-project.org/web/packages/feature/index.html sewatkins wrote: Hello, I am a graduate student at UNC Chapel Hill, and I am attempting to create a SiZer plot for a nonparametric analysis. I have found the file to use this program in Matlab, however I was hoping to find a package to use this in R. Does anyone know of a package that can create this type of graph? Thanks, Stephanie You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/SiZer-plots-in-R-tp16404151p16418444.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] NEW: Sociolects in R
The R translation teams have done a great job in making R usable for people who do not have English as their mother tongue. However, even within English speaking countries, there are groups which have trouble with the language, and it may be valuable to support the Sociolects of these groups too. Thanks to a generous contribution from Lars Polifo, these features will be made available in an upcoming version of R. As it turns out, there are some particularly interesting challenges that needs to be addressed. Consider for instance the translation of the t test in the locale en_SF_US.UTF8 (notice the interjection of the code SF to denote San Fernando Valley) t.test(extra ~ group, oh, baby, data = sleep) Welch Two Sample t-test data: extra by group t = -1.8608, like, df = 17.776, like, wow, p-value = 0.0794 alternative hypothesis: true difference in means is like, ya know, not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates: mean in group 1 mean in group 2 0.752.33 Notice that in addition to the simple message string modifications, it has been necessary to modify the parser so as to delete obviously superfluous arguments such as oh or baby (a particular issue here is that the argument like might actually be intended to mean likelihood). Similarly, for se_KC_SE.UTF8 (KC for kitchen) we have alternate spellings of arguments like data: t.test(ixtra ~ gruoop, deta = sleep) Velch Tvu Semple-a t-test deta: ixtra by gruoop t = -1.8608, dff = 17.776, p-felooe-a = 0.0794 elterneteefe-a hypuzeesees: trooe-a deeerence-a in meuns is nut iqooel tu 0 95 percent cunffeedence-a interfel: -3.3654832 0.2054832 semple-a isteemetes: meun in gruoop 1 meun in gruoop 2 0.752.33 Canadian English poses particular problems, which have not yet been resolved. If we are to do it properly, it would entail modifications to the R language itself. For instance we'd have to introduce a four loop and change the end-brace to the four-character string eh?}. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] lmer function :method=AGQ
On Tue, Apr 1, 2008 at 7:45 AM, Stefan Grosse [EMAIL PROTECTED] wrote: On Tuesday 01 April 2008 02:20:39 pm Boikanyo Makubate wrote: BM I am using the lmer function from the lme4 package. I wrote the BM following statement, specifying the method to be adaptive Gaussian BM quadrature. I am getting an error saying method = AGQ not yet BM implemented for supernodal representation. Please help. How can i BM implement AGQ. This has been answered yesterday by Douglas Bates who is the lme4 developer: http://www.nabble.com/lmer-function.-td16398022.html#a16398022 Why do you think that reposting with the very same text will yield any better answer than this? This person also wrote directly to me asking how to implement AGQ. I read the message early in the morning and didn't pick up on the fact that the choice of the word implement probably was based on the error message. I interpreted it as a programmer requesting detailed instructions, which I then proceeded to provide. In retrospect, I don't think that was the sense of the request. I now believe it was in the sense of How do I make this error message go away?. Could someone at the Statistics Department at the University of Glasgow please take this person aside and explain what the error message means and why asking the same question over and over is unlikely to produce a more positive answer? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] lrm -interaction without main effect-error message
Dear all, this might be not only an R-question but also a statistical. When I do a logistic regression analysis (species distribution modeling) with function lrm (Design package) I get the follwoing error message: tadl1-lrm(triad~fd+dista+fd2+dista2+fd:dista+dista:geo2, x=T, y=T) Error in if (!length(fname) || !any(fname == zname)) { : missing value where TRUE/FALSE needed The problem seems to be that geo2 (factor variable with 3 levels) is not included as main effect. But when I run the same model with glm it is working properly. However, from an ecological point of view, inclusion of only the interaction term makes sense. When running the model with inclusion of both main effect and interaction, main effect has no significant influence and the interaction only marginaly. And LR-Test underlines model simplification. Does anyone know how to solve the problem? I need the lrm function since I have to validate my models via bootstrapping (validate.lrm). Many thanks! Eva -- Eva Mosner Lilienstraße 9 35043 Marburg 06421-8400886 0151-17867488 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] NEW: Sociolects in R
Groovy!!! Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Tuesday, April 01, 2008 10:19 AM To: R help Subject: [R] NEW: Sociolects in R The R translation teams have done a great job in making R usable for people who do not have English as their mother tongue. However, even within English speaking countries, there are groups which have trouble with the language, and it may be valuable to support the Sociolects of these groups too. Thanks to a generous contribution from Lars Polifo, these features will be made available in an upcoming version of R. As it turns out, there are some particularly interesting challenges that needs to be addressed. Consider for instance the translation of the t test in the locale en_SF_US.UTF8 (notice the interjection of the code SF to denote San Fernando Valley) t.test(extra ~ group, oh, baby, data = sleep) Welch Two Sample t-test data: extra by group t = -1.8608, like, df = 17.776, like, wow, p-value = 0.0794 alternative hypothesis: true difference in means is like, ya know, not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates: mean in group 1 mean in group 2 0.752.33 Notice that in addition to the simple message string modifications, it has been necessary to modify the parser so as to delete obviously superfluous arguments such as oh or baby (a particular issue here is that the argument like might actually be intended to mean likelihood). Similarly, for se_KC_SE.UTF8 (KC for kitchen) we have alternate spellings of arguments like data: t.test(ixtra ~ gruoop, deta = sleep) Velch Tvu Semple-a t-test deta: ixtra by gruoop t = -1.8608, dff = 17.776, p-felooe-a = 0.0794 elterneteefe-a hypuzeesees: trooe-a deeerence-a in meuns is nut iqooel tu 0 95 percent cunffeedence-a interfel: -3.3654832 0.2054832 semple-a isteemetes: meun in gruoop 1 meun in gruoop 2 0.752.33 Canadian English poses particular problems, which have not yet been resolved. If we are to do it properly, it would entail modifications to the R language itself. For instance we'd have to introduce a four loop and change the end-brace to the four-character string eh?}. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] download.file error
Hi Chib whether there is a way of handling the error you get in the download.file() function I think the function try will do this for you. That is, handle the error. Have a look at ?try. Regards John Seers --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of CHIB CO Sent: 01 April 2008 15:28 To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] download.file error Hi Jim, I just wanted to know if there is a function in R that can tell you whether a file on the internet exists before you attempt to download it or whether there is a way of handling the error you get in the download.file() function without having it break a for loop with the download error when it is part of that loop. Kind Regards Chib __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] download.file error
Hi Jim, I just wanted to know if there is a function in R that can tell you whether a file on the internet exists before you attempt to download it or whether there is a way of handling the error you get in the download.file() function without having it break a for loop with the download error when it is part of that loop. Kind Regards Chib Date: Mon, 31 Mar 2008 18:33:35 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [R] download.file error CC: r-help@r-project.org ?try On Mon, Mar 31, 2008 at 6:26 PM, CHIB CO [EMAIL PROTECTED] wrote: Dear all, I am looking for a way to work out if a file on the internet exists before attempting to download it using the function download.file(). For example, using a url that does not exist url - http://finance.yahoo.com/ftse.csv; destfile - tempfile() download.file(url = url, destfile = destfile) # gives the following response ... trying URL 'http://finance.yahoo.com/ftse.csv' Error in download.file(url = url, destfile = destfile) : cannot open URL 'http://finance.yahoo.com/ftse.csv' In addition: Warning message: In download.file(url = url, destfile = destfile) : cannot open: HTTP status was '404 Not Found' When I am using the download.file() function in a loop over multiple URLs, th! e above error will cause the loop to terminate, so I want to avoid this by checking if the file exists first then wrapping the subsequent functions in an if() statment. The original fault came from the function get.hist.quote() in the tseries package. I was trying to iterate over various stocks, but some stocks listed in the yahoo website do not have any downloadable data associated with them, which causes the loop to terminate. The workhorse function of get.hist.quote() is the download.file() function. Kind Regards Chib _ Win 100's of Virgin Experience days with BigSnapSearch.com [[alternative HTML version deleted]]__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contain! ed, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? _ Welcome to the next generation of Windows Live [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] download.file error
?file.exists On 4/1/08, CHIB CO [EMAIL PROTECTED] wrote: Hi Jim, I just wanted to know if there is a function in R that can tell you whether a file on the internet exists before you attempt to download it or whether there is a way of handling the error you get in the download.file() function without having it break a for loop with the download error when it is part of that loop. Kind Regards Chib Date: Mon, 31 Mar 2008 18:33:35 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [R] download.file error CC: r-help@r-project.org ?try On Mon, Mar 31, 2008 at 6:26 PM, CHIB CO [EMAIL PROTECTED] wrote: Dear all, I am looking for a way to work out if a file on the internet exists before attempting to download it using the function download.file(). For example, using a url that does not exist url - http://finance.yahoo.com/ftse.csv; destfile - tempfile() download.file(url = url, destfile = destfile) # gives the following response ... trying URL 'http://finance.yahoo.com/ftse.csv' Error in download.file(url = url, destfile = destfile) : cannot open URL 'http://finance.yahoo.com/ftse.csv' In addition: Warning message: In download.file(url = url, destfile = destfile) : cannot open: HTTP status was '404 Not Found' When I am using the download.file() function in a loop over multiple URLs, the above error will cause the loop to terminate, so I want to avoid this by checking if the file exists first then wrapping the subsequent functions in an if() statment. The original fault came from the function get.hist.quote() in the tseries package. I was trying to iterate over various stocks, but some stocks listed in the yahoo website do not have any downloadable data associated with them, which causes the loop to terminate. The workhorse function of get.hist.quote() is the download.file() function. Kind Regards Chib _ Win 100's of Virgin Experience days with BigSnapSearch.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? Have you played Fishticuffs? Get fish-slapping on Messenger -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] tkconfigure throws an error
When I do it with a function I lose the workspace. This is on a regulated matter and I MUST keep record of all commands/output from the source script plus the resulting workspace. Thanks everybody. Original Message From: [EMAIL PROTECTED] Date: 03/31/2008 13:10 To: stephen bond[EMAIL PROTECTED], r-help@r-project.org Subj: RE: [R] tkconfigure throws an error The command argument in the tkconfigure call should be a function, you have the results of sourcing the file, probably not the correct thing. Try something like: tkconfigure(b1,command=function(...){source(./src/f.imm2.R)}) 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 stephen bond Sent: Monday, March 31, 2008 2:45 PM To: r-help@r-project.org Subject: [R] tkconfigure throws an error Thanks everybody for looking at this. I am trying to assign a script to a button please help: library(tcltk) tt- tktoplevel() tktitle(tt)-the title heading-tklabel(tt,text=Enter date as -MM-DD) l1-tklabel(tt,text=Reporting date) b1=tkbutton(tt,text=Run) d.val-tkentry(tt,width=12) tkgrid(heading,columnspan=2) tkgrid(l1,d.val) tkgrid(b1,columnspan=2) tkconfigure(b1,command=source(./src/f.imm2.R)) # and get inconsistent errors: 1. Error in structure(.External(dotTclObjv, objv, PACKAGE = tcltk), class = tclObj) : [tcl] invalid command name .6.4. ## when the tkconfigure is entered from R buffer 2. tkconfigure(b1,command=source(./src/f.imm2.R)) Error in switch(storage.mode(x), character = .External (RTcl_ObjFromCharVector, : cannot handle object of mode 'list' # when I run the full source buffer (stuff pasted above) the script just needs the date from the tcl window and everything else is conventional R code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Applying rbind() to a sequence of data frame names
I have a set of data frames ds1, ds2, ... each having the same columns and column names: ds1 - data.frame(x=c(1,2,3,4), y=c(5,6,7,8)) ds1 - data.frame(x=c(9,10,11,12), y=c(13,14,15,16)) ... and I would like to combine them into just one data frame like ds - rbind(ds1, ds2, ...) Because there are so many of them, I will have to use a character array nms - c(ds1, ds2, ...) How can I use this character array to generate a command using rbind() on all of these data frames at once. I tried to apply eval() somehow, but did not come up with the right idea. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NEW: Sociolects in R
I can see that R_help mailing list always has the same quality and educative interest, even at some recurrent dates. Keep up the good job, eh. Best wishes, Eric 2008/4/1, Peter Dalgaard [EMAIL PROTECTED]: The R translation teams have done a great job in making R usable for people who do not have English as their mother tongue. However, even within English speaking countries, there are groups which have trouble with the language, and it may be valuable to support the Sociolects of these groups too. Thanks to a generous contribution from Lars Polifo, these features will be made available in an upcoming version of R. As it turns out, there are some particularly interesting challenges that needs to be addressed. Consider for instance the translation of the t test in the locale en_SF_US.UTF8 (notice the interjection of the code SF to denote San Fernando Valley) t.test(extra ~ group, oh, baby, data = sleep) Welch Two Sample t-test data: extra by group t = -1.8608, like, df = 17.776, like, wow, p-value = 0.0794 alternative hypothesis: true difference in means is like, ya know, not equal to 0 95 percent confidence interval: -3.3654832 0.2054832 sample estimates: mean in group 1 mean in group 2 0.752.33 Notice that in addition to the simple message string modifications, it has been necessary to modify the parser so as to delete obviously superfluous arguments such as oh or baby (a particular issue here is that the argument like might actually be intended to mean likelihood). Similarly, for se_KC_SE.UTF8 (KC for kitchen) we have alternate spellings of arguments like data: t.test(ixtra ~ gruoop, deta = sleep) Velch Tvu Semple-a t-test deta: ixtra by gruoop t = -1.8608, dff = 17.776, p-felooe-a = 0.0794 elterneteefe-a hypuzeesees: trooe-a deeerence-a in meuns is nut iqooel tu 0 95 percent cunffeedence-a interfel: -3.3654832 0.2054832 semple-a isteemetes: meun in gruoop 1 meun in gruoop 2 0.752.33 Canadian English poses particular problems, which have not yet been resolved. If we are to do it properly, it would entail modifications to the R language itself. For instance we'd have to introduce a four loop and change the end-brace to the four-character string eh?}. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Eric Lecoutre Consultant - Business Decision Business Intelligence Customer Intelligence [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] strange behavior of my function
Hello, I wrote a program to convert normal distribution to trinomial distribution (three levels=0,1,2). But the first function I wrote (convert.to.trinom1) converts everything to 2. When I changed it slightly (convert.to.trinom2), it works correctly (ie. converts to 0,1, or 2). I cannot figure out why it happens. I even restarted R and tried again and the same thing happened over and over. I use R 2.6.0 in Windows Vista. Can anyone help me with this? Thank you. Kyeongmi norm1=rnorm(20) norm1 z1=-1.2212272 z2=-0.6744898 convert.to.trinom1=function(data, z1, z2){ data[dataz1]=0 data[z1=data dataz2]=1 data[data=z2]=2 data } trinom1=convert.to.trinom1(norm1,z1, z2) trinom1 convert.to.trinom2=function(data, z1, z2){ data[data=z2]=2 data[dataz1]=0 data[z1=data dataz2]=1 data } trinom2=convert.to.trinom2(norm1,z1, z2) trinom2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] strange behavior of my function
You should write the function in this way, I think. convert.to.trinom3=function(data, z1, z2){ ans - data ans[dataz1]=0 ans[z1=data dataz2]=1 ans[data=z2]=2 ans } On Tue, Apr 1, 2008 at 11:54 PM, Kyeongmi Cheon [EMAIL PROTECTED] wrote: Hello, I wrote a program to convert normal distribution to trinomial distribution (three levels=0,1,2). But the first function I wrote (convert.to.trinom1) converts everything to 2. When I changed it slightly (convert.to.trinom2), it works correctly (ie. converts to 0,1, or 2). I cannot figure out why it happens. I even restarted R and tried again and the same thing happened over and over. I use R 2.6.0 in Windows Vista. Can anyone help me with this? Thank you. Kyeongmi norm1=rnorm(20) norm1 z1=-1.2212272 z2=-0.6744898 convert.to.trinom1=function(data, z1, z2){ data[dataz1]=0 data[z1=data dataz2]=1 data[data=z2]=2 data } trinom1=convert.to.trinom1(norm1,z1, z2) trinom1 convert.to.trinom2=function(data, z1, z2){ data[data=z2]=2 data[dataz1]=0 data[z1=data dataz2]=1 data } trinom2=convert.to.trinom2(norm1,z1, z2) trinom2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Overlay plots from different data sets using the Lattice package
Hi all, I'm a newbie to lattice graphics. I think I have a very similar problem trying to overlay plots from different data sets. I tried a number of different things but don't seem to get it to work. I am using xYplot from library Hmisc to produce a lattice plot with Median plus error bands plotted as lines for each panel. This works fine. Now I want to add specific points to each panel, however, the data for those points are in a different data frame. I tried something along the lines of Deepayan's example, combining the two data sets using make.groups, but that doesn't seem to work. My code: data=read.table(all species.txt,header=T) data.nonrandom=read.table(all species_non-random.txt,header=T) combined=make.groups(data,data.nonrandom) xYplot(Cbind(Median,Lower,Upper)~species.pool|data.set.location, data=combined,subset=response.variable==sr,groups=which,method=bands,col=black,type=l, panel.groups=function(x,y,group.number,...) { if(group.number==1) panel.lines(x,y,...) else panel.points(x,y,...) }) This gives me the 3 lines per panel that I want (Median plus error bands) but what I want to add as points is instead also shown as a line with the group labels (data and data.nonrandom) next to it. Any ideas what I am doing wrong? Any help and suggestions would be much appreciated! Many thanks in advance. Best regards, Christoph Deepayan Sarkar wrote: On 1/14/08, Erin Steiner [EMAIL PROTECTED] wrote: #After spending the entire day working on this question, I have decided to reach out for support: #I am trying to overlay a densityplot from one data set over a histogram of another, if I were to plot the two individually, they would look like: # data frame construction data.frame.A - data.frame(rnorm(12*8), c(rep(one, 4), rep(two, 4), rep(three, 4)), c(red, orange, yellow, green)) names(data.frame.A) - c(vals, factor.1, factor.2) data.frame.B - data.frame(rnorm(12*15), c(rep(one, 4), rep(two, 4), rep(three, 4)), c(red, orange, yellow, green)) names(data.frame.B) - names(data.frame.A) The first step would be to combine the two data sources: df.comb - make.groups(data.frame.A, data.frame.B) I would then just overlay two density plots: densityplot(~vals | factor.1 * factor.2, df.comb, groups = which, plot.points=FALSE, auto.key = TRUE) but you could do a histogram and a densityplot too: histogram(~vals | factor.1 * factor.2, df.comb, type = density, groups = which, panel = panel.superpose, panel.groups = function(x, group.number, col, ...) { if (group.number == 1) panel.histogram(x, ...) else panel.densityplot(x, ..., plot.points = FALSE) }) -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Overlay-plots-from-different-data-sets-using-the-Lattice-package-tp14824421p16418703.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] access networked PCs directories/files with R ?
Prof Brian Ripley a écrit : On Tue, 1 Apr 2008, mel wrote: access networked PCs directories/files with R ? Dear group, I would like to know if there is an easy way to access several networked PCs directories/files from one PC with R ? Concerned OS is windows. I can for instance use dir() on my current PC. Is there a way to do dir() on a connected PC ? (Is there a special syntax for the path ?) If it works at all, the usual syntax will work. E.g. dir(reeve\\temp) [1] biblio.tex R (that's \\reeve\temp, the share \temp on machine 'reeve'). (read.table() or readLines() work with URLs I imagine it may also work on connected shared PCs) No, because MS has not implemented the RFC1738 for URLs to apply to remote machines. See ?url. Hi Brian and Romain Many thanks for both answers. Both work nicely. Thanks Vincent __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Applying rbind() to a sequence of data frame names
Try this: do.call(rbind, lapply(ls(patt=^ds[0-9]), get)) On 01/04/2008, Hans W. Borchers [EMAIL PROTECTED] wrote: I have a set of data frames ds1, ds2, ... each having the same columns and column names: ds1 - data.frame(x=c(1,2,3,4), y=c(5,6,7,8)) ds1 - data.frame(x=c(9,10,11,12), y=c(13,14,15,16)) ... and I would like to combine them into just one data frame like ds - rbind(ds1, ds2, ...) Because there are so many of them, I will have to use a character array nms - c(ds1, ds2, ...) How can I use this character array to generate a command using rbind() on all of these data frames at once. I tried to apply eval() somehow, but did not come up with the right idea. Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] superimpose histogram on biplot
Hi all, I've been trying to figure out how to superimpose a histogram on a biplot that shows the relative contribution of each axis. I have been using the NIPALS function (http://biomserv.univ-lyon1.fr/~dray/ files/softwares/nipals.R) to run principal component analyses. Here is a toy example. source(http://biomserv.univ-lyon1.fr/~dray/files/softwares/nipals.R;) mat=matrix(runif(100,0,1), ncol=10, nrow=10) nipmat=nipals(mat, nf=9) scatter(nipmat) In the plot generated by the above scatter command, there is a histogram in the upper left corner. I want to know how to superimpose that histogram on a similar plot, such as the following: groups = as.factor(c(rep(1,2), rep(2,4), rep(3,4))) s.arrow(dfxy=nipmat$co[,1:2]*8, sub=Day 10, possub=bottomleft, csub=3) s.class(dfxy=nipmat$li[,1:2], fac=groups, cellipse=2, axesell=F, cstar=0 , col=c(2:3), add.plot=T) I can create the histogram using: plot(nipmat$eig/sum(nipmat$eig), type='h') but I don't know how to superimpose it on the above graph. Thanks for any help! Best, Jennie Jennie Lavine PhD Candidate Center for Infectious Disease Dynamics Penn State University 505 ASI Building (814)863-1815 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] superimpose histogram on biplot
Hi Jennie, if you have questions about ade4, you can use the adelist http://listes.univ-lyon1.fr/wws/info/adelist ade4 has the add.scatter.eig function which is exactly what you need. Try add.scatter.eig(nipmat$eig, xax=1, yax=2) Cheers, Jennie Lavine wrote: Hi all, I've been trying to figure out how to superimpose a histogram on a biplot that shows the relative contribution of each axis. I have been using the NIPALS function (http://biomserv.univ-lyon1.fr/~dray/ files/softwares/nipals.R) to run principal component analyses. Here is a toy example. source(http://biomserv.univ-lyon1.fr/~dray/files/softwares/nipals.R;) mat=matrix(runif(100,0,1), ncol=10, nrow=10) nipmat=nipals(mat, nf=9) scatter(nipmat) In the plot generated by the above scatter command, there is a histogram in the upper left corner. I want to know how to superimpose that histogram on a similar plot, such as the following: groups = as.factor(c(rep(1,2), rep(2,4), rep(3,4))) s.arrow(dfxy=nipmat$co[,1:2]*8, sub=Day 10, possub=bottomleft, csub=3) s.class(dfxy=nipmat$li[,1:2], fac=groups, cellipse=2, axesell=F, cstar=0 , col=c(2:3), add.plot=T) I can create the histogram using: plot(nipmat$eig/sum(nipmat$eig), type='h') but I don't know how to superimpose it on the above graph. Thanks for any help! Best, Jennie Jennie Lavine PhD Candidate Center for Infectious Disease Dynamics Penn State University 505 ASI Building (814)863-1815 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Stéphane DRAY ([EMAIL PROTECTED] ) Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - Lyon I 43, Bd du 11 Novembre 1918, 69622 Villeurbanne Cedex, France Tel: 33 4 72 43 27 57 Fax: 33 4 72 43 13 88 http://biomserv.univ-lyon1.fr/~dray/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] NEW: Sociolects in R
On Tuesday 01 April 2008 04:18:55 pm Peter Dalgaard wrote: PD The R translation teams have done a great job in making R usable for PD people who do not have English as their mother tongue. However, even PD within English speaking countries, there are groups which have trouble PD with the language, and it may be valuable to support the Sociolects of PD these groups too. Great news! I would love to see something like german saxonian accent: d.dässd(ägschdro ~ grubbe, doodn = schlofm) Wälsch Zwou Sämbel d-dässd Doodn: ägschdro bro grubbe t = -1.8608, Froiheedgroode = 17.776, b-Wärd = 0.0794 Aldärnadivve Hippothääse: Där Undärschidd da Durschnidde is nüsch Null Fümneunzsch Brodzend Gonfiddenzindärwall: -3.3654832 0.2054832 Sämbel Schäddzung; Dorchschnidd in Grubbe 1 Dorchschnidd in Grubbe 2 0.75 2.33 ;-) Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lrm -interaction without main effect-error message
Eva Mosner wrote: Dear all, this might be not only an R-question but also a statistical. When I do a logistic regression analysis (species distribution modeling) with function lrm (Design package) I get the follwoing error message: tadl1-lrm(triad~fd+dista+fd2+dista2+fd:dista+dista:geo2, x=T, y=T) Error in if (!length(fname) || !any(fname == zname)) { : missing value where TRUE/FALSE needed The problem seems to be that geo2 (factor variable with 3 levels) is not included as main effect. But when I run the same model with glm it is working properly. However, from an ecological point of view, inclusion of only the interaction term makes sense. When running the model with inclusion of both main effect and interaction, main effect has no significant influence and the interaction only marginaly. And LR-Test underlines model simplification. Does anyone know how to solve the problem? I need the lrm function since I have to validate my models via bootstrapping (validate.lrm). Many thanks! Eva No! The test of a 'main effect' that you did is not a valid test and it invalidates the hierarchy principle. Don't get lulled into thinking that parsimony is a good thing. Besides getting strange fits you will not preserve type I error or confidence interval coverage. If you were doing ols you would be getting an invalid estimate of sigma. Model simplification is warranted if you tested an appropriate group of parameters with a test that has a large number of degrees of freedom. For example, you might argue that ALL interaction terms could be dropped if the P-value for the combined effects of all interaction parameters is 0.3. You might argue that one predictor could be dropped if the combined effects of all main effects and interaction effects containing the predictor gives a P-value of 0.25. Both of these tests also respect the hierarchy principle. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] using a variable in a subset of a dataframe
You can try this: x - data.frame() for(i in LETTERS[1:5]) x[1:10, i] - rnorm(10) x On 01/04/2008, Georg Ehret [EMAIL PROTECTED] wrote: Dear R community,I am using a dataset and would like to define new variables using a R variable: e.g. for (i in 1:10){ dataset$i-something } But this is not the right way, I get only one variable in dataset... How can I change this? Thank you! Georg. Georg Ehret Johns Hopkins Baltimore, MD [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] using a variable in a subset of a dataframe
Dear R community,I am using a dataset and would like to define new variables using a R variable: e.g. for (i in 1:10){ dataset$i-something } But this is not the right way, I get only one variable in dataset... How can I change this? Thank you! Georg. Georg Ehret Johns Hopkins Baltimore, MD [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] unexpected GAM result - at least for me!
Hi, I've compared observed and predicted and they match 100%. For 90% probability of occurrence: table(can0,fitted(can3.gam)0.9) FALSE TRUE FALSE230 TRUE 0 125 So i guess it is a valid result . but very unexpected for me. Thank you again for all the help, Monica Date: Mon, 31 Mar 2008 09:30:01 -0400 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@r-project.org Subject: Re: [R] unexpected GAM result - at least for me! On 3/31/2008 9:01 AM, Monica Pisica wrote: Thanks Duncan. Yes i do have variation in the lidar metrics (be, ch, crr, and home) although i have a quite high correlation between ch and home. But even if i eliminate one metric (either ch or home) i end up with a deviation of 99.99. The species has values of 0 and 1 since i try to predict presence / absence. Do you think it is still a valid result? I repeat: look at the data. Compare the observed and predicted. That's the only way to know whether this is reasonable or not. If you're getting reasonable predictions, then it's a valid fit. (The tests and approximations used in the reported p-values may not be at all valid. I don't know what the requirements are for those in a GAM, but if you're getting a perfect fit, then they probably aren't being met.) Duncan Murdoch Thanks again, Monica Date: Mon, 31 Mar 2008 08:47:48 -0400 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] CC: r-help@r-project.org Subject: Re: [R] unexpected GAM result - at least for me! On 3/31/2008 8:34 AM, Monica Pisica wrote: Hi I am afraid i am not understanding something very fundamental and does not matter how much i am looking into the book Generalized Additive Models of S. Wood i still don't understand my result. I am trying to model presence / absence (presence = 1, absence = 0) of a species using some lidar metrics (i have 4 of these). I am using different models and such and when i used gam i got this very weird (for me) result which i thought it is not possible - or i have no idea how to interpret it. can3.gam - gam(can0~s(be)+s(crr)+s(ch)+s(home), family = 'binomial') summary(can3.gam) Family: binomial Link function: logit Formula: can 0 ~ s(be) + s(crr) + s(ch) + s(home) Parametric coefficients: Estimate Std. Error z value Pr(|z|) (Intercept) 85.39 162.88 0.524 0.6 Approximate significance of smooth terms: edf Est.rank Chi.sq p-value s(be) 1.000 1 0.100 0.751 s(crr) 3.929 8 0.380 1.000 s(ch) 6.820 9 0.396 1.000 s(home) 1.000 1 0.314 0.575 R-sq.(adj) = 1 Deviance explained = 100% UBRE score = -0.81413 Scale est. = 1 n = 148 Is this a perfect fit with no statistical significance, an over-estimating or what It seems that the significance of the smooths terms is null. Of course with such a model i predict perfectly presence / absence of species. Again, i hope you don't mind i'm asking you this. Any explanation will be very much appreciated. Look at the data. You can get a perfect fit to a logistic regression model fairly easily, and it looks as though you've got one. (In fact, the huge intercept suggests that all predictions will be 1. Do you actually have any variation in the data?) Duncan Murdoch In a rush? Get real-time answers with Windows Live Messenger. _ esh_instantaccess_042008 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] using a variable in a subset of a dataframe
i m not sure what u really want to do but if ur looking for some subsample of dataset then u might wanna try this (say in case u want to resample ur dataset by column id in ur dataset then do resample-sample(dataset$id,n,replace=F) dataset-dataset[resample, ] note here n is the size of subset u wanna sample from ur dataset hope this helps. cheers tasneem zaihra On Tue, 1 Apr 2008 14:23:10 -0400 Georg Ehret wrote: Dear R community, I am using a dataset and would like to define new variables using a R variable: e.g. for (i in 1:10){ dataset$i-something } But this is not the right way, I get only one variable in dataset... How can I change this? Thank you! Georg. Georg Ehret Johns Hopkins Baltimore, MD [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2 - legend for fill coulours
However, it looks this works only when the data are in the sequence of the levels in the factor defining the fill colours. When the sequence is different, the legend gets scrambled, in that the order of the colours does not match the labels. You can fix this by explicitly specifying the breaks to use in the identity scale: + scale_fill_identity(labels=levels(plotdata2$group), breaks=levels(plotdata2$group)) That way there's no confusion about how the values and their labels match up. Regards, Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] using a variable in a subset of a dataframe
Henrique Dallazuanna wrote (1.4.2008): You can try this: x - data.frame() for(i in LETTERS[1:5]) x[1:10, i] - rnorm(10) x Or this: --- cut here --- df-data.frame(0) [obsolet, if df already exists] for (i in 1:10) { df-data.frame(cbind(df,0)); names(df) [ncol(df)]-as.character(i) } --- cut here --- How 'df' changes: Step 1: df X0 1 0 Step 2 (for-loop): df X0 1 2 3 4 5 6 7 8 9 10 1 0 0 0 0 0 0 0 0 0 0 0 Is this what You are looking for? Kind regards, Kimmo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] fortran problems with R = 2.6.1 on Mac OS X
Hello, I tried to compile the source of a package which uses fortran90 with R 2.6.2 and R 2.6.1 without success. Compiling it with 2.5.1 is successful. The error message for versions = 2.6.1 is: gfortran: error trying to exec 'f951': execvp r What is the reason for that? Best regards Meinhard Ploner www.data-ploner.com PS compilation was successful on: version _ platform i386-apple-darwin8.9.1 arch i386 os darwin8.9.1 system i386, darwin8.9.1 status major 2 minor 5.1 year 2007 month 06 day27 svn rev42083 language R version.string R version 2.5.1 (2007-06-27) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] ggplot2 - legend for fill coulours
Hadley, Thanks a lot! BTW, do you have any document explaining the object philosophy of ggplot? I was trying to see how you defined scale_fill_identity, but could not find it... Cheers, Pedro At 19:50 2008/04/01, hadley wickham wrote: However, it looks this works only when the data are in the sequence of the levels in the factor defining the fill colours. When the sequence is different, the legend gets scrambled, in that the order of the colours does not match the labels. You can fix this by explicitly specifying the breaks to use in the identity scale: + scale_fill_identity(labels=levels(plotdata2$group), breaks=levels(plotdata2$group)) That way there's no confusion about how the values and their labels match up. Regards, Hadley -- http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] ps or pdf
have not followed the thread completely, but: have you tried `bitmap' with `type = pdfwrite' (or psgrb) for comparison? at least with `pdf' there are some issues which can be avoided by using ghostscript via `bitmap'. joerg On Mon, Mar 31, 2008 at 04:17:50PM -0400, Francois Pepin wrote: Prof Brian Ripley wrote: Please see the footer of this message. Sorry, here is an example. For some reason, I cannot reproduce it without using actual gene names. set.seed(1) ##The row names were originally obtained using the hgug4112a library ##from bioconductor. I set it manually for people who don't have it ##installed. ##library(hgug4112a);row-sample(na.omit(unlist(as.list(hgug4112aSYMBOL))),50) row-c(BDNF, EMX2, ZNF207, HELLS, PWP1, PDXDC1, BTD, NETO1, SLCO4C1, FZD7, NICN1, TMSB4Y, PSMB7, CADM2, SIRT3, ADH6, TM6SF1, AARS, TMEM88, CP110, ADORA2A, ATAD3A, VAPA, NXPH3, IL27RA, NEBL, FANCF, PTPRG, HSU79275, CCDC34, EPDR1, FBLN1, PCAF, AP1B1, TXNRD2, MUC20, MBNL1, STAU2, STK32C, PPIAL4, TGFBR2, DPY19L2P3, TMEM50B, ENY2, MAN2A2, ZFYVE26, TECTA, CD55, LOC400794, SLC19A3) postscript('/tmp/heatmap.ps',paper='letter',horizontal=F) heatmap(matrix(rnorm(2500),50),labRow=row) dev.off() Neither postscript() nor pdf() graphics devices split up strings they are passed (by e.g. text()), so this is being done either by the code used to create the plot (and we have no idea what that is) or by the viewer. I suspect the problem is rather in the viewer, but without the example we asked for it is impossible to know. Example of row names that are truncated in Illustrator (* denoting truncation): CCDC3*4 (2nd row) MUC2*0 (3rd row) MBNL*1 (8th row) ... It is likely that Illustrator (CS 3, OS X version) is at fault. I do not see any truncation if I look at the ps file by hand (lines 4801 and 4802): 540.22 545.88 (MUC20) 0 0 0 t 540.22 553.90 (CCDC34) 0 0 0 t There also seems to be somewhat arbitrary grouping of the last column cells in heatmaps in ps files. Again, we need an example. The top right cell (26, TXNRD2) is grouped with the cell just below it (26, CCDC34). It's more of a curiosity than anything else. I used to prefer the ps because they embed more easily in latex documents (although pdf are not difficult and conversions are trivial anyhow), but I'm curious if there are other reasons why one format might be preferred over the other in this context. The graphics devices are very similar (they share a lot of code). One small difference is that PostScript has an arc primitive, and PDF does not. This is what I thought at first, which is why I found these differences surprising. I think your idea of blaming the viewer is correct. I thought that Adobe of all people could deal with Postscript files properly, but I guess I was overly trusting. Thanks for the help, Francois __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] download.file error
Hi John Seers, thanks for the tip, it works. Kind Regards Chib Subject: RE: [R] download.file error Date: Tue, 1 Apr 2008 15:39:01 +0100 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] CC: r-help@r-project.org Hi Chib whether there is a way of handling the error you get in the download.file() function I think the function try will do this for you. That is, handle the error. Have a look at ?try. Regards John Seers --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of CHIB CO Sent: 01 April 2008 15:28 To: jim holtman Cc: r-help@r-project.org Subject: Re: [R] download.file error Hi Jim, I just wanted to know if there is a function in R that can tell you whether a file on the internet exists before you attempt to download it or whether there is a way of handling the error you get in the download.file() function without having it break a for loop with the download error when it is part of that loop. Kind Regards Chib _ Win 100s of Virgin Experience days with BigSnapSearch.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Subset: data frames and factor levels
Weidong Gu wgu at uab.edu writes: Try drop.levels in library gdata. For what it's worth, adding a drop.levels (default FALSE) to subset is a long-standing wish of mine -- I keep meaning to put together a patch to do this. (This question comes up about once a year on the R help list.) I looked at the drop.levels functionality in gdata (Warnes and Gorjanc are maintainers, this code was written by Rogers and Gorjanc) -- I was hoping it would be a simple drop-in, but although no piece of it is very complicated there are a fair number of pieces (generic definition, methods for data frame, factor, list, etc.). I think the best thing would be to (a) move this discussion to R-devel (and/or e-mail with the authors of the stuff in gdata) (b) put together a proposal for migrating drop.levels into R base, along with a drop.levels= argument in subset: I would argue that this would remedy a long-standing infelicity. Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] PAMR package question: How to plot Estimated probabilities for the training data and test data
Hi, I have tried some time trying to figure out how to use pamr to plot multiclass Estimated probabilities for the training data and test data? Specifically, how to recreate the PAMR publication on PNAS with Tibshrani et al. The publication is as attached. The plot I want to do is Figure 5. I have downloaded the pamr package and the function which gives similar plot is pamr.plotcvprob but this is different from plot estimated probability. There is one function pamr.xl.plotcvprob.compute sounds like the one I am looking for but it is internal function and is not supposed to be called by user. Any R guru or expression analysis guru who are familiar with pamr can help me? Given saying that, I hope pamr author can make a public function to plot this like the figure 5 in their PNAS paper. After they should encourage user to recreate their nice work through easy APIs. Thanks. -- Waverley @ Palo Alto -- Waverley @ Palo Alto __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] SEM with a categorical predictor variable
Hi, we are trying to do structural equation modelling on R. However, one of our predictor variables is categorical (smoker/nonsmoker). Now, if we want to run the sem() command (from the sem library), we need to specify a covariance matrix (cov). However, Pearson's correlation does not work on the dichotomous variable, so instead we produced a covariance matrix using the Spearman's (or Kendalls) correlation method, which works. Running the sem() command on our model using that covariance matrix works fine, but I am not sure if it was okay to make the covariance matrix using Spearman or Kendall. Can we interpret the regression coefficients that we find in summary(sem) just as if we had used Pearsons correlation in the covariance matrix? Or is there any other way to define a SEM including categorical variables without using a covariance matrix? I appreciate every help. Thank you very much, Vera -- View this message in context: http://www.nabble.com/SEM-with-a-categorical-predictor-variable-tp16425959p16425959.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] interactive rotating graphics
Dear Colleagues, Seems I had in the past run across the capability to create a three-dimensional scatterplot where I could use the mouse to grab the plot and rotate the axes with the mouse. I have used RSiteSearch and found a few things (e.g., TeachingDemos, iplot) but cannot find the package/function that does the above. There was also the capability to use the mouse to select and identify a single point. Any help pointing me in the right direction is appreciated. Larry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] WinXP exhibits sluggish graphics window movement mouse tracking (repainting?) over windows graphics devices
Thanks for your message! Yes, the fault was with my configuration --- I changed the video card refresh rate setting from 75 Hz to 60 Hz and the behavior is no longer sluggish. On Mon, Mar 31, 2008 at 4:03 AM, Prof Brian Ripley [EMAIL PROTECTED] wrote: I don't see this on a much older and slower machine, so suspect a problem with your Windows. It looks like something is set up to ask R to repaint after the mouse pointer, whereas Windows ought to be doing that. Even then, R uses double buffering, so the repaint should be fast (provided graphics acceleration is turned on). If you want to try updated versions of R, we suggest you use 2.7.0 alpha and not R-patched. But R updates will not solve Windows problems. On Mon, 31 Mar 2008, Richard Yeh wrote: I just noticed when using 2.6.1, 2.6.2 (2008-02-08), 2.6.2pat (2008-02-21 r44582), and 2.6.2pat (2008-03-24 r44975) on my poor old Celeron D330 (2.6 GHz; 3.5 years old) running Windows XP, that the mouse cursor appears to be redrawn more sluggishly when the pointer is over R windows graphics devices than over the R console window or other applications' windows. The slowdown seems to start only after I plotting something in the window (running windows() to open the device does not cause any slowdown), but the behavior starts after a plot(rnorm(100)). The slowdown seems to depend on the area of the R graphics window that is visible. The slowdown also occurs when moving the plot window. For example, if the graphics window is frontmost, and I want to move it until it is mostly offscreen, then the movement is jerky. However, once the window is mostly offscreen, dragging it back onto the screen is smooth and fast. (When I drag windows, I only see the frame, not the contents.) This seems to affect SDI and MDI modes. The Windows task manager confirms that when the plot window is frontmost, Rgui.exe takes most of the CPU time. My graphics card is based on an ATI Radeon 7000, with 32 MB of RAM. I am surprised that I never noticed this before. Nobody else seems to have reported it to the r-help list. Is this problem restricted to my system? (My work machine is much newer, and I do not notice the problem there.) -- 607-351-4838 / [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- 607-351-4838 / [EMAIL PROTECTED] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] interactive rotating graphics
Try the 'rgl' package On Tue, Apr 1, 2008 at 8:09 PM, Lawrence Hanser [EMAIL PROTECTED] wrote: Dear Colleagues, Seems I had in the past run across the capability to create a three-dimensional scatterplot where I could use the mouse to grab the plot and rotate the axes with the mouse. I have used RSiteSearch and found a few things (e.g., TeachingDemos, iplot) but cannot find the package/function that does the above. There was also the capability to use the mouse to select and identify a single point. Any help pointing me in the right direction is appreciated. Larry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Generating maps in R (Roger Bivand)
Roger Bivand Roger.Bivand at nhh.no writes: This was exactly why I emphasised care. One way to try to do this is to extract the FS data slot: FSd - as(FS, data.frame) and then merge() FSd and agg2, using - untried - something like: FS1d - merge(FSd, agg2, by=row.names, all=TRUE) It worked after I added one more step: row.names(FS1d) - FS1d$SUBJECT Thanks! Aleksandr Andreev Duke University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] strange behavior of my function
There are simpler looking ways of doing this. Here are two convert.to.trinom3 - function(data, z1, z2) ifelse(data z1, 0, ifelse(data z2, 1, 2)) convert.to.trinom3 - function(data, z1, z2) cut(data, c(-Inf, z1, z2, Inf), labels = FALSE) - 1 The second neatly generalizes to the case of more than three bins. Bill Venables CSIRO Laboratories PO Box 120, Cleveland, 4163 AUSTRALIA Office Phone (email preferred): +61 7 3826 7251 Fax (if absolutely necessary): +61 7 3826 7304 Mobile: +61 4 8819 4402 Home Phone: +61 7 3286 7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of ronggui Sent: Wednesday, 2 April 2008 2:03 AM To: Kyeongmi Cheon Cc: R help mailing list Subject: Re: [R] strange behavior of my function You should write the function in this way, I think. convert.to.trinom3=function(data, z1, z2){ ans - data ans[dataz1]=0 ans[z1=data dataz2]=1 ans[data=z2]=2 ans } On Tue, Apr 1, 2008 at 11:54 PM, Kyeongmi Cheon [EMAIL PROTECTED] wrote: Hello, I wrote a program to convert normal distribution to trinomial distribution (three levels=0,1,2). But the first function I wrote (convert.to.trinom1) converts everything to 2. When I changed it slightly (convert.to.trinom2), it works correctly (ie. converts to 0,1, or 2). I cannot figure out why it happens. I even restarted R and tried again and the same thing happened over and over. I use R 2.6.0 in Windows Vista. Can anyone help me with this? Thank you. Kyeongmi norm1=rnorm(20) norm1 z1=-1.2212272 z2=-0.6744898 convert.to.trinom1=function(data, z1, z2){ data[dataz1]=0 data[z1=data dataz2]=1 data[data=z2]=2 data } trinom1=convert.to.trinom1(norm1,z1, z2) trinom1 convert.to.trinom2=function(data, z1, z2){ data[data=z2]=2 data[dataz1]=0 data[z1=data dataz2]=1 data } trinom2=convert.to.trinom2(norm1,z1, z2) trinom2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- HUANG Ronggui, Wincent Bachelor of Social Work, Fudan University, China Master of sociology, Fudan University, China Ph.D. Candidate, CityU of HK, http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.htm l __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.