Re: [R] Querying the path separator?
Jonathan Greenberg wrote: The problem is that I'm trying to create a path to use with a system() call, and the command window will not work with the forward slash, only with the standard backslash. I do understand that within R it will work with either way, but not via the system call. I'm trying to create a generic system() call that will work with an external executable that is available on both windows and unix machines. Would .Platform$file.sep help you? I can't test this. Berend -- View this message in context: http://r.789695.n4.nabble.com/Querying-the-path-separator-tp3631806p3632161.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with estimating copulas
Dear all, I am looking to hire a consultant/ adviser who can help me to get my head around copulas. For a person familiar with the topic ( http://en.wikipedia.org/wiki/Copula_(statistics)) who knows the copula package or similar (http://www.jstatsoft.org/v21/i04/paper) I think the job should not take more than a couple of hours, one day maximum. Please contact me in case you are interested so that I can provide you with additional details on the problem I'd like to solve. Thanks, Michael Michael Haenlein Associate Professor of Marketing ESCP Europe Paris, France [[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] Running R from windows command prompt
If you want to have R available under command prompt you need to add the R executable to the PATH environmental variable doing this (On Windows XP and it is similar on Vista or 7): start right click on My Computer Choose properties Advanced Envonment variables Under system variables choose Path and click EDIT on variable value at the end of it add ;C:\Program Files\R\R-2.13.0\bin Click OK. And you are done. The C:\Program Files\R\R-2.13.0\bin is the place you have the R executables which you can find from explorer. After that your can call R from command prompt like R CMD BATCH e.g Good luck Caveman On 6/29/11, Michael Sumner mdsum...@gmail.com wrote: On Wed, Jun 29, 2011 at 1:51 AM, Robert Baer rb...@atsu.edu wrote: Subject: Re: [R] Running R from windows command prompt snip --- Actually, you can 'cut and paste' from at Windows Cmd prompt. It is done by clicking the C: icon in the upper left of the command window, choosing edit, and 'copy' or 'paste' as desired. Or shortcut to the Edit menu by right-click in the window. It is copying out that is weirdest, and worth knowing I think: Edit/Mark, then select the text and press Enter to copy it to the clipboard. Cheers, Mike. Rob HTH _ Arun Kumar Saha, FRM QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST Visit me at: http://in.linkedin.com/in/ArunFRM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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. -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: mdsum...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] parse XML file
Hi all, this is my first post in this mailing group. I hope that anyboby could help me parsing a xml file. I found this website http://www.omegahat.org/RSXML/gettingStarted.html but unfortunately my XML file is not as easy as the one in the example. Example: ?xml version=1.0 encoding=UTF-8? ?xml-stylesheet href=http://werdis.dwd.de/css/UNIDART/climateTimeseriesOrderByStation.xsl type=text/xsl? data xmlns=http://www.unidart.eu/xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.unidart.eu/xsd http://werdis.dwd.de/conf/timeseriesExchangeType.xsd; stationname value=Aachen v date=2011-04-01 qualityLevel=high latitude=50.7839 longitude=6.0947 altitude=202 unitA=m geoQualityLevel=certain unitV=degree C14.1/v v date=2011-04-0217.6/v v date=2011-04-0311.5/v v date=2011-04-0410.0/v v date=2011-04-05 qualityLevel=low9.6/v v date=2011-04-0616.0/v /stationname stationname value=Ahaus v date=2011-04-01 qualityLevel=high latitude=52.0828 longitude=6.9417 altitude=45.5 unitA=m geoQualityLevel=certain unitV=degree C12.5/v v date=2011-04-0215.9/v v date=2011-04-0312.0/v v date=2011-04-0410.1/v v date=2011-04-058.8/v v date=2011-04-0613.5/v /stationname /data I would like to get a table in R like this: stationname datevalue Aachen 2011-04-01 14.1 Aachen 2011-04-01 17.6 . . . Ahaus 2011-04-06 13.5 I tried to do this: doc = xmlRoot(xmlTreeParse(de.dwd.klis.TADM.xml)) tmp = xmlSApply(doc, function(x) xmlSApply(x, xmlValue)) but the stationname was not parsed because Aachen is kind of attribute of stationname. Could anyone give some help? Thanks, kai. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] parse XML file
On Wed, Jun 29, 2011 at 8:17 AM, Kai Serschmarn serschm...@googlemail.com wrote: Hi all, this is my first post in this mailing group. I hope that anyboby could help me parsing a xml file. I found this website http://www.omegahat.org/RSXML/gettingStarted.html but unfortunately my XML file is not as easy as the one in the example. Example: ?xml version=1.0 encoding=UTF-8? ?xml-stylesheet href=http://werdis.dwd.de/css/UNIDART/climateTimeseriesOrderByStation.xsl; type=text/xsl? data xmlns=http://www.unidart.eu/xsd; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.unidart.eu/xsd http://werdis.dwd.de/conf/timeseriesExchangeType.xsd; stationname value=Aachen v date=2011-04-01 qualityLevel=high latitude=50.7839 longitude=6.0947 altitude=202 unitA=m geoQualityLevel=certain unitV=degree C14.1/v v date=2011-04-0217.6/v v date=2011-04-0311.5/v v date=2011-04-0410.0/v v date=2011-04-05 qualityLevel=low9.6/v v date=2011-04-0616.0/v /stationname stationname value=Ahaus v date=2011-04-01 qualityLevel=high latitude=52.0828 longitude=6.9417 altitude=45.5 unitA=m geoQualityLevel=certain unitV=degree C12.5/v v date=2011-04-0215.9/v v date=2011-04-0312.0/v v date=2011-04-0410.1/v v date=2011-04-058.8/v v date=2011-04-0613.5/v /stationname /data I would like to get a table in R like this: stationname date value Aachen 2011-04-01 14.1 Aachen 2011-04-01 17.6 . . . Ahaus 2011-04-06 13.5 I tried to do this: doc = xmlRoot(xmlTreeParse(de.dwd.klis.TADM.xml)) tmp = xmlSApply(doc, function(x) xmlSApply(x, xmlValue)) You can loop over the doc to get to stationname elements, then loop over that list to get v elements. Then extract the node values and attributes with some assorted selectors: dumpData - function(doc){ for(i in 1:length(doc)){ stns = doc[[i]] for (j in 1:length(stns)){ cat(stns$attributes['value'],stns[[j]][[1]]$value,stns[[j]]$attributes['date'],\n) } } } Run that on your doc to see it printed out. Save to a data frame if that's what you need. This is not the perfect way to do it, since if you have other (non stationname or v) elements it'll try and handle those too, and fail. There's probably a way of looping over all stationname elements but XML makes me feel sick when I try and remember how to parse it in R at this time of the morning. its probably in the docs but this should get you started. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Indexing to insert values from a dataframe into a matrix
Hi Daisy, You've got a conceptual problem and a couple of practical ones, I think. On Tue, Jun 28, 2011 at 9:29 PM, Daisy Englert Duursma daisy.duur...@gmail.com wrote: Hello, I think this is a simple problem but I am not coming up with a simple solution. I think it just an indexing problem. I can easily replace values in a matrix from a dataframe when the dataframe has row and column numbers. In the example below I use row and column names and I can not get it to work It's not so much that a matrix has row and column numbers instead of names, as that any matrix or dataframe can be indexed numerically. #make a matrix where rows and columns are the lat and long for a bounding box of Australia and all elements have the value of -9990 bb-matrix(c(rep(-,691*886)),nrow=691 ,ncol=886,dimnames=list(seq(-10,-44.50,by=-0.05),seq(112,156.25,by=0.05))) #dfr with row names and col names and values to be replaced in the matrix dfr - data.frame(cbind(x=seq(120,125,by=0.05), y=-25, var.1=1)) Why are you making this into a dataframe? You're ending up with y containing -25 repeated 101 times, and var.1 containing 1 repeated 101 times. If these aren't actually going to be different in your final version, I'd make a list instead. Also, x actually corresponds to the column names of bb, and y to the rownames. #insert the values from the dfr into the matrix bb[dfr$x,dfr$y]-d$var.1 And then you're trying to use x and y for indexing, rather than comparing them to the names of bb. You need to use (with x and y switched): bb[rownames(bb) %in% as.character(dfr$y), colnames(bb) %in% as.character(dfr$x)] And you can assign anything you want to that, except d$var.1 because that doesn't exist. Presumably you mean dfr$var.1. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] parse XML file
Thank you Barry, that works fine. Sorry for stupid questions... however, I couldn't manage to get a dataframe out of this. That's what I was doing: doc = xmlRoot(xmlTreeParse(de.dwd.klis.TADM.xml)) dumpData - function(doc){ for(i in 1:length(doc)){ stns = doc[[i]] for (j in 1:length(stns)){ cat(stns$attributes['value'],stns[[j]][[1]]$value,stns[[j]] $attributes['date'],\n) } } } dumpData(doc) Thanks for your helping kai Am 29.06.2011 um 1106 schrieb Barry Rowlingson: Run that on your doc to see it printed out. Save to a data frame if that's what you need. This is not the perfect way to do it, since if you have other (non stationname or v) elements it'll try and handle those too, and fail. There's probably a way of looping over all stationname elements but XML makes me feel sick when I try and remember how to parse it in R at this time of the morning. its probably in the docs but this should get you started. Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] parse XML file
Hi, On Jun 29, 2011, at 6:26 AM, Kai Serschmarn wrote: Thank you Barry, that works fine. Sorry for stupid questions... however, I couldn't manage to get a dataframe out of this. That's what I was doing: doc = xmlRoot(xmlTreeParse(de.dwd.klis.TADM.xml)) dumpData - function(doc){ for(i in 1:length(doc)){ stns = doc[[i]] for (j in 1:length(stns)){ cat(stns$attributes['value'],stns[[j]][[1]]$value,stns[[j]] $attributes['date'],\n) } } } dumpData(doc) Perhaps this would work for you. It generates a list of data frames, one for each station. ## BEGIN ## start with your doc - split it into a list of nodes (one for each child) stn - xmlChildren(doc) # converts a station node to a data frame getMyStation - function(x){ # get the name of the station stationName - xmlAttrs(x)[value] # a function to extract the date and value getMyRecords - function(x){ date - xmlAttrs(x)[date] val - xmlValue(x) y - c( date, val) return(y) } # for each child, extract the records r - lapply(x, getMyRecords) nR - length(r) # bind into one matrix - all characters as this point y - do.call(rbind, r) # make a data.frame df - data.frame(Station = rep(stationName, nR), date = y[,1], value = y[,2], row.names = 1:nR, stringsAsFactors = FALSE) return(df) } # now loop through the station nodes - extract data into a data frame x - lapply(stn, getMyStation) # END Cheers, Ben Ben Tupper Bigelow Laboratory for Ocean Sciences 180 McKown Point Rd. P.O. Box 475 West Boothbay Harbor, Maine 04575-0475 http://www.bigelow.org/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Tell emacs to load new R version
Dear, How do I tell Emacs to update to the new R version I installed? It still loads the old R version. I already updated the the system path, but that didn't seem to work. Thanks for your help, Aditya -- Aditya Bhagwat [[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] What training algorithm does nnet package use?
Greetings list, I am new to programming in R, and am using nnet() function for a project on neural networking. Firslty i widh to ask if there is any pdf explaining the algorithm nnet uses, which could tell me what the objects of the nnet class, like 'conn', 'nconn, 'nsunits', n and 'nunits' mean, and how weights are calculated. The package odf has little or no explanations, and the C +R surce code availabe at CRAN is too difficult to comprehend. Can anyone please help? Also, i wish to know how the *number* of wieghts is calculated. when the nnet() command is run, it ouputs, on the console, the number of weights, and values of 'value'. But how do you calculate the bnumber of weights in nnet, say, if you are feeding it an MxN inputs dataframe (i.e. M observations, each having N inputs, like the iris dataset has M=150 and N=4), and getting, say, x number of outouts for each observation? Thank you, Hafsa -- View this message in context: http://r.789695.n4.nabble.com/R-What-training-algorithm-does-nnet-package-use-tp813206p3632339.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] Find the function of a line
Hello everybody, I have drawn a line in a x y plot that links the minimum and maximum points in the plot plot(xx,yy) a=max(yy) b=min(yy) lines(c(xx[yy==a],xx[yy==b]),c(a,b)) Now I would like to know if it is possible to extrapolate the characteristic of the line (intercept and slope). Is it there and appropriate function for this? Thanks for your help! Ida D. -- Ida Dolciotti, M.Sc. Phd student, Dept. System Ecotoxicology Helmholtz Centre for Environmental Research - UFZ Permoserstr. 15 04318 Leipzig phone: +49 - 341/235-1498 fax:+49 - 341/235-1785 email: ida.dolcio...@ufz.de website: http://www.ufz.de/index.php?en=17738 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] customer segmentation using a large data with many zeros
Hi, I am looking for clustering techniques that are tolerant to large datasets (500,000 unique customers with transaction records). I basically would like to conduct customer segmentation based on their transaction history - what they bought, how often they visited stores, demographics etc. And transaction part of the data is binary: 1 if they bought, let's say, fruits etc. Now the problem is that 1. transaction part includes lots of zeros 2. not every variables are continuous Polychoric correlations might be useful for the second part, but I am not sure how to go about the first one. I appreciate if anyone could give me advice. Thanks!! Taka __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2D Random walk
Hi, I saw your code and try running it, it works!! Can you please write this code in a user defined function. I tried making it with making a function and cant run it. -- View this message in context: http://r.789695.n4.nabble.com/2D-Random-walk-tp3069557p3632459.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] Gaussian low-pass filter
I want to filter my time series with a low-pass filter using a Gaussian smoothing function defined as: w(t) = (2πσ^2)^0.5 exp(-t^2/2σ^2) I was hoping to use an existing function to filter my data but help.search and Rsitesearch produced no useful results. Can anyone tell me if there is an existing function that will do the job? If not, how would I begin to go about building such a filter? Thanks Martin Wilkes University of Worcester __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem: Update of glm-object cannot find where the data object is located
Hi everybody, I want to ask your help to explain what is going on with my following code: mydata - data.frame(y=rbinom(100, 1, 0.5), x1=rnorm(100), x2=rnorm(100)) glm.fit.method - function(model,data,...){glm(formula=model,data=data,family=binomial,. ..)} fit1 - glm(y ~ x1 + x2, data=mydata, family=binomial()) update(fit1, .~1) Call: glm(formula = y ~ 1, family = binomial(), data = mydata) Coefficients: (Intercept) -0.04001 Degrees of Freedom: 99 Total (i.e. Null); 99 Residual Null Deviance: 138.6 Residual Deviance: 138.6 AIC: 140.6 fit2 - glm.fit.method(y ~ x1 + x2, data=mydata) update(fit2, .~1) Error in as.data.frame.default(data, optional = TRUE) : cannot coerce class 'function' into a data.frame One might expect that model 1 and model 2 are the same. So, it is strange when this error occured. We can fix it easily by telling update which data to evaluate: update(fit2, .~1, data=mydata) Call: glm(formula = y ~ 1, family = binomial, data = mydata) Coefficients: (Intercept) -0.04001 Degrees of Freedom: 99 Total (i.e. Null); 99 Residual Null Deviance: 138.6 Residual Deviance: 138.6 AIC: 140.6 I guest the problem may due to the fact that update requires specifying which data is updated or the dataset named data. fit1 and fit2 just differ in a very small point: fit1$call glm(formula = y ~ x1 + x2, family = binomial(), data = mydata) fit2$call glm(formula = model, family = binomial, data = data) I am looking forward to your response, Thanks, Lam Phung Khanh PhD student Centre for Tropical Medicine Oxford University Clinical Research Unit 190 Ben Ham Tu, Quan 5, Ho Chi Minh City Vietnam E-mail: la...@oucru.org P/S: Detail of my current R version is R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods [7] base loaded via a namespace (and not attached): [1] tools_2.13.0 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2d rndom walk
Hi all, Can anyone please tell me how to calculate the expected distance covered in a 2d random walk. Please! -- View this message in context: http://r.789695.n4.nabble.com/2d-rndom-walk-tp3632468p3632468.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] XML parsing
Hi, i want to parse a XML-File. I made some Tutorial but with my special Format it don't work. An Example of my format: ?xml version=1.0 encoding=ISO-8859-1? mzML xmlns=http://psi.hupo.org/ms/mzml; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd; version=1.1 cvList count=3 cv id=MS fullName=Proteomics Standards Initiative Mass Spectrometry Ontology version=1.3.1 URI=http://psidev.info/ms/mzML/psi-ms.obo/ cv id=UO fullName=Unit Ontology version=1.15 URI=http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo/ cv id=IMS fullName=Imaging MS Ontology version=0.9.1 URI=http://www.maldi-msi.org/download/imzml/imagingMS.obo/ /cvList fileDescription fileContent cvParam cvRef=MS accession=MS:1000579 name=MS1 spectrum value=/ cvParam cvRef=MS accession=MS:1000128 name=profile spectrum value=/ cvParam cvRef=IMS accession=IMS:180 name=universally unique identifier value={554A27FA-79D2-4766-9A2C-862E6D78B1F3}/ cvParam cvRef=IMS accession=IMS:191 name=ibd SHA-1 value=A5BE532D25997B71BE6D20C76561DDC4D5307DDD/ cvParam cvRef=IMS accession=IMS:130 name=continuous value=/ /fileContent sourceFileList count=1 sourceFile id=sf1 name=Example.raw location=C:\Users\Thorsten Schramm\Documents\Promotion\imzML\Website\files\Beispiel-Dateien\Example images\ cvParam cvRef=MS accession=MS:1000563 name=Thermo RAW file value=/ cvParam cvRef=MS accession=MS:1000768 name=Thermo nativeID format value=/ cvParam cvRef=MS accession=MS:1000569 name=SHA-1 value=7623BE263B25FF99FDF017154B86FAB742D4BB0B/ /sourceFile /sourceFileList contact cvParam cvRef=MS accession=MS:1000586 name=contact name value=Thorsten Schramm/ cvParam cvRef=MS accession=MS:1000590 name=contact organization value=Institut für Anorganische und Analytische Chemie/ cvParam cvRef=MS accession=MS:1000587 name=contact address value=Schubertstraße 60, Haus 16, Gießen, Germany/ cvParam cvRef=MS accession=MS:1000589 name=contact email value=thorsten.schr...@anorg.chemie.uni-.giessen.de/ /contact /fileDescription referenceableParamGroupList count=4 referenceableParamGroup id=mzArray cvParam cvRef=MS accession=MS:1000576 name=no compression value=/ cvParam cvRef=MS accession=MS:1000514 name=m/z array value= unitCvRef=MS unitAccession=MS:140 unitName=m/z/ cvParam cvRef=IMS accession=IMS:1000101 name=external data value=true/ cvParam cvRef=MS accession=MS:1000521 name=32-bit float value=/ /referenceableParamGroup referenceableParamGroup id=intensityArray cvParam cvRef=MS accession=MS:1000576 name=no compression value=/ cvParam cvRef=MS accession=MS:1000515 name=intensity array value= unitCvRef=MS unitAccession=MS:1000131 unitName=number of counts/ cvParam cvRef=IMS accession=IMS:1000101 name=external data value=true/ cvParam cvRef=MS accession=MS:1000521 name=32-bit float value=/ /referenceableParamGroup referenceableParamGroup id=scan1 cvParam cvRef=MS accession=MS:193 name=increasing m/z scan value=/ cvParam cvRef=MS accession=MS:195 name=linear value=/ cvParam cvRef=MS accession=MS:1000512 name=filter string value=ITMS - p NSI Full ms [100,00-800,00]/ /referenceableParamGroup referenceableParamGroup id=spectrum1 cvParam cvRef=MS accession=MS:1000579 name=MS1 spectrum value=/ cvParam cvRef=MS accession=MS:1000511 name=ms level value=0/ cvParam cvRef=MS accession=MS:1000128 name=profile spectrum value=/ cvParam cvRef=MS accession=MS:1000129 name=negative scan value=/ /referenceableParamGroup /referenceableParamGroupList sampleList count=1 sample id=sample1 name=Sample1 cvParam cvRef=MS accession=MS:101 name=sample number value=1/ /sample /sampleList softwareList count=2 software id=Xcalibur version=2.2 cvParam cvRef=MS accession=MS:1000532 name=Xcalibur value=/ /software software id=TMC version=1.1 beta cvParam cvRef=MS accession=MS:1000799 name=custom unreleased software tool value=/ /software /softwareList scanSettingsList count=1 scanSettings id=scansettings1 cvParam cvRef=IMS accession=IMS:1000401 name=top down value=/ cvParam cvRef=IMS accession=IMS:1000413 name=flyback value=/ cvParam cvRef=IMS accession=IMS:1000480 name=horizontal line scan value=/ cvParam cvRef=IMS accession=IMS:1000491 name=linescan left right value=/ cvParam cvRef=IMS accession=IMS:142 name=max count of pixel x value=3/ cvParam cvRef=IMS accession=IMS:143 name=max count of pixel y value=3/ cvParam cvRef=IMS accession=IMS:144 name=max dimension x value=300 unitCvRef=UO unitAccession=UO:017 unitName=micrometer/ cvParam cvRef=IMS accession=IMS:145 name=max dimension y value=300 unitCvRef=UO
Re: [R] Prediction with Bayesian Network?
Hi Marco, I am wondering if there are any developments on this front? Is this learn-and-predict workflow now possible? -- View this message in context: http://r.789695.n4.nabble.com/Prediction-with-Bayesian-Network-tp859920p3632567.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] Find the function of a line
lm()? Or simple geometry? lm(c(a,b) ~ c(xx[yy==a],xx[yy==b])) will give you the slope and the intercept. Sarah On Wed, Jun 29, 2011 at 5:38 AM, Ida Dolciotti ida.dolcio...@ufz.de wrote: Hello everybody, I have drawn a line in a x y plot that links the minimum and maximum points in the plot plot(xx,yy) a=max(yy) b=min(yy) lines(c(xx[yy==a],xx[yy==b]),c(a,b)) Now I would like to know if it is possible to extrapolate the characteristic of the line (intercept and slope). Is it there and appropriate function for this? Thanks for your help! Ida D. -- -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Odp: Find the function of a line
Hi r-help-boun...@r-project.org napsal dne 29.06.2011 11:38:17: Ida Dolciotti ida.dolcio...@ufz.de Hello everybody, I have drawn a line in a x y plot that links the minimum and maximum points in the plot plot(xx,yy) a=max(yy) b=min(yy) lines(c(xx[yy==a],xx[yy==b]),c(a,b)) Now I would like to know if it is possible to extrapolate the characteristic of the line (intercept and slope). Is it there and appropriate function for this? Maybe ?abline Regards Petr Thanks for your help! Ida D. -- Ida Dolciotti, M.Sc. Phd student, Dept. System Ecotoxicology Helmholtz Centre for Environmental Research - UFZ Permoserstr. 15 04318 Leipzig phone: +49 - 341/235-1498 fax:+49 - 341/235-1785 email: ida.dolcio...@ufz.de website: http://www.ufz.de/index.php?en=17738 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2d rndom walk
On Jun 29, 2011, at 6:01 AM, Komal wrote: Hi all, Can anyone please tell me how to calculate the expected distance covered in a 2d random walk. Please! If the 2d random walk is the binomial version you were looking at in Jim Holtmans' function from Dec 2010 on a 2D lattice, would it be trivially (and with zero variance) either t*2 or t*sqrt(2) depending on whether you define the term distance travelled by the edges of successive squares or by their diagonals? -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Question about error message
I'd guess that filename is not a matrix nor something that can be coerced into a matrix. Try class(filename) To find out if it is a matrix. Without knowing more about filename it is hard to diagnose. It could be a data.frame with a character field or some other simple issue resulting from importing the data into R. str(filename) Will list the fields in the filename and their type. For norm they must all be numeric. -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Kaplan Sent: Tuesday, June 28, 2011 3:22 PM To: r-h...@stat.math.ethz.ch Subject: [R] Question about error message Greetings, I'm getting this error message using Joe Shafer's NORM package. Error in storage.mode(x) - double : (list) object cannot be coerced to type 'double' I'm not sure what this means. I get this message when running s - prelim.norm(filename) prelim.norm is used to develop some summary statistics, etc. before implementing the EM algorithm for missing data. Please note that this is a data fusion exercise and there is considerable amounts of missing data by design. Thanks in advance, David -- === David Kaplan, Ph.D. Professor Department of Educational Psychology University of Wisconsin - Madison Educational Sciences, Room, 1082B 1025 W. Johnson Street Madison, WI 53706 email: dkap...@education.wisc.edu homepage: http://www.education.wisc.edu/edpsych/default.aspx?content=kaplan.html Phone: 608-262-0836 === [[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.
[R] median time period
Hello List I'm trying to calculate the median period (in months) of a set of time intervals (between two interventions). I have been playing with the lubridate package to create the intervals but I can't think of the right approach to get the median timeperiod. Toy code: library(lubridate) test - c('08-04-22', '08-07-28', '09-03-02', '09-03-03', '09-01-30', '09-03-09', '10-02-24', '10-03-05') test - ymd(test) intervals - as.period(test[5:8] - test[1:4]) intervals [1] 9 months and 8 days7 months and 9 days11 months and 22 days [4] 1 year and 2 days How can I convert this 'period' object to months? From there I think I should just convert to 'numeric' and calculate the median. Garrett if you're out there - great package but could you help please!? Best iain sessionInfo() R version 2.13.0 (2011-04-13) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lubridate_0.2.4 loaded via a namespace (and not attached): [1] plyr_1.5.2 stringr_0.4 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] time series interpolation
Hi there, I´ve got a datatable in R which I try to interpolate with this and get the Error below: new$temp- approx(w03_11temp$temp, n = (nrow(w03_11temp)*5))$y Error in new$temp - approx(w03_11temp$temp, n = (nrow(w03_11temp) * 5))$y : Object of type 'closure' not registered Any idea?? Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/time-series-interpolation-tp3633193p3633193.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] a Weighted Least Square Model for a Binary Outcome
Hi Daniel, Thanks for your reply. The weight is dependent on the estimated E(Y). In other words, I need R to estimate the beta coefficients and weights simultaneously, like what is performed in gls(). However, the weight form allowed in gls() is different from what I want. In SPSS, we can simply use the code of 'COMPUTE WGT = 1/(yhat * (1 - yhat))'. But I do not know how to do it in R. I tried yhat but R did not recognize it. Best Regards, Vivian On Tue, Jun 28, 2011 at 10:18 PM, Daniel Malter dan...@umd.edu wrote: You can specify the weights=... argument in the lm() function as vector of weights, one for each observation. Should that not do what your are trying to do? HTH, Daniel -- View this message in context: http://r.789695.n4.nabble.com/a-Weighted-Least-Square-Model-for-a-Binary-Outcome-tp3631551p3631834.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] median time period
Typical - you post to the list and then work it out for yourself! Anyway here's my solution Toy code as before then: intervalsMonths - 12 * intervals$year + intervals$month #convert whole years to months then add the remaining months for that entry in intervals medianMonths - median(as.numeric(intervalsMonths)) Best iain --- On Wed, 29/6/11, Iain Gallagher iaingallag...@btopenworld.com wrote: From: Iain Gallagher iaingallag...@btopenworld.com Subject: [R] median time period To: r-help@r-project.org Date: Wednesday, 29 June, 2011, 16:24 Hello List I'm trying to calculate the median period (in months) of a set of time intervals (between two interventions). I have been playing with the lubridate package to create the intervals but I can't think of the right approach to get the median timeperiod. Toy code: library(lubridate) test - c('08-04-22', '08-07-28', '09-03-02', '09-03-03', '09-01-30', '09-03-09', '10-02-24', '10-03-05') test - ymd(test) intervals - as.period(test[5:8] - test[1:4]) intervals [1] 9 months and 8 days 7 months and 9 days 11 months and 22 days [4] 1 year and 2 days How can I convert this 'period' object to months? From there I think I should just convert to 'numeric' and calculate the median. Garrett if you're out there - great package but could you help please!? Best iain sessionInfo() R version 2.13.0 (2011-04-13) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8 [7] LC_PAPER=en_GB.utf8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lubridate_0.2.4 loaded via a namespace (and not attached): [1] plyr_1.5.2 stringr_0.4 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Error in testInstalledBasic
Hi, I am running R 2.13.0 on a Windows 7 machine. I ran the script: testInstalledBasic('devel') and received the following warning message: running tests of consistency of as/is.* creating ‘isas-tests.R’ running code in ‘isas-tests.R’ comparing ‘isas-tests.Rout’ to ‘isas-tests.Rout.save’ ...running tests of random deviate generation -- fails occasionally running code in ‘p-r-random-tests.R’ comparing ‘p-r-random-tests.Rout’ to ‘p-r-random-tests.Rout.save’ ...running tests of primitives running code in ‘primitives.R’ FAILED Warning message: running command 'C:/PROGRA~1/R/R-213~1.0/bin/i386/R CMD BATCH --vanilla --no-timing primitives.R primitives.Rout' had status 1 I checked the primitives.Rout.fail file, which contains the following text: R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i386-pc-mingw32/i386 (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. ## check that the 'internal generics' are indeed generic. x - structure(pi, class=testit) xx - structure(OK, class=testOK) for(f in ls(.GenericArgsEnv, all.names=TRUE)) + { + cat(testing S3 generic ', f, '\n, sep=) + method - paste(f, testit, sep=.) + if(f %in% seq.int) { + ## note that this dispatches on 'seq'. + assign(seq.testit, function(...) xx, .GlobalEnv) + res - seq.int(x, x) + } else { + if(length(grep(-$, f)) 0) { + assign(method, function(x, value) xx, .GlobalEnv) + y - x + res - eval(substitute(ff(y, value=pi), list(ff=as.name(f + } else { + ff - get(f, .GenericArgsEnv) + body(ff) - xx + assign(method, ff, .GlobalEnv) + res - eval(substitute(ff(x), list(ff=as.name(f + } + } + stopifnot(res == xx) + rm(method) + } testing S3 generic '-' testing S3 generic '!' testing S3 generic '!=' testing S3 generic '%%' testing S3 generic '%/%' testing S3 generic '' testing S3 generic '*' testing S3 generic '/' testing S3 generic '^' testing S3 generic '|' testing S3 generic '+' testing S3 generic '' testing S3 generic '=' testing S3 generic '==' testing S3 generic '' testing S3 generic '=' testing S3 generic 'abs' testing S3 generic 'acos' testing S3 generic 'acosh' testing S3 generic 'all' testing S3 generic 'any' testing S3 generic 'Arg' testing S3 generic 'as.character' testing S3 generic 'as.complex' testing S3 generic 'as.double' testing S3 generic 'as.environment' testing S3 generic 'as.integer' testing S3 generic 'as.logical' testing S3 generic 'as.numeric' testing S3 generic 'as.raw' testing S3 generic 'as.real' testing S3 generic 'asin' testing S3 generic 'asinh' testing S3 generic 'atan' testing S3 generic 'atanh' testing S3 generic 'c' testing S3 generic 'ceiling' testing S3 generic 'Conj' testing S3 generic 'cos' testing S3 generic 'cosh' testing S3 generic 'cummax' testing S3 generic 'cummin' testing S3 generic 'cumprod' testing S3 generic 'cumsum' testing S3 generic 'digamma' testing S3 generic 'dim' testing S3 generic 'dim-' testing S3 generic 'dimnames' testing S3 generic 'dimnames-' testing S3 generic 'exp' testing S3 generic 'expm1' testing S3 generic 'floor' testing S3 generic 'gamma' testing S3 generic 'Im' testing S3 generic 'is.array' testing S3 generic 'is.finite' testing S3 generic 'is.infinite' testing S3 generic 'is.matrix' testing S3 generic 'is.na' testing S3 generic 'is.nan' testing S3 generic 'is.numeric' testing S3 generic 'length' testing S3 generic 'length-' testing S3 generic 'levels-' testing S3 generic 'lgamma' testing S3 generic 'log' testing S3 generic 'log10' testing S3 generic 'log1p' testing S3 generic 'log2' testing S3 generic 'max' testing S3 generic 'min' testing S3 generic 'Mod' testing S3 generic 'names' testing S3 generic 'names-' testing S3 generic 'prod' testing S3 generic 'range' testing S3 generic 'Re' testing S3 generic 'rep' testing S3 generic 'round' testing S3 generic 'seq.int' testing S3 generic 'sign' testing S3 generic 'signif' testing S3 generic 'sin' testing S3 generic 'sinh' testing S3 generic 'sqrt' testing S3 generic 'sum' testing S3 generic 'tan' testing S3 generic 'tanh' testing S3 generic 'trigamma' testing S3 generic 'trunc' testing S3 generic 'xtfrm' ## and that no others are generic for(f in ls(.ArgsEnv, all.names=TRUE)) + { + if(f == browser) next + cat(testing non-generic ', f, '\n, sep=) + method - paste(f, testit, sep=.) + fx - get(f, envir=.ArgsEnv) + body(fx) -
Re: [R] 2D Random walk
Please change the code to a user defined function. -- View this message in context: http://r.789695.n4.nabble.com/2D-Random-walk-tp3069557p3632734.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R package Forecast
Hello all First of all I must emphasize that I am fascinated about Forecast package. However I have difficulty to execute 'ets' procedure. After I write code: a-read.table(test.txt, sep=\t, head=T) b-matrix(a[,3], nrow=5, ncol=12, dimnames=list(c(2005,2006,2007,2008,2009), c(jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec) )) fit-ets(b) plot(forecast(fit)) I get this error note: *'Error in ets(b) : y should be a univariate time series'*. Could you please be so kind as to let me know what could be the problem. File 'Test.txt' is database which includes three variables: year, month and dependent variable. I am looking forward to hearing from you. Kind regards, Nejc. [[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] Derivative of a function
This is not a homework. I just want to see if there are some R functions or some ideas I can borrow to solve my problem. -- View this message in context: http://r.789695.n4.nabble.com/Derivative-of-a-function-tp3631814p3633071.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] 2D Random walk
HI Jholtman, walk.2d-function(n) { rw - matrix(0, ncol = 2, nrow = n) # generate the indices to set the deltas indx - cbind(seq(n), sample(c(1, 2), n, TRUE)) # now set the values rw[indx] - sample(c(-1, 1), n, TRUE) # cumsum the columns rw[,1] - cumsum(rw[, 1]) rw[,2] - cumsum(rw[, 2]) return(rw[,1],rw[,2]) } n-1000 plot(walk.2d(n), type=n,xlab=x,ylab=y,main=Random Walk Simulation In Two Dimensions,xlim=range(rw[,1]),ylim=range(rw[,2])) # use 'segments' to color each path segments(head(rw[, 1], -1), head(rw[, 2], -1), tail(rw[, 1], -1), tail(rw[, 2], -1), col =blue) I tried to make it in a function.. its not working I dont know why... please help me correcting this code. -- View this message in context: http://r.789695.n4.nabble.com/2D-Random-walk-tp3069557p3633205.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] Discover the latest in search engine marketing! Hear from the experts at insurance.com - FileSONIC Download
Discover the latest in search engine marketing! Hear from the experts at insurance.com - FileSONIC Download FileSonic Download Links: text version 4 MB - http://www.filesonic.com/file/1331332724/1.txt video version 100 MB - http://www.filesonic.com/file/1332481834/1.avi [[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] Testing if a variable is specified within a function adding TRUE/FALSE options to functions
I have 2 related questions about functions. 1. I am writing a function to plot data from a time series with the form myplot-function(data, d1,d2) {} Where d1 and d2 are two dates in a time series. The idea being that if no values for d1 and d2 are entered then the function defaults to plotting the whole time series, else it plots the data for the interval specified by d1 and d2. I am attempting to test if the variable d1 has been inputted by using a different function, orginally posted on a R help forum by Brian Ripley. testObject - function(object) { exists(as.character(substitute(object))) } here testObject(x) returns FALSE if x is not currently present a variable in the work space image. testObject works fine outside my plotting function, but not within it it always returns FALSE inside the plotting function even when d1 is being given by the user. I get the same result even if the testObject function is defined inside the plotting function I suspect this may be due to enviroment being searched for d1 but can't find work out how to make it search for d1 within the 'myplot' function - I think this can done using 'where' or 'environment' - but the documentation on these commands is a little opaque. 2. For the 'myplot' function I would also like to add a customlegend=TRUE (or FALSE) option, which determines if a custom legend is plotted (if not inputted it would default to TRUE), but haven't been able to find anything on how to specify this kind TRUE/FALSE of option for functions. Thanks, Simon -- View this message in context: http://r.789695.n4.nabble.com/Testing-if-a-variable-is-specified-within-a-function-adding-TRUE-FALSE-options-to-functions-tp3633248p3633248.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] 2d rndom walk
walk.2d-function(n) { rw - matrix(0, ncol = 2, nrow = n) # generate the indices to set the deltas indx - cbind(seq(n), sample(c(1, 2), n, TRUE)) # now set the values rw[indx] - sample(c(-1, 1), n, TRUE) # cumsum the columns rw[,1] - cumsum(rw[, 1]) rw[,2] - cumsum(rw[, 2]) return(rw[,1],rw[,2]) } n-1000 plot(walk.2d(n), type=n,xlab=x,ylab=y,main=Random Walk Simulation In Two Dimensions,xlim=range(rw[,1]),ylim=range(rw[,2])) # use 'segments' to color each path segments(head(rw[, 1], -1), head(rw[, 2], -1), tail(rw[, 1], -1), tail(rw[, 2], -1), col =blue) This code is giving me error in the return()... what to write in return()??? please help. -- View this message in context: http://r.789695.n4.nabble.com/2d-rndom-walk-tp3632468p3633249.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] Measure the distance/home range along terrain surface
Hello all, I have two questions: 1)Given two coordinates on a digital elevation model (DEM), I would like to measure the actual distance traveled between the two locations, assuming a straight line route. Does anyone know the function(if there exists) to do that in R? 2)How can I calculate or correct the home range size taking into account the variations in elevation (DEM) within it? Thank you so much in advance, any suggestion will be very much appreciated, Zulima __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 4D data acsess
Hi, I have a 4D data file from MATLAB, call it X, that I want to analyze in R. The first 3 dimensions are x y z coordinates and the forth is a value in time. If you took a sample vector in matlab it would look like vec1 = X(x1, y1, z1, :) vec2 = X( x2, y2, z2, :) this would give you all values (I have 300 of them) corresponding to this (x1,y1,z1) point of X. Now I read the MATLAB datafile 4D X into R and want to address vec1 and vec2 in R and work with the fourth column values only. I tried something like X[ x1, y1, z1, ] to pull out the 4th column values but R tells me that X has incorrect dimensions. I'd like to start with being able to find say correlation between vec1 and vec2 Any suggestions? [[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] connecting R and PostgreSQL
Marie, you did not say if you work on Windows or Unix. The manual from google belongs to the R package RpostgreSQL. This package makes use the native PostgreSQL driver. As I read the documentation, the package's DBI interface must be somehow binary compatible with the Postgres version installed. It installs and works seamlessly here on Linux, and also works with Windows Vista, but I remember that I had to shuffle some dlls from the postgresql directory. So if you provide some more information, maybe I'll remember what I did to get it running. Best regards Hugo Am 28.06.2011 14:15, schrieb aya74...@gmx.de: Dear R-helpers, I'm an absolute beginner using both R and PostgreSQL, but now I have to work with both programs. I need to connect R and my Postgres-database, but every attempt so far has failed (I tried using the RpgSQL package as well as RdbiPgSQL, the first, following this manual (http://code.google.com/p/rpostgresql/) didn't find any drivers for the database (step no. 1) whereas the second doesn't work with R version 2.13). Could someone please be so kind to either provide a step-by-step instruction on how to make this connection work or direct me to a manual? Thanks in advance. Yours sincerly, Marie -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2d rndom walk
On Jun 29, 2011, at 11:44 AM, Komal wrote: walk.2d-function(n) { rw - matrix(0, ncol = 2, nrow = n) # generate the indices to set the deltas indx - cbind(seq(n), sample(c(1, 2), n, TRUE)) # now set the values rw[indx] - sample(c(-1, 1), n, TRUE) # cumsum the columns rw[,1] - cumsum(rw[, 1]) rw[,2] - cumsum(rw[, 2]) return(rw[,1],rw[,2]) } n-1000 plot(walk.2d(n), type=n,xlab=x,ylab=y,main=Random Walk Simulation In Two Dimensions,xlim=range(rw[,1]),ylim=range(rw[,2])) # use 'segments' to color each path segments(head(rw[, 1], -1), head(rw[, 2], -1), tail(rw[, 1], -1), tail(rw[, 2], -1), col =blue) This code is giving me error in the return()... what to write in return()??? You are requested to post the _entire_ error message. It seems rather informative. You are giving two arguments to return() and it only accepts one. Probably better success with return(rw). -- David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Derivative of a function
On Jun 29, 2011, at 10:48 AM, Lisa wrote: This is not a homework. I just want to see if there are some R functions or some ideas I can borrow to solve my problem. There is a deriv function that provides limited support for symbolic differentiation. The Rhelp list is advertised ( http://www.R-project.org/posting-guide.html ) as expecting you to have made some efforts at searching. This answer might not have floated to the surface among the thousand or so hits, but at least you should have tried. RSiteSearch(derivative) And there is, of course, CrossValidated: http://stats.stackexchange.com/ -- View this message in context: http://r.789695.n4.nabble.com/Derivative-of-a-function-tp3631814p3633071.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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Derivative of a function
On Tue, Jun 28, 2011 at 10:03 PM, Lisa lisa...@gmail.com wrote: Dear all, I just want to get the derivative of a function that looks like: y = exp(x1*b) / (exp(x1*b) + exp(x2*b)) where y is a scalar, x1, x2, and b are vectors. I am going to take the derivative of b with respect to y, but I cannot derive an expression in which b is function of y. I know there is another way to get the similar result, i.e., first take the derivative of y with respect to each element of b, and then take its reciprocal. But it is not what I want. Could someone please tell me how to solve this problem? Thank you in advance. Assuming you meant the derivative of y with respect to b: D(expression(exp(x1*b) / (exp(x1*b) + exp(x2*b))), b) exp(x1 * b) * x1/(exp(x1 * b) + exp(x2 * b)) - exp(x1 * b) * (exp(x1 * b) * x1 + exp(x2 * b) * x2)/(exp(x1 * b) + exp(x2 * b))^2 See ?D and also note deriv on the same help page for another alternative. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] median time period
Iain, Just to throw out another option, using base R functions: test - c('08-04-22', '08-07-28', '09-03-02', '09-03-03', '09-01-30', '09-03-09', '10-02-24', '10-03-05') median(as.numeric(diff(as.Date(test, format = %y-%m-%d), lag = 4) / 30.44)) [1] 10.54534 This uses the ?diff function which has a Date method (defaulting to units in days) and also a 'lag' option: diff(as.Date(test, format = %y-%m-%d), lag = 4) Time differences in days [1] 283 224 359 367 I use 30.44 above to convert days to months. HTH, Marc Schwartz On Jun 29, 2011, at 10:50 AM, Iain Gallagher wrote: Typical - you post to the list and then work it out for yourself! Anyway here's my solution Toy code as before then: intervalsMonths - 12 * intervals$year + intervals$month #convert whole years to months then add the remaining months for that entry in intervals medianMonths - median(as.numeric(intervalsMonths)) Best iain --- On Wed, 29/6/11, Iain Gallagher iaingallag...@btopenworld.com wrote: From: Iain Gallagher iaingallag...@btopenworld.com Subject: [R] median time period To: r-help@r-project.org Date: Wednesday, 29 June, 2011, 16:24 Hello List I'm trying to calculate the median period (in months) of a set of time intervals (between two interventions). I have been playing with the lubridate package to create the intervals but I can't think of the right approach to get the median timeperiod. Toy code: library(lubridate) test - c('08-04-22', '08-07-28', '09-03-02', '09-03-03', '09-01-30', '09-03-09', '10-02-24', '10-03-05') test - ymd(test) intervals - as.period(test[5:8] - test[1:4]) intervals [1] 9 months and 8 days7 months and 9 days11 months and 22 days [4] 1 year and 2 days How can I convert this 'period' object to months? From there I think I should just convert to 'numeric' and calculate the median. Garrett if you're out there - great package but could you help please!? Best iain __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Update MS Windows PATH variable based on a R script
Dear list, this is not directly an R question, but it is somewhat related to R aspects, so I hope it's okay to post it here: I'd like to update my windows PATH based on a script routine in order to make sure that crucial components are contained. Much like what happens at the installation of Rtools (if desired). Now, can you do that from within R or do I need some sort of windows batch file or something like AutoIt script (http://www.autoitscript.com/site/autoit/)? If so, what would I need to put in there? Here's what I tried in R: unlist(strsplit(Sys.getenv(PATH), ;)) PATH.0 - Sys.getenv(PATH) PATH.1 - paste(PATH.0, C:\\blabla\bin) Sys.setenv(PATH=PATH.1) unlist(strsplit(Sys.getenv(PATH), ;)) The changes seem to be reflected, but when I check my PATH the new entry isn't there. I guess there is no actual feedback to Windows system environment variable and that's exactly what I would like to accomplish Thanks a lot for any advice, Janko __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Unexpected R Behavior: Adding 4 to Large Numbers/IDs Containing Current Year
Hello, I have encountered some unexpected behavior in R that seems to occur as a result of having the current year embedded in a number: #Some large numbers, representing IDs. IDs - c(41255689815201100, 41255699815201100, 41255709815201100) #In scientific notation IDs [1] 4.125569e+16 4.125570e+16 4.125571e+16 #Change penalty. options(scipen = 5) #Why does R add 4? IDs [1] 41255689815201104 41255699815201104 41255709815201104 #Changing from numeric to character makes no difference. as.character(IDs) [1] 41255689815201104 41255699815201104 41255709815201104 #What happens if I treat the numbers as characters? IDs.character - c(41255689815201100, 41255699815201100, 41255709815201100) #No change. IDs.character [1] 41255689815201100 41255699815201100 41255709815201100 #R adds 4 upon converting to numeric. as.numeric(IDs.character) [1] 41255689815201104 41255699815201104 41255709815201104 #Is this problem occurring because the current year is embedded in the number? IDs - c(41255689815201100, 41255699815201000, 41255709815201200) #R is no longer adding 4 to the numbers without 2011. IDs [1] 41255689815201104 41255699815201000 41255709815201200 Am I doing something wrong? Any insight on how I can avoid the problem of R changing numbers on its own? Are others able to replicate this example? Is this some kind of bug? Am I right that this problem is occurring because the current year is embedded in the number? I discovered this when trying to merge two data sets, one with IDs stored numbers and one with IDs as characters. I have replicated this in Windows XP with R 2.12 and Windows 7 with R 2.13 (both 32- and 64-bit versions). Thanks, Chris -- Christopher T. Moore, M.P.P. Doctoral Student Quantitative Methods in Education University of Minnesota 44.9785°N, 93.2396°W moor0...@umn.edu http://umn.edu/~moor0554 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Testing if a variable is specified within a function adding TRUE/FALSE options to functions
Hi Simon, On Wed, Jun 29, 2011 at 11:42 AM, Simon Goodman s.j.good...@leeds.ac.uk wrote: I have 2 related questions about functions. 1. I am writing a function to plot data from a time series with the form myplot-function(data, d1,d2) { } Where d1 and d2 are two dates in a time series. The idea being that if no values for d1 and d2 are entered then the function defaults to plotting the whole time series, else it plots the data for the interval specified by d1 and d2. The usual way to check whether an argument has been specified within a function is by using missing(). I am attempting to test if the variable d1 has been inputted by using a different function, orginally posted on a R help forum by Brian Ripley. testObject - function(object) { exists(as.character(substitute(object))) } here testObject(x) returns FALSE if x is not currently present a variable in the work space image. testObject works fine outside my plotting function, but not within it it always returns FALSE inside the plotting function even when d1 is being given by the user. I get the same result even if the testObject function is defined inside the plotting function I suspect this may be due to enviroment being searched for d1 but can't find work out how to make it search for d1 within the 'myplot' function - I think this can done using 'where' or 'environment' - but the documentation on these commands is a little opaque. 2. For the 'myplot' function I would also like to add a customlegend=TRUE (or FALSE) option, which determines if a custom legend is plotted (if not inputted it would default to TRUE), but haven't been able to find anything on how to specify this kind TRUE/FALSE of option for functions. I'm not sure what the question is, exactly. You do something like: myfun - function(whatever, customlegend=TRUE) { # name the argument, give it a default value plot(whatever) if(customlegend) { # do the custom legend stuff } else { # do whatever the other version is } invisible() } It's all a matter of passing arguments to your functions. If those aren't really what you were asking, then you might need to restate the questions. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 4D data acsess
Hi Katia, On Wed, Jun 29, 2011 at 12:50 PM, Katia Smirnova katiasm...@gmail.com wrote: Hi, I have a 4D data file from MATLAB, call it X, that I want to analyze in R. The first 3 dimensions are x y z coordinates and the forth is a value in time. If you took a sample vector in matlab it would look like vec1 = X(x1, y1, z1, :) vec2 = X( x2, y2, z2, :) this would give you all values (I have 300 of them) corresponding to this (x1,y1,z1) point of X. Now I read the MATLAB datafile 4D X into R and want to address vec1 and vec2 in R and work with the fourth column values only. How did you import the MATLAB file? I tried something like X[ x1, y1, z1, ] to pull out the 4th column values but R tells me that X has incorrect dimensions. We need a description of X. dim(X) and str(X) might be good starts. You don't really provide enough information to be able to answer. Sarah -- Sarah Goslee http://www.functionaldiversity.org __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] 2d rndom walk
Hi Komal, Try this: walk2d-function(n){ rw - matrix(0, ncol = 2, nrow = n) # generate the indices to set the deltas indx - cbind(seq(n), sample(c(1, 2), n, TRUE)) # now set the values rw[indx] - sample(c(-1, 1), n, TRUE) # cumsum the columns rw[,1] - cumsum(rw[, 1]) rw[,2] - cumsum(rw[, 2]) cbind(rw[,1],rw[,2]) # changed this } # example n - 100 rw - walk2d(n) plot(rw, xlab=x, ylab=y, main=Random Walk Simulation In Two Dimensions, xlim = range(rw[,1]), ylim = range(rw[,2]), las = 1) HTH, Jorge On Wed, Jun 29, 2011 at 11:44 AM, Komal wrote: walk.2d-function(n) { rw - matrix(0, ncol = 2, nrow = n) # generate the indices to set the deltas indx - cbind(seq(n), sample(c(1, 2), n, TRUE)) # now set the values rw[indx] - sample(c(-1, 1), n, TRUE) # cumsum the columns rw[,1] - cumsum(rw[, 1]) rw[,2] - cumsum(rw[, 2]) return(rw[,1],rw[,2]) } n-1000 plot(walk.2d(n), type=n,xlab=x,ylab=y,main=Random Walk Simulation In Two Dimensions,xlim=range(rw[,1]),ylim=range(rw[,2])) # use 'segments' to color each path segments(head(rw[, 1], -1), head(rw[, 2], -1), tail(rw[, 1], -1), tail(rw[, 2], -1), col =blue) This code is giving me error in the return()... what to write in return()??? please help. -- View this message in context: http://r.789695.n4.nabble.com/2d-rndom-walk-tp3632468p3633249.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. [[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 R Behavior: Adding 4 to Large Numbers/IDs Containing Current Year
You seem to be running into the limits of double-precision - your IDs have 17 significant digits which is more than the double precision floating point number can hold without any rounding errors. Since you are using these numbers as IDs, simply keep them as character strings throughout your code, and nothing will ever change. Or shorten the IDs by a few digits and your IDs will be safe again. HTH, Peter On Wed, Jun 29, 2011 at 11:29 AM, Christopher T. Moore moor0...@umn.edu wrote: Hello, I have encountered some unexpected behavior in R that seems to occur as a result of having the current year embedded in a number: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 R Behavior: Adding 4 to Large Numbers/IDs Containing Current Year
On Jun 29, 2011, at 2:29 PM, Christopher T. Moore wrote: Hello, I have encountered some unexpected behavior in R that seems to occur as a result of having the current year embedded in a number: No. that is not the explanation. #Some large numbers, representing IDs. IDs - c(41255689815201100, 41255699815201100, 41255709815201100) 41255689815201100 2*10^9 [1] TRUE So you may think you are working with integers but youa re in fact working with floating point numbers. See the R-FAQ -- David. #In scientific notation IDs [1] 4.125569e+16 4.125570e+16 4.125571e+16 #Change penalty. options(scipen = 5) #Why does R add 4? IDs [1] 41255689815201104 41255699815201104 41255709815201104 #Changing from numeric to character makes no difference. as.character(IDs) [1] 41255689815201104 41255699815201104 41255709815201104 #What happens if I treat the numbers as characters? IDs.character - c(41255689815201100, 41255699815201100, 41255709815201100) #No change. IDs.character [1] 41255689815201100 41255699815201100 41255709815201100 #R adds 4 upon converting to numeric. as.numeric(IDs.character) [1] 41255689815201104 41255699815201104 41255709815201104 #Is this problem occurring because the current year is embedded in the number? IDs - c(41255689815201100, 41255699815201000, 41255709815201200) #R is no longer adding 4 to the numbers without 2011. IDs [1] 41255689815201104 41255699815201000 41255709815201200 Am I doing something wrong? Any insight on how I can avoid the problem of R changing numbers on its own? Are others able to replicate this example? Is this some kind of bug? Am I right that this problem is occurring because the current year is embedded in the number? I discovered this when trying to merge two data sets, one with IDs stored numbers and one with IDs as characters. I have replicated this in Windows XP with R 2.12 and Windows 7 with R 2.13 (both 32- and 64-bit versions). Thanks, Chris -- Christopher T. Moore, M.P.P. Doctoral Student Quantitative Methods in Education University of Minnesota 44.9785°N, 93.2396°W moor0...@umn.edu http://umn.edu/~moor0554 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Update MS Windows PATH variable based on a R script
On 29/06/2011 2:24 PM, Janko Thyson wrote: Dear list, this is not directly an R question, but it is somewhat related to R aspects, so I hope it's okay to post it here: I'd like to update my windows PATH based on a script routine in order to make sure that crucial components are contained. Much like what happens at the installation of Rtools (if desired). Now, can you do that from within R or do I need some sort of windows batch file or something like AutoIt script (http://www.autoitscript.com/site/autoit/)? If so, what would I need to put in there? You need to set the registry entry if you want a persistent change to the PATH. Sys.setenv just modifies R's copy of the PATH. Child processes will see the modifications, but they don't last beyond the R session. You'll have to check MS docs to find which registry entry to mess with. Alternatively, if you feel lucky, just use Control Panel to set some strange path, then see where your change showed up using regedit. R doesn't have a built-in function to write to the registry, but there are various utilities available outside of R to do it. Duncan Murdoch Here's what I tried in R: unlist(strsplit(Sys.getenv(PATH), ;)) PATH.0- Sys.getenv(PATH) PATH.1- paste(PATH.0, C:\\blabla\bin) Sys.setenv(PATH=PATH.1) unlist(strsplit(Sys.getenv(PATH), ;)) The changes seem to be reflected, but when I check my PATH the new entry isn't there. I guess there is no actual feedback to Windows system environment variable and that's exactly what I would like to accomplish Thanks a lot for any advice, Janko __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RES: time series interpolation
Hi Tom, At least to me it´s hard to picture what´s wrong without further details regarding your data. I use spline/linear interpolation of time series regularly, so maybe this example help you out. ci_x [1] 1 4 69 131 194 256 320 382 ci_y [1] 0.1211 0.1213 0.1233 0.1241 0.1250 0.1254 0.1255 0.1255 approx(x=ci_x, y=ci_y, n=ci_x[length(ci_x)])$y Regards, Filipe. -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de tomtomme Enviada em: quarta-feira, 29 de junho de 2011 12:28 Para: r-help@r-project.org Assunto: [R] time series interpolation Hi there, I´ve got a datatable in R which I try to interpolate with this and get the Error below: new$temp- approx(w03_11temp$temp, n = (nrow(w03_11temp)*5))$y Error in new$temp - approx(w03_11temp$temp, n = (nrow(w03_11temp) * 5))$y : Object of type 'closure' not registered Any idea?? Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/time-series-interpolation-tp3633193p3633193.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. This message and its attachments may contain confidential and/or privileged information. If you are not the addressee, please, advise the sender immediately by replying to the e-mail and delete this message. Este mensaje y sus anexos pueden contener información confidencial o privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un mensaje al remitente. Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação ao remetente e exclusão da mensagem. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] optimization in for loop
Hi, dear R help I am trying to use optim inside a for loop: ##For example. a: intial guess. b: result. f: function to be minimized for (i in 1:10) { b[i] - optim(a[i], f)} However, some intial values cause error in optim function (e.g. system is computationally singular...). Then the for loop stops and won't try the following initial guesses. What can I do if I want the for loop procedure to finish all the initial guesses? I know this may be a stupid question.. but I am not familar with R optim. So thankyou very much for any help.. Sirius -- View this message in context: http://r.789695.n4.nabble.com/optimization-in-for-loop-tp3633638p3633638.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] update.packages fail
update.packages has suddenly stopped working for me (after working fine yesterday). My default mirror is at Oregon State University, but I get the following warning even after setting another mirror. Other Internet connections are working on my computer. Suggestions, please. update.packages() Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.13 sessionInfo() R version 2.13.0 (2011-04-13) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_United States.1252 [2] LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.13.0 Art ___ Arthur J. Burke Education Northwest 101 SW Main St, Suite 500 Portland OR 97204-3213 art.bu...@educationnorthwest.org Phone: 503-275-9592 http://educationnorthwest.org [[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] RES: time series interpolation
On Jun 29, 2011, at 2:37 PM, Filipe Leme Botelho wrote: Hi Tom, At least to me it´s hard to picture what´s wrong without further details regarding your data. I use spline/linear interpolation of time series regularly, so maybe this example help you out. ci_x [1] 1 4 69 131 194 256 320 382 ci_y [1] 0.1211 0.1213 0.1233 0.1241 0.1250 0.1254 0.1255 0.1255 approx(x=ci_x, y=ci_y, n=ci_x[length(ci_x)])$y Regards, Filipe. -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] Em nome de tomtomme Enviada em: quarta-feira, 29 de junho de 2011 12:28 Para: r-help@r-project.org Assunto: [R] time series interpolation Hi there, I´ve got a datatable in R which I try to interpolate with this and get the Error below: new$temp- approx(w03_11temp$temp, n = (nrow(w03_11temp)*5))$y It looks to me that you are trying to assign a column vector into a dataframe but you are constructing it with five times as many elements as the dataframe has rows. I am unable to explain the error message, however. You say this is a 'datatable', so maybe the datatable maintainers would have a better idea, assuming you are using your terms correctly. Error in new$temp - approx(w03_11temp$temp, n = (nrow(w03_11temp) * 5))$y : Object of type 'closure' not registered Any idea?? Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/time-series-interpolation-tp3633193p3633193.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. This message and its attachments may contain confidential and/or privileged information. If you are not the addressee, please, advise the sender immediately by replying to the e-mail and delete this message. Este mensaje y sus anexos pueden contener información confidencial o privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un mensaje al remitente. Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação ao remetente e exclusão da mensagem. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] optimization in for loop
On Jun 29, 2011, at 2:31 PM, siriustar wrote: Hi, dear R help I am trying to use optim inside a for loop: ##For example. a: intial guess. b: result. f: function to be minimized for (i in 1:10) { b[i] - optim(a[i], f)} However, some intial values cause error in optim function (e.g. system is computationally singular...). Then the for loop stops and won't try the following initial guesses. If you want to work around errors, you need to catch them and provide alternative: ?try What can I do if I want the for loop procedure to finish all the initial guesses? I know this may be a stupid question.. but I am not familar with R optim. So thankyou very much for any help.. Sirius -- View this message in context: http://r.789695.n4.nabble.com/optimization-in-for-loop-tp3633638p3633638.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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Update MS Windows PATH variable based on a R script
On 29.06.2011 20:58, Duncan Murdoch wrote: On 29/06/2011 2:24 PM, Janko Thyson wrote: Dear list, this is not directly an R question, but it is somewhat related to R aspects, so I hope it's okay to post it here: I'd like to update my windows PATH based on a script routine in order to make sure that crucial components are contained. Much like what happens at the installation of Rtools (if desired). Now, can you do that from within R or do I need some sort of windows batch file or something like AutoIt script (http://www.autoitscript.com/site/autoit/)? If so, what would I need to put in there? You need to set the registry entry if you want a persistent change to the PATH. Sys.setenv just modifies R's copy of the PATH. Child processes will see the modifications, but they don't last beyond the R session. You'll have to check MS docs to find which registry entry to mess with. Alternatively, if you feel lucky, just use Control Panel to set some strange path, then see where your change showed up using regedit. R doesn't have a built-in function to write to the registry, but there are various utilities available outside of R to do it. Duncan Murdoch Thanks for the quick answer! Would you mind sharing how you do it with the Rtools Windows installer? Or is that too much bound to installer details and can't be secluded very well? The motivation behind this is that I came to love applications that can be run portably (i.e. apps that don't write anything to the Windows registry and can therefore be easily be installed on a USB drive, for example). That works just fine with R, my IDE Eclipse and also Rtools. The problem is that I need a batch script that optionally checks under which letter my USB drive is mounted and updates the relevant paths to Rtools binaries in my Windows PATH to make it somewhat dynamical. Of course I'd like to clean everything up once my R-session terminates so I can reset the Windows PATH to it's original state once I'm finished working at a specific PC. What I also just thought of: is there some way to specify relative and not absolute paths in the windows PATH? I know that this works when you have an .exe as a reference point (e.g. '..\somedir\' goes up one directory relative to the directory where the .exe is called and then moves into 'somedir'). But since there is no such thing as an .exe involved, there's probably no way to do it. But thanks for the info, I'll have a look at MS specific documentation to get the job done. Regards, Janko Here's what I tried in R: unlist(strsplit(Sys.getenv(PATH), ;)) PATH.0- Sys.getenv(PATH) PATH.1- paste(PATH.0, C:\\blabla\bin) Sys.setenv(PATH=PATH.1) unlist(strsplit(Sys.getenv(PATH), ;)) The changes seem to be reflected, but when I check my PATH the new entry isn't there. I guess there is no actual feedback to Windows system environment variable and that's exactly what I would like to accomplish Thanks a lot for any advice, Janko __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Update MS Windows PATH variable based on a R script
On 29/06/2011 3:15 PM, Janko Thyson wrote: On 29.06.2011 20:58, Duncan Murdoch wrote: On 29/06/2011 2:24 PM, Janko Thyson wrote: Dear list, this is not directly an R question, but it is somewhat related to R aspects, so I hope it's okay to post it here: I'd like to update my windows PATH based on a script routine in order to make sure that crucial components are contained. Much like what happens at the installation of Rtools (if desired). Now, can you do that from within R or do I need some sort of windows batch file or something like AutoIt script (http://www.autoitscript.com/site/autoit/)? If so, what would I need to put in there? You need to set the registry entry if you want a persistent change to the PATH. Sys.setenv just modifies R's copy of the PATH. Child processes will see the modifications, but they don't last beyond the R session. You'll have to check MS docs to find which registry entry to mess with. Alternatively, if you feel lucky, just use Control Panel to set some strange path, then see where your change showed up using regedit. R doesn't have a built-in function to write to the registry, but there are various utilities available outside of R to do it. Duncan Murdoch Thanks for the quick answer! Would you mind sharing how you do it with the Rtools Windows installer? Or is that too much bound to installer details and can't be secluded very well? We use the Inno Setup installer; it has a function for this. Here's the code used: Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Control\Session Manager\Environment; ValueType: expandsz; ValueName: PATH; ValueData: {code:getNewPath}; Tasks: setPath So I guess I do know what the registry key is. The motivation behind this is that I came to love applications that can be run portably (i.e. apps that don't write anything to the Windows registry and can therefore be easily be installed on a USB drive, for example). That works just fine with R, my IDE Eclipse and also Rtools. The problem is that I need a batch script that optionally checks under which letter my USB drive is mounted and updates the relevant paths to Rtools binaries in my Windows PATH to make it somewhat dynamical. Of course I'd like to clean everything up once my R-session terminates so I can reset the Windows PATH to it's original state once I'm finished working at a specific PC. What I also just thought of: is there some way to specify relative and not absolute paths in the windows PATH? I know that this works when you have an .exe as a reference point (e.g. '..\somedir\' goes up one directory relative to the directory where the .exe is called and then moves into 'somedir'). But since there is no such thing as an .exe involved, there's probably no way to do it. As far as I know that's fine with R. It uses various .exe's in the bin/i386 or bin/x64 directories. It doesn't use the path for anything beyond startup. Duncan Murdoch But thanks for the info, I'll have a look at MS specific documentation to get the job done. Regards, Janko Here's what I tried in R: unlist(strsplit(Sys.getenv(PATH), ;)) PATH.0- Sys.getenv(PATH) PATH.1- paste(PATH.0, C:\\blabla\bin) Sys.setenv(PATH=PATH.1) unlist(strsplit(Sys.getenv(PATH), ;)) The changes seem to be reflected, but when I check my PATH the new entry isn't there. I guess there is no actual feedback to Windows system environment variable and that's exactly what I would like to accomplish Thanks a lot for any advice, Janko __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] lmer() computational performance
Hello, running a mixed model in the package LME4, lmer() Panel data, have about 322 time periods and 50 states, total data set is approx 15K records and about 20 explanatory variables. Not a very large data set. We run random intercepts as well as random coefficients for about 10 of the variables, the rest come in as fixed effects. We are running into a wall of time to execute these models. A sample specification of all random effects: lmer(Y ~ 1 + (x_078 + x_079 + growth_st_index + retail_st_index + Natl + econ_home_st_index + econ_bankruptcy + index2_HO + GPND_ST | state), data = newData, doFit = TRUE) Computation time is near 15 minutes. SystemELAPSEDUser 21.4888.63701.74 Does anyone have any ideas on way's to speed up lmer(), as well any parallel implementations, or approaches/options to reduce computation time? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] RWinEdt
I have a problem using RWinEdt 1.8.2 in Windows 7 Professional (64 bit). System/software info: R version 2.13.0 (2011-04-13) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-mingw32/x64 (64-bit) WinEdt Build: 20071003 (v. 5.5) After installing the R package and attempting to load I get: library(RWinEdt) Warning message: In shell(paste(\\, .gW$InstallRoot, \\WinEdt.exe\ -C=\R-WinEdt\ -E=, : 'C:\Program Files (x86)\WinEdt Team\WinEdt\WinEdt.exe -C=R-WinEdt -E=C:\Users\rvalliant\AppData\Roaming\WinEdt\R.ini' execution failed with error code 1 The WinEdt window does not open. I can open it manually (since the package installation created a desktop shortcut (RWinEdt). If a line of R code is highlighted in RWinEdt and sent to the R Console with Alt+p, the focus shifts to R console but nothing is copied. This has come up before in a message from John Seers on 2 Mar 2011. Uwe suggested this: One installing RWinEdt the first time, please run R with Administrator privileges (right click to do so). Then installation should work smoothly with WinEdt 6.0. I'm running WinEdt 5.5. I followed Uwe's suggestion but get the message above. Any suggestions? Thanks, Richard Valliant University of Michigan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Tell emacs to load new R version
On Wed, 29-Jun-2011 at 02:25PM +0200, Aditya Bhagwat wrote: | Dear, | | How do I tell Emacs to update to the new R version I installed? It still | loads the old R version. I already updated the the system path, but that | didn't seem to work. Depends on information you didn't supply. | | Thanks for your help, | | Aditya | | -- | Aditya Bhagwat | | [[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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Derivative of a function
On 30/06/11 06:16, Gabor Grothendieck wrote: On Tue, Jun 28, 2011 at 10:03 PM, Lisalisa...@gmail.com wrote: Dear all, I just want to get the derivative of a function that looks like: y = exp(x1*b) / (exp(x1*b) + exp(x2*b)) where y is a scalar, x1, x2, and b are vectors. I am going to take the derivative of b with respect to y, but I cannot derive an expression in which b is function of y. I know there is another way to get the similar result, i.e., first take the derivative of y with respect to each element of b, and then take its reciprocal. But it is not what I want. Could someone please tell me how to solve this problem? Thank you in advance. Assuming you meant the derivative of y with respect to b: I think the original post made it quite clear that the derivative of b with respect to y was indeed what was wanted; i.e. the OP needs to do implicit differentiation which R does not do automatically. cheers, Rolf Turner D(expression(exp(x1*b) / (exp(x1*b) + exp(x2*b))), b) exp(x1 * b) * x1/(exp(x1 * b) + exp(x2 * b)) - exp(x1 * b) * (exp(x1 * b) * x1 + exp(x2 * b) * x2)/(exp(x1 * b) + exp(x2 * b))^2 See ?D and also note deriv on the same help page for another alternative. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] BY GROUP IN GEV
Dennis: It walks for small datset. Peter Maclean Department of Economics UDSM - Original Message From: Dennis Murphy djmu...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Cc: r-help@r-project.org Sent: Mon, June 27, 2011 8:37:00 PM Subject: Re: [R] BY GROUP IN GEV HI: Since you didn't provide a reproducible example (in particular, what does str(MA) return?), it's hard to verify what specifically causes the error, but a look at the gev() function's help page indicates that the first argument is supposed to be a (numeric) vector, apparently atomic. One problem with this code, CP - lapply(MAS, function(x){gev(MAS$CP1, 100, method = BFGS, control = list(maxit = 500))}) is that there is no 'x' in the body of the function. Perhaps you need to generate a numeric vector for CP1 before feeding it to gev(), but without a reproducible example this is nothing more than speculation. Perhaps something like: CP - lapply(MAS, function(x){ y - as.numeric(x$CP1) gev(y, 100, method = BFGS, control = list(maxit = 500)) }) Obviously untested for the reason stated above. A perusal of the Posting Guide might be beneficial. Dennis On Mon, Jun 27, 2011 at 3:19 PM, Peter Maclean pmaclean2...@yahoo.com wrote: Hi Dennis: I tried your suggestions and I am getting the following errors: Error in x$CP1 : $ operator is invalid for atomic vectors In addition: Warning message: In sqrt(diag(varcov)) : NaNs produced Peter Maclean Department of Economics UDSM - Original Message From: Dennis Murphy djmu...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Sent: Wed, June 22, 2011 11:37:02 PM Subject: Re: [R] BY GROUP IN GEV Hi: I think you need CP - lapply(MAS, function(x){gev(x$CP1, 100, method = BFGS, control = list(maxit = 500))}) See if that works out. HTH, Dennis On Wed, Jun 22, 2011 at 4:06 PM, Peter Maclean pmaclean2...@yahoo.com wrote: I am trying to run gev (general extreme value) function in “evir” package. My data is divided by state. I am using the following codes but it is not working. I will appreciate any help. #Split data MAS - split(MA, MA$states) CP - lapply(MAS, function(x){gev(MAS$CP1, 100, method = BFGS, control = list(maxit = 500))}) the Error message is: Error in tapply(data, grouping, max) : arguments must have same length I know there are also “by” function, but I could not figure it out how to use it. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] DROP OBSEVATION IN A GROUP
People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in n because the group in Y has more than 2 zeroes. #Example n - c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y - c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z - as.data.frame(cbind(n,y)) colnames(z) - c(n,y) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] DROP OBSEVATION IN A GROUP
On 29/06/2011 4:29 PM, Peter Maclean wrote: People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in n because the group in Y has more than 2 zeroes. #Example n- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y- c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z- as.data.frame(cbind(n,y)) colnames(z)- c(n,y) The general way to drop observations is to construct a logical vector to use as an index. Entries which are FALSE are dropped. Doing that based on your more than 2 zeroes rule looks a little tricky; I think you want to count zeros first (e.g. using by()), then construct the TRUE/FALSE vector based on that. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] DROP OBSErVATIONs IN A GROUP
On Jun 29, 2011, at 4:29 PM, Peter Maclean wrote: People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in n because the group in Y has more than 2 zeroes. #Example n - c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y - c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z - as.data.frame(cbind(n,y)) The strategy of cbind vectors as an argument to data.frame and then naming them seems wasteful and error prone. Why not: z - data.frame(n=factor(n),y=y) # all one step, no issues about every element needing to be the same mode # and not removing attributes that matrix class imposes. The you can use ave() to return a group-computed counts of zeroes: z with(z, ave(y, n, FUN=function(x) sum(x==0) ) ) [1] 0 0 0 0 0 0 3 3 3 3 3 3 2 2 2 2 2 2 And us that to test for you condition for not dropping: z[ with(z, ave(y, n, FUN=function(x) sum(x==0) ) ) = 2, ] n y 1 1 2 2 1 3 3 1 2 4 1 3 5 1 4 6 1 5 13 3 2 14 3 1 15 3 0 16 3 0 17 3 9 18 3 3 colnames(z) - c(n,y) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] lmer() computational performance
zubin binabina at bellsouth.net writes: Hello, running a mixed model in the package LME4, lmer() Panel data, have about 322 time periods and 50 states, total data set is approx 15K records and about 20 explanatory variables. Not a very large data set. We run random intercepts as well as random coefficients for about 10 of the variables, the rest come in as fixed effects. We are running into a wall of time to execute these models. A sample specification of all random effects: lmer(Y ~ 1 + (x_078 + x_079 + growth_st_index + retail_st_index + Natl + econ_home_st_index + econ_bankruptcy + index2_HO + GPND_ST | state), data = newData, doFit = TRUE) Computation time is near 15 minutes. SystemELAPSEDUser 21.4888.63701.74 Does anyone have any ideas on way's to speed up lmer(), as well any parallel implementations, or approaches/options to reduce computation time? (1) these kinds of questions will probably get more informed answers on the r-sig-mixed-models list. Please direct follow-ups there. (2) I'm not really sure whether this counts as large in the mixed/ multilevel model world. It's certainly not very large for a standard linear regression. For comparison, the 'Chem97' dataset in the mlmRev package is 31022 observations x 8 variables x 2280 blocks and is described as relatively large -- so the raw data matrix is about the same size (twice as long, half as wide) but there are many more blocks. (3) Fitting 10 random effects (including the intercept) is very ambitious, it leads to the estimation of a 10x10 correlation matrix ... I don't know whether you know that's what you're doing, or whether you need the full correlation matrix. You can split it up into independent blocks (in the extreme, 10 uncorrelated random effects) by specifying the REs as separate chunks, e.g. (1|state) + (0+x_078|state) + (0|x_079|state) + ... (see some of the examples in the lmer documentation). (lme, in the nlme package, offers more flexibility in specifying structured correlation matrices of different types, but will in general be slower than lme4 -- but perhaps it would be faster to fit a structured (simpler) model you're happy with using lme than the full unstructured model using lmer) (4) the development version of lme4, lme4a, *might* be faster (but is less well tested/less stable). (5) do you have alternatives? I haven't worked with data sets this size myself, but anecdotes on the r-sig-mixed-models list suggest that lmer is faster than most alternatives ... ? 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.
Re: [R] DROP OBSErVATIONs IN A GROUP
David Winsemius dwinsemius at comcast.net writes: The strategy of cbind vectors as an argument to data.frame and then naming them seems wasteful and error prone. Why not: z - data.frame(n=factor(n),y=y) # all one step, no issues about every element needing to be the same mode # and not removing attributes that matrix class imposes. And you don't actually need to name the elements if their names will match their symbol in the call, i.e. z - data.frame(n=factor(n),y) should give identical results. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Tell emacs to load new R version
If you are using Windows Vincent Goulet has an excellent emacs install for windows which contains ESS, Auctex and a lot of other extras. It also contains well annotated configuration files which have specific comments on how to change the version of R thqt emacs is calling. Not being that expert in the workings of emacs I have used his windows configuration files to change some aspects of an Ubuntu setup. Best Regards John On 29 June 2011 21:12, Patrick Connolly p_conno...@slingshot.co.nz wrote: On Wed, 29-Jun-2011 at 02:25PM +0200, Aditya Bhagwat wrote: | Dear, | | How do I tell Emacs to update to the new R version I installed? It still | loads the old R version. I already updated the the system path, but that | didn't seem to work. Depends on information you didn't supply. | | Thanks for your help, | | Aditya | | -- | Aditya Bhagwat | | [[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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Tell emacs to load new R version
I forgot to include Vincent Goulet's web site in my previous email http://vgoulet.act.ulaval.ca/en/emacs/ Best Regards John On 29 June 2011 21:12, Patrick Connolly p_conno...@slingshot.co.nz wrote: On Wed, 29-Jun-2011 at 02:25PM +0200, Aditya Bhagwat wrote: | Dear, | | How do I tell Emacs to update to the new R version I installed? It still | loads the old R version. I already updated the the system path, but that | didn't seem to work. Depends on information you didn't supply. | | Thanks for your help, | | Aditya | | -- | Aditya Bhagwat | | [[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. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___ Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_ Average minds discuss events (:_~*~_:) Small minds discuss people (_)-(_) . Eleanor Roosevelt ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- John C Frain Economics Department Trinity College Dublin Dublin 2 Ireland www.tcd.ie/Economics/staff/frainj/home.html mailto:fra...@tcd.ie mailto:fra...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Derivative of a function
Yes. I need to do implicit differentiation. After rearrangement, I got (x2 – x1) * b = log(1 / y - 1) Take derivative of both sides with respect to y, I have (x2 – x1) * b’[y] = - 1/y(1-y) Since both (x2 – x1) and b’[y] are vectors, I cannot move (x2 – x1) to RHS. This is why I posted my question here to see if there is some R functions or some idea that can help me solve this problem. Thanks. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Derivative-of-a-function-tp3631814p3633947.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] RES: DROP OBSEVATION IN A GROUP
---BeginMessage--- This may be useful; convert them to NAs then omit them afterwards, you end up keeping the positions where you had 0s. n[y==0] - NA n [1] 1 1 1 1 1 1 2 2 NA NA NA 2 3 3 NA NA 3 3 na.omit(n) [1] 1 1 1 1 1 1 2 2 2 3 3 3 3 attr(,na.action) [1] 9 10 11 15 16 attr(,class) [1] omit HTH, Filipe -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Duncan Murdoch Enviada em: quarta-feira, 29 de junho de 2011 17:33 Para: Peter Maclean Cc: r-help@r-project.org Assunto: Re: [R] DROP OBSEVATION IN A GROUP On 29/06/2011 4:29 PM, Peter Maclean wrote: People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in n because the group in Y has more than 2 zeroes. #Example n- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y- c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z- as.data.frame(cbind(n,y)) colnames(z)- c(n,y) The general way to drop observations is to construct a logical vector to use as an index. Entries which are FALSE are dropped. Doing that based on your more than 2 zeroes rule looks a little tricky; I think you want to count zeros first (e.g. using by()), then construct the TRUE/FALSE vector based on that. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ---End Message--- This message and its attachments may contain confidential and/or privileged information. If you are not the addressee, please, advise the sender immediately by replying to the e-mail and delete this message. Este mensaje y sus anexos pueden contener información confidencial o privilegiada. Si ha recibido este e-mail por error por favor bórrelo y envíe un mensaje al remitente. Esta mensagem e seus anexos podem conter informação confidencial ou privilegiada. Caso não seja o destinatário, solicitamos a imediata notificação ao remetente e exclusão da mensagem.__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Executing a script hand-made and time
Hi all, I have a function written by me that read a matrix (data frame) from a txt with 4 million of rows and 13 columns. The think is my function works with an input matrix of 100x13 and now I tried to execute my function with the big input file and it is running form the moment two hours... There is a way to know (how much time could it cost?) The second question is... I want to buy a new computer...to threat files like this (and make on the ifforloops and so on)... I need a computer with high RAM or to speed this executing time I need other technical hardware items I´m sure my programmation can be simplied but anyway I hope someone can give me his/her opinion. Many Thaks in advance. [[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] centre two graphs on one plot
Hi, I am trying to put together a biplot using symbols and different colours instead of text as points. Someone has previously suggested using this code: PC - prcomp (iris[,1:4]) lambda - PC$sdev * sqrt(nrow(PC$x)) plot (t(t(PC$x)/lambda),pch=16,col=as.numeric(iris[,5])) par (new=T) Rot - t(t(PC$rotation)*lambda) XLIM - c(-max(abs(Rot[,1])),max(abs(Rot[,1]))) XLIM - XLIM+(XLIM*0.7) plot(Rot,col=4,axes=FALSE,xlim=XLIM,ylim=XLIM,pch=) arrows (rep(0,nrow(PC$rotation)),rep(0,nrow(PC$rotation)),Rot[,1],Rot[,2],col=4) text (Rot[,1:2],rownames(Rot),col=6) axis (3) axis (4) But the origin of the arrows does not line up with the origin of the points. Can anyone suggest how you would get the two graphs to line up? I think you have to set a ratio between the two sets of axes so that the origin is in the centre but I don't know how to do it. Thanks Chris -- View this message in context: http://r.789695.n4.nabble.com/centre-two-graphs-on-one-plot-tp3633788p3633788.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] Error: cannot allocate vector of size
Thank you for replying. when I've tried to run the R syntax in a 64 bit computer,the problem is solved. Thank you for helping out. I totally agree your advice. I would like to answer all your questions in case other people meet the same problem. The data contains one timestamp column with time zone, one integer column, and 12 Boolean columns. I tried to run one month sample, before memory.limit() [1] 3583 memory.size(max=F) [1] 156.82 memory.size(max=T) [1] 241.06 After memory.limit() [1] 3583 memory.size(max=F) [1] 199.97 memory.size(max=T) [1] 241.56 -- View this message in context: http://r.789695.n4.nabble.com/Error-cannot-allocate-vector-of-size-tp3629384p3633983.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] 4D data acsess
Hi Sarah, I use readMat function, from R.matlab function. str(X) tells that X : num [1:64, 1:64, 1:21, 1:300] as I said, the first 3 columns are x,y,z coordinates. And I need all values in the last column correcponding to a given (x,y,z) coordinate. if you list the values of X, then they are non zero, but for some reason R tells that dim(X): NULL -- View this message in context: http://r.789695.n4.nabble.com/4D-data-acsess-tp3633552p3634004.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] very large pair() plot
Hi everyone, I'm a newbie and this is my first post. My boss wants me to make a series of scatter plots where 76 variables are plotted against each other. I know how to do this using pair()...my problem is that there are just too many plots to fit in the window. Is there any way I can get all the plots to fit and make the font size and marker size scale so it is readable? My goal is to create a *.pdf file that I can send to our large plotter. Thank you, Audrey Rager -- View this message in context: http://r.789695.n4.nabble.com/very-large-pair-plot-tp3634075p3634075.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] Fwd: help
Hi I have imported some files to a list, called importa. There are 43 files (importa[1], importa[2], ..., importa[43]). Now, I'm trying to create a new table in r. Each table will got the data from the importa partition. Like file1-importa[1]. I tried two ways: c-list() for (i in 1:43) { c[i]=paste(prova,a[i],sep=)} i - 1 for (j in c) { j-importa[i] i - i + 1 } In this one, the program created only one table, called j with the data of the importa[43]. The second trial: c-list() for (i in 1:43) { c[i]=paste(prova,a[i],sep=)} i - 1 a-list() for (j in c) { a[j]-importa[i] i - i + 1 } In this one the program created another list, with the subdivisions just like the importa. Anyone knows what I got to do? Thank you very much -- Breno Fragomeni Mestrando em Genética e Melhoramento Animal - Escola de Veterinária - UFMG Genetics and Animal Breeding Master's Degree Student - UFMG [[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] 4D data acsess
On Jun 29, 2011, at 4:56 PM, katarv wrote: Hi Sarah, I use readMat function, from R.matlab function. str(X) tells that X : num [1:64, 1:64, 1:21, 1:300] as I said, the first 3 columns are x,y,z coordinates. And I need all values in the last column correcponding to a given (x,y,z) coordinate. You should be able to access those values with: X[1,1,1, ] or equivalently: X[1,1,1,1:300] if you list the values of X, then they are non zero, but for some reason R tells that dim(X): NULL Now that seems a bit odd. What happens if you try: Y - X dim(Y) - c(64,64,21,300) Y[ 1, 1, 1, ] -- View this message in context: http://r.789695.n4.nabble.com/4D-data-acsess-tp3633552p3634004.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. David Winsemius, MD West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hardy Weinberg Simulation
I have the code below but the p-values are not what I am expecting. I want to use the Cochran Armitage trend test to get the p-values. What do you expect? Depending on the genetic model, you may not see HWE in the cases. datamat[h,] - t(rmultinom(1, size=c(10, 40, 50), prob=c(0.33, 0.33, 0.34))) size should be the total size ie 100. -- | David Duffy (MBBS PhD) ,-_|\ | email: dav...@qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 large JSON data into multidimensional array
People, I have output from a Ruby script saved in JSON format and I can import it into an R vector (list?) that looks like: tst [[1]] [[1]][[1]] [1] 01.01.01.00 [[1]][[2]] [1] -2.304248 [[2]] [[2]][[1]] [1] 01.01.01.01 [[2]][[2]] [1] -2.288097 [[3]] [[3]][[1]] [1] 01.01.01.02 [[3]][[2]] [1] -2.303347 [[4]] [[4]][[1]] [1] 01.01.01.03 [[4]][[2]] [1] -2.354964 . . I would like to convert the data into a: 50.32.20.22 array and be able to do calculations on the array like: mean( tst[ 50,,20,00 ] ) etc Suggestions appreciated. Thanks, Phil. -- Philip Rhoades GPO Box 3411 Sydney NSW2001 Australia E-mail: p...@pricom.com.au __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Executing a script hand-made and time
What type of computer do you have now: operating system, memory. Here is how long it took for me to read in a file with 4M lines and 13 columns of numerics on each line: system.time(x - scan('/temp/large.txt', what = 0)) Read 52614432 items user system elapsed 23.670.67 24.39 str(x) num [1:52614432] 1 1 1 1 1 1 1 1 1 1 ... object.size(x) 420915496 bytes So how are you reading it in? Is your system paging? It should not take 2 hours. On Wed, Jun 29, 2011 at 4:43 PM, Trying To learn again tryingtolearnag...@gmail.com wrote: Hi all, I have a function written by me that read a matrix (data frame) from a txt with 4 million of rows and 13 columns. The think is my function works with an input matrix of 100x13 and now I tried to execute my function with the big input file and it is running form the moment two hours... There is a way to know (how much time could it cost?) The second question is... I want to buy a new computer...to threat files like this (and make on the ifforloops and so on)... I need a computer with high RAM or to speed this executing time I need other technical hardware items I´m sure my programmation can be simplied but anyway I hope someone can give me his/her opinion. Many Thaks in advance. [[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 Data Munger Guru What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R package Forecast
Hi: Your object b is a 5 x 12 matrix. The error message says that ets() is expecting a univariate time series as its first argument. Try something like d - ts(a[, 3], start = c(2005, 1), frequency = 12) fit - ets(d) and see if that works. Untested since no reproducible example was provided. HTH, Dennis On Wed, Jun 29, 2011 at 6:15 AM, nejc bergant nberg...@gmail.com wrote: Hello all First of all I must emphasize that I am fascinated about Forecast package. However I have difficulty to execute 'ets' procedure. After I write code: a-read.table(test.txt, sep=\t, head=T) b-matrix(a[,3], nrow=5, ncol=12, dimnames=list(c(2005,2006,2007,2008,2009), c(jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec) )) fit-ets(b) plot(forecast(fit)) I get this error note: *'Error in ets(b) : y should be a univariate time series'*. Could you please be so kind as to let me know what could be the problem. File 'Test.txt' is database which includes three variables: year, month and dependent variable. I am looking forward to hearing from you. Kind regards, Nejc. [[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.
[R] Italicized greek symbols in PDF plots
I know that this has been asked before in other variations but I just can't seem to figure out my particular application from previous posts. My apologies if I have missed the answer to this question somewhere in the archives. I have indeed looked. I am running Ubuntu 11.04, with R 2.12.1 and ESS+Emacs. For journal formatting requirements, I need to italicize all the greek letters in any plot. This is reasonably straight forward to do and I accomplished this task like so: library(ggplot2) label_parseall - function(variable, value) { plyr::llply(value, function(x) parse(text = paste(x))) } dat - data.frame(x = runif(270, 0, 125), z = rep(LETTERS[1:3], each = 3), yy = 1:9, stringsAsFactors = TRUE) #unicode italicized delta dat$gltr = factor(c(italic(\u03b4)^14*N,italic(\u03b4)^15*N,italic(\u03b4)^13*C)) #So this is what I want my plot to look like: plt - ggplot(data = dat, aes(x = yy, y = x)) + geom_point(aes(x= yy, y=x, shape=z, group=z), alpha=0.4,position = position_dodge(width = 0.8)) + facet_grid(gltr~.,labeller= label_parseall, scales=free_y) plt #So then I exported my plot as a PDF like so: pdf(Times_regular.pdf, family='Times') plt dev.off() #The problem with this was that the delta symbols turned into dots. #I solved this problem using Cairo library(Cairo) cairo_pdf(Cairo.pdf) plt dev.off() The problem that I face now is that I am unsure how to output a figure that maintains the greek symbols but outputs everything in the plot as TImes New Roman, another requirement of the journal. So I can produce a Times New Roman PDF plot and an italicize greek symbol unicode PDF plot but not both. Does anoyone have any idea how I might accomplish both of these things together in a single PDF? Thanks so much in advance, Sam [[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] Fwd: help
Hi: It's not at all clear to me what you want to do. Is each component of your list a data frame with the same structure? Are you trying to combine them into one data frame? If so, then try mydata - do.call(rbind, c) where c is the name of the list. (Not a good choice of name, by the way - c() is a very common function in R and it's not wise to assign another object to that name.) If you want to do something else, perhaps you could clarify your intentions for the list. HTH, Dennis On Wed, Jun 29, 2011 at 1:04 PM, Breno Fragomeni bre...@gmail.com wrote: Hi I have imported some files to a list, called importa. There are 43 files (importa[1], importa[2], ..., importa[43]). Now, I'm trying to create a new table in r. Each table will got the data from the importa partition. Like file1-importa[1]. I tried two ways: c-list() for (i in 1:43) { c[i]=paste(prova,a[i],sep=)} i - 1 for (j in c) { j-importa[i] i - i + 1 } In this one, the program created only one table, called j with the data of the importa[43]. The second trial: c-list() for (i in 1:43) { c[i]=paste(prova,a[i],sep=)} i - 1 a-list() for (j in c) { a[j]-importa[i] i - i + 1 } In this one the program created another list, with the subdivisions just like the importa. Anyone knows what I got to do? Thank you very much -- Breno Fragomeni Mestrando em Genética e Melhoramento Animal - Escola de Veterinária - UFMG Genetics and Animal Breeding Master's Degree Student - UFMG [[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.
[R] volcano plot.r
Hello. My name is Akashah. i work at metabolic laboratory. From my study, i found that volcano plot can help a lot in my section. i already studied about the volcano plot and get the coding to run in R software, unfortunately, there is may be something wrong with the coding. This is because no graph appear, but no error (blue color text) was shown on the R console. Below is the coding for volcano plot, i hope anybody can help me to solve the problem. # volcano_plot.r # # Author: Amsha Nahid, Jairus Bowne, Gerard Murray # Purpose: Produces a volcano plot # # Input: Data matrix as specified in Data-matrix-format.pdf # Output: Plots log2(fold change) vs log10(t-test P-value) # # Notes: Group value for control must be alphanumerically first # Script will return an error if there are more than 2 groups # # Load the data matrix # # Read in the .csv file data-read.csv(file:///Users/nadya/Desktop/praktikal UTM/TASKS1/RT BE EMS 300-399.csv, sep=,, row.names=1, header=TRUE) # Get groups information groups-data[,1] # Get levels for groups grp_levs-levels(groups) if (length(levels(groups)) 2) print(Number of groups is greater than 2!) else { # # Split the matrix by group # new_mats-c() for (ii in 1:length(grp_levs)) new_mats[ii]-list(data[which(groups==levels(groups)[ii]),]) # # Calculate the means # # For each matrix, calculate the averages per column submeans-c() # Preallocate a matrix for the means means-matrix( nrow = 2, ncol = length(colnames(data[,-1])), dimnames = list(grp_levs,colnames(data[,-1])) ) # Calculate the means for each variable per sample for (ii in 1:length(new_mats)) {submeans[ii]-list(apply(new_mats[[ii]][,-1],2,mean,na.rm=TRUE)) means[ii,]-submeans[[ii]]} # # Calculate the fold change # folds-matrix( nrow=length(means[,1]), ncol=length(means[1,]), dimnames=list(rownames(means),colnames(means)) ) for (ii in 1:length(means[,1])) for (jj in 1:length(means[1,])) folds[ii,jj]-means[ii,jj]/means[1,jj] # # t-test P value data # pvals-matrix(nrow=ncol(data[,-1]),ncol=1,dimnames=list(colnames(data[-1]),P-Value)) # # Perform the t-Test # for(ii in 1:nrow(pvals)) { pvals[ii,1]-t.test(new_mats[[1]][,ii+1],new_mats[[2]][,ii+1])$p.value } m-length(pvals) x_range-range(c( min( range(log2(folds[2,])), range(c(-1.5,1.5)) ), max( range(log2(folds[2,])), range(c(-1.5,1.5)) ) )) y_range-range(c( min(range(-log10(pvals)), range(c(0,2)) ), max(range(-log10(pvals)), range(c(0,2)) ) )) # # Plot data # # Define a function, since it's rather involved volcano_plot-function(fold, pval) {plot(x_range, # x-dim y_range, # y-dim type=n, # empty plot xlab=log2 Fold Change, # x-axis title ylab=-log10 t-Test P-value, # y-axis title main=Volcano Plot, # plot title ) abline(h=-log10(0.05),col=green,lty=44)# horizontal line at P=0.05 abline(v=c(-1,1),col=violet,lty=1343) # vertical lines at 2-fold # Plot points based on their values: for (ii in 1:m) # If it's below 0.05, we're not overly interested: purple. if (-log10(pvals[ii])(-log10(0.05))) { # Otherwise, more checks; # if it's greater than 2-fold decrease: blue if (log2(folds[2,][ii])(-1)) { # If it's significant but didn't change much: orange if (log2(folds[2,][ii])1) { points( log2(folds[2,][ii]), -log10(pvals[ii]), col=orange, pch=20 ) # Otherwise, greater than 2-fold increase: red } else { points( log2(folds[2,][ii]), -log10(pvals[ii]), col=red, pch=20 ) } } else { points( log2(folds[2,][ii]), -log10(pvals[ii]),
Re: [R] Derivative of a function
On Wed, Jun 29, 2011 at 4:35 PM, Lisa lisa...@gmail.com wrote: Yes. I need to do implicit differentiation. After rearrangement, I got (x2 – x1) * b = log(1 / y - 1) Take derivative of both sides with respect to y, I have (x2 – x1) * b’[y] = - 1/y(1-y) Since both (x2 – x1) and b’[y] are vectors, I cannot move (x2 – x1) to RHS. This is why I posted my question here to see if there is some R functions or some idea that can help me solve this problem. Thanks. I am not sure if this counts as an approach that you are trying to exclude but: db[i]/dy = { dlogit(y)/dy } / { dlogit(y)/db[i] } = { 1/{y(1-y)} / { x1[i] - x2[i] } The numerator is taken from your calculation and the denominator is from linearity. -- Statistics Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fw: volcano plot.r
- Forwarded Message - From: Ungku Akashah kasla...@yahoo.com To: r-help@r-project.org r-help@r-project.org Sent: Thursday, June 30, 2011 9:14 AM Subject: volcano plot.r Hello. My name is Akashah. i work at metabolic laboratory. From my study, i found that volcano plot can help a lot in my section. i already studied about the volcano plot and get the coding to run in R software, unfortunately, there is may be something wrong with the coding. This is because no graph appear, but no error (blue color text) was shown on the R console. Below is the coding for volcano plot, i hope anybody can help me to solve the problem. # volcano_plot.r # # Author: Amsha Nahid, Jairus Bowne, Gerard Murray # Purpose: Produces a volcano plot # # Input: Data matrix as specified in Data-matrix-format.pdf # Output: Plots log2(fold change) vs log10(t-test P-value) # # Notes: Group value for control must be alphanumerically first # Script will return an error if there are more than 2 groups # # Load the data matrix # # Read in the .csv file data-read.csv(file:///Users/nadya/Desktop/praktikal UTM/TASKS1/RT BE EMS 300-399.csv, sep=,, row.names=1, header=TRUE) # Get groups information groups-data[,1] # Get levels for groups grp_levs-levels(groups) if (length(levels(groups)) 2) print(Number of groups is greater than 2!) else { # # Split the matrix by group # new_mats-c() for (ii in 1:length(grp_levs)) new_mats[ii]-list(data[which(groups==levels(groups)[ii]),]) # # Calculate the means # # For each matrix, calculate the averages per column submeans-c() # Preallocate a matrix for the means means-matrix( nrow = 2, ncol = length(colnames(data[,-1])), dimnames = list(grp_levs,colnames(data[,-1])) ) # Calculate the means for each variable per sample for (ii in 1:length(new_mats)) {submeans[ii]-list(apply(new_mats[[ii]][,-1],2,mean,na.rm=TRUE)) means[ii,]-submeans[[ii]]} # # Calculate the fold change # folds-matrix( nrow=length(means[,1]), ncol=length(means[1,]), dimnames=list(rownames(means),colnames(means)) ) for (ii in 1:length(means[,1])) for (jj in 1:length(means[1,])) folds[ii,jj]-means[ii,jj]/means[1,jj] # # t-test P value data # pvals-matrix(nrow=ncol(data[,-1]),ncol=1,dimnames=list(colnames(data[-1]),P-Value)) # # Perform the t-Test # for(ii in 1:nrow(pvals)) { pvals[ii,1]-t.test(new_mats[[1]][,ii+1],new_mats[[2]][,ii+1])$p.value } m-length(pvals) x_range-range(c( min( range(log2(folds[2,])), range(c(-1.5,1.5)) ), max( range(log2(folds[2,])), range(c(-1.5,1.5)) ) )) y_range-range(c( min(range(-log10(pvals)), range(c(0,2)) ), max(range(-log10(pvals)), range(c(0,2)) ) )) # # Plot data # # Define a function, since it's rather involved volcano_plot-function(fold, pval) {plot(x_range, # x-dim y_range, # y-dim type=n, # empty plot xlab=log2 Fold Change, # x-axis title ylab=-log10 t-Test P-value, # y-axis title main=Volcano Plot, # plot title ) abline(h=-log10(0.05),col=green,lty=44)# horizontal line at P=0.05 abline(v=c(-1,1),col=violet,lty=1343) # vertical lines at 2-fold # Plot points based on their values: for (ii in 1:m) # If it's below 0.05, we're not overly interested: purple. if (-log10(pvals[ii])(-log10(0.05))) { # Otherwise, more checks; # if it's greater than 2-fold decrease: blue if (log2(folds[2,][ii])(-1)) { # If it's significant but didn't change much: orange if (log2(folds[2,][ii])1) { points( log2(folds[2,][ii]), -log10(pvals[ii]), col=orange, pch=20 ) # Otherwise, greater than 2-fold increase: red } else { points( log2(folds[2,][ii]), -log10(pvals[ii]), col=red, pch=20 ) }
[R] Sum Question
Hello, I have the following dataset (this is a piece of a much larger set): RID SCRNO VISCODE RECNO CONTTIME 2318 HBA0190012 bl 15 2418 HBA0190012 bl 35 2818 HBA0190012 bl 55 2918 HBA0190012 bl 25 3218 HBA0190012 bl 45 3819 HBA0190013 bl 2 35 5019 HBA0190013 bl 15 5720 HBA0190014 bl 1 10 6121 HBA0200015 bl 2 30 6421 HBA0200015 bl 3 90 6721 HBA0200015 bl 4 90 7221 HBA0200015 bl 82 7621 HBA0200015 bl 1 60 8822 HBA0190016 bl 1 25 9723 HBA0190017 bl 3 85 9923 HBA0190017 bl 15 103 23 HBA0190017 bl 25 122 25 HBA0190019 bl 1 20 145 26 HBA0200020 bl 1 60 170 27 HBA0190021 bl 13 190 28 HBA0220022 bl 1 40 194 29 HBA0220023 bl 1 25 223 29 HBA0220023 bl 2 25 And I would like to output a list of the sums of CONTTIME for each SCRNO. What is the best way to do that? Any help would be greatly appreciated. Thanks! Edgar __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] optimization in for loop
Thankyou very much. I think try works for me. I am learning it . Sirius -- View this message in context: http://r.789695.n4.nabble.com/optimization-in-for-loop-tp3633638p3634100.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] Derivative of a function
If you just want the value of the derivative at a particular point, would numerical derivatives suffice? If so, try (for example) the numDeriv package. S From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Lisa [lisa...@gmail.com] Sent: 29 June 2011 21:35 To: r-help@r-project.org Subject: Re: [R] Derivative of a function Yes. I need to do implicit differentiation. After rearrangement, I got (x2 – x1) * b = log(1 / y - 1) Take derivative of both sides with respect to y, I have (x2 – x1) * b’[y] = - 1/y(1-y) Since both (x2 – x1) and b’[y] are vectors, I cannot move (x2 – x1) to RHS. This is why I posted my question here to see if there is some R functions or some idea that can help me solve this problem. Thanks. Lisa -- View this message in context: http://r.789695.n4.nabble.com/Derivative-of-a-function-tp3631814p3633947.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. *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Executing a script hand-made and time
Hi all, My file that worked with a thin matrix (with few rows and colums) finally made an error but I can´t comprehed why? valor ausente donde TRUE/FALSE es necesario (absent value TRUE/FALSE is necessary?) Error en if (data[i, j] - last1[1, j] != 0) data2[i, j] = 0 else { : You recommed to part the file of 4 Million rows x 13 colums? 2011/6/29 Trying To learn again tryingtolearnag...@gmail.com Hi all, I have a function written by me that read a matrix (data frame) from a txt with 4 million of rows and 13 columns. The think is my function works with an input matrix of 100x13 and now I tried to execute my function with the big input file and it is running form the moment two hours... There is a way to know (how much time could it cost?) The second question is... I want to buy a new computer...to threat files like this (and make on the ifforloops and so on)... I need a computer with high RAM or to speed this executing time I need other technical hardware items I´m sure my programmation can be simplied but anyway I hope someone can give me his/her opinion. Many Thaks in advance. [[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] Numerical integration
Hello! I know that probably my question is rather simple but I' m a very beginner R-user. I have to numerically integrate the product of two function A(x) and B(x). The integretion limits are [X*; +inf] Function A(x) is a pdf function while B(x)=e*x is a linear function whose value is equal to 0 when the x X* Moreover I have to iterate this process for different value of X* and for different pdf of the same type. I know the comand INTEGRATE but I can' t make it work. Which is the best function to do this and how does it work? Thank you very much in advanced!! -- View this message in context: http://r.789695.n4.nabble.com/Numerical-integration-tp3634365p3634365.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] Saving fExtremes estimates and k-block return level with confidence intervals.
I am estimating a large model by groups. How do you save the results and returns the associated quantiles? For this example I need a data frame n xi mubeta 1 0.1033614 2.5389580 0.9092611 2 0.3401922 0.5192882 1.5290615 3 0.5130798 0.5668308 1.2105666 I also want to apply gevrlevelPlot() for each n or group. #Example n - c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y - c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z - as.data.frame(cbind(n,y)) colnames(z) - c(n,y) library(fExtremes) z - split(z, z$n) res2 -lapply(z, function(x){ m - as.numeric(x$y) gevFit(m, block = 1, type = c(pwm)) }) res2 $`1` Title: GEV Parameter Estimation Call: gevFit(x = m, block = 1, type = c(pwm)) Estimation Type: gev pwm Estimated Parameters: xi mu beta 0.1033614 2.5389580 0.9092611 Description Wed Jun 29 23:07:48 2011 $`2` Title: GEV Parameter Estimation Call: gevFit(x = m, block = 1, type = c(pwm)) Estimation Type: gev pwm Estimated Parameters: xi mu beta 0.3401922 0.5192882 1.5290615 Description Wed Jun 29 23:07:48 2011 $`3` Title: GEV Parameter Estimation Call: gevFit(x = m, block = 1, type = c(pwm)) Estimation Type: gev pwm Estimated Parameters: xi mu beta 0.5130798 0.5668308 1.2105666 Description Wed Jun 29 23:07:48 2011 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Upgrading R in Ubuntu
Dear All, I wanted to install the reshape package which in turn requires the plyr. When I tried to install plyr it says it needs ERROR: this R is version 2.10.1, package 'plyr' requires R = 2.11.0 My question is how do I upgrade my R ? I have Ubuntu 10.04.2 LTS. Many thanks for your help. [[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] DROP OBSEVATION IN A GROUP
I tried this but did not work: z0- by(z, z[,n], function(x) subset(x, sum(n==0)2)) Peter Maclean Department of Economics UDSM - Original Message From: Duncan Murdoch murdoch.dun...@gmail.com To: Peter Maclean pmaclean2...@yahoo.com Cc: r-help@r-project.org Sent: Wed, June 29, 2011 3:33:25 PM Subject: Re: [R] DROP OBSEVATION IN A GROUP On 29/06/2011 4:29 PM, Peter Maclean wrote: People with more experience in R I need help on this. I would like to drop observation if they meet certain condition. In this example I would like to drop group 2 in n because the group in Y has more than 2 zeroes. #Example n- c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,3) y- c(2,3,2,3,4,5,6,1,0,0,0,6, 2, 1, 0, 0,9,3) z- as.data.frame(cbind(n,y)) colnames(z)- c(n,y) z0- by(z, z[,n], function(x) subset(x, sum(n==0)2)) The general way to drop observations is to construct a logical vector to use as an index. Entries which are FALSE are dropped. Doing that based on your more than 2 zeroes rule looks a little tricky; I think you want to count zeros first (e.g. using by()), then construct the TRUE/FALSE vector based on that. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Italicized greek symbols in PDF plots
On Wed, 29 Jun 2011, Sam Albers wrote: I know that this has been asked before in other variations but I just can't seem to figure out my particular application from previous posts. My apologies if I have missed the answer to this question somewhere in the archives. I have indeed looked. I am running Ubuntu 11.04, with R 2.12.1 and ESS+Emacs. For journal formatting requirements, I need to italicize all the greek letters in any plot. This is reasonably straight forward to do and I accomplished this task like so: library(ggplot2) label_parseall - function(variable, value) { plyr::llply(value, function(x) parse(text = paste(x))) } dat - data.frame(x = runif(270, 0, 125), z = rep(LETTERS[1:3], each = 3), yy = 1:9, stringsAsFactors = TRUE) #unicode italicized delta dat$gltr = factor(c(italic(\u03b4)^14*N,italic(\u03b4)^15*N,italic(\u03b4)^13*C)) #So this is what I want my plot to look like: plt - ggplot(data = dat, aes(x = yy, y = x)) + geom_point(aes(x= yy, y=x, shape=z, group=z), alpha=0.4,position = position_dodge(width = 0.8)) + facet_grid(gltr~.,labeller= label_parseall, scales=free_y) plt #So then I exported my plot as a PDF like so: pdf(Times_regular.pdf, family='Times') plt dev.off() #The problem with this was that the delta symbols turned into dots. You forgot to set the encoding: see the ?pdf help file. Greek is most likely not covered by the default encoding (and you also forgot the 'at a minimum' information required by the posting guide, so we don't know what your defaults would be). #I solved this problem using Cairo library(Cairo) cairo_pdf(Cairo.pdf) plt dev.off() The problem that I face now is that I am unsure how to output a figure that maintains the greek symbols but outputs everything in the plot as TImes New Roman, another requirement of the journal. So I can produce a Times New Roman PDF plot and an italicize greek symbol unicode PDF plot but not both. Does anoyone have any idea how I might accomplish both of these things together in a single PDF? I woud use cairo_pdf() in base R (and not package Cairo). Use grid facilities to change font, or use the version in R-devel which has a family= argument. Thanks so much in advance, Sam [[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 That does mean you! -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Upgrading R in Ubuntu
This is Googlable. You need to add the CRAN repository to your APT sources file. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Ashim Kapoor ashimkap...@gmail.com wrote: Dear All, I wanted to install the reshape package which in turn requires the plyr. When I tried to install plyr it says it needs ERROR: this R is version 2.10.1, package 'plyr' requires R = 2.11.0 My question is how do I upgrade my R ? I have Ubuntu 10.04.2 LTS. Many thanks for your help. [[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. [[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.