Re: [R] NADA
Somebody just might be able to help if you read the Posting Guide mentioned in the email footer, post using plain text, and make a reproducible example [1]. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Janh Anni annij...@gmail.com wrote: Dear Users Regarding the NADA package, would anyone be able to help me understand what values are actually plotted on the Y axis of the plot obtained by using the *ros* function on the data and plotting the result with the plot() function? The Y axis is labeled Values. According to the NADA user manual, ros performs a log transformation of the data by default, but the user can specify no transformation, or some other transformation besides log, if desired. However the values plotted on the Y axis appear to be the raw data values, regardless of which transformation or no transformation was used. If the log transformation is used for instance, I would have expected the logs of the original data instead of the raw data to be plotted on the Y axis. Thanks for your help. Janh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] why a moving average fun takes too long time!!
I have so many gz files of the type (filename.nc.gz) where nc stands for netcdf file. I used the following commands : path=C:/Documents and settings/AER/NorthAmerica-West/zipedfiles/ # examples of zipped files files - list.files(path, recursive=TRUE, full.names=TRUE) files - grep(.*\\.gz$, files, value=TRUE) This gave me list of gz files. To unzip (extract it) I used the following command. for (flst in 1:length(files)) { f1-strsplit(files[flst],\\.gz) tmp-sapply(f1, '[[', 1) gunzip(tmp) } But, this does not work. I have also defined an output path as: outpath='c:/temp/' and also used something like this: sapply(files,function(i) gunzip(i,destname=outpath) that also did not work. I am frustrated an anything helps - including if there is any alternative package. Thank you all for your help. Best, Alemu [[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] problem subsetting data.frame in R version 2.15.2 for Windows
Hi Borja, You may issue: attach(data) which results in adding your column names to the search path of R for name resolving. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 11:17 PM, Borja . borjalato...@outlook.com wrote: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29 10 10 20 30 I understand I should get the same result by saying data[a7,0] but I don't. Instead I get: Error in `[.data.frame`(data, a 7, 0) : object 'a' not found Thank you very much 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. [[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] behaviour of formula objects and environment inside functions
thanks for your answers and sorry that I didnt explain the problem/question sufficiently in the first place. here it comes: the problem is that when I create a formula inside a function and some large objects exist there too, then saving the output of the formula will save the in this case large environment: test2a - function(){ large.object - rnorm(100) out - list(f=formula(u~b)) out } v2a - test2a() save(v2a,file=~/tmp/v2.rda) size of v2a.rda: 7.4M saving the output of test() yields a file-size on disk of 7.4 Mega bytes, even though the output of the function does not depend on the large object. Given that the formula f is also completely independent of the large.object the behaviour is surprising. It is even more suprising that when the same code is evaluated outside the function in the Globalenv then the saved object does not contain the large.object: large.object - rnorm(100) v3 - list(f=formula(u~b)) save(v3,file=~/tmp/v3.rda) size of v3.rda: 128 B In my set of functions I make sure that the formula is evaluated in an existing data.frame. Hence, I want to solely use the look-up-variables function and get rid of all the other functions of the formula. Thanks Thomas William Dunlap wdun...@tibco.com writes: I didn't see where you said what your goal was in making the environment of a formula and empty environment. I'm guessing that you want to make sure the variables in the formula come from the data.frame given to a fitting function along with the formula (so that typos cause errors for sure instead of sometimes giving an incorrect answer). Note that environment(formula) is used to look up not only the variables (and functions) in a formula, but also to look up some things used in a call to model.frame. Hence setting the formula's environment to emptyenv() is not very useful - it limits things too much. form1 - y ~ x1 + x2 environment(form1) - emptyenv() dat - data.frame(y=log(1:10), x1=1/(1:10), x2=sqrt(1:10)) fit - lm(form1, data=dat) Error in eval(expr, envir, enclos) : could not find function list traceback() 7: eval(expr, envir, enclos) 6: eval(predvars, data, env) 5: model.frame.default(formula = form1, data = dat, drop.unused.levels = TRUE) 4: model.frame(formula = form1, data = dat, drop.unused.levels = TRUE) 3: eval(expr, envir, enclos) 2: eval(mf, parent.frame()) 1: lm(form1, data = dat) I'm a bit surprised that this error happens - it might be avoided by rewriting some stuff in model.frame. I can avoid it by doing e - new.env(parent=emptyenv()) e$list - base::list environment(form1) - e fit - lm(form1, data=dat) The fix may not be worthwhile because it won't help you with a formula like y~x1+sin(x2) - 'sin' will not be found. You could use environment(form1) - parent.env(globalenv()) so all attached packages may be used but not globalenv(). Since packages tend to contain functions and not much data this may help if you are just trying to generate errors when there is a typo in the formula. Knowing why you want the environment of a formula to be empty would help answer your question. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Charles Berry Sent: Wednesday, March 20, 2013 7:04 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] behaviour of formula objects and environment inside functions Thomas Alexander Gerds tag at biostat.ku.dk writes: Dear List I am looking for the recommended way to create a formula inside a function with an empty environment. I tried several versions (see below), and one of them seemed to work, but I dont understand why there is a difference between .GlobalEnv and the environment inside a function. I would be greatful for any reference or explanation or advice. [snip] From ?formula Environments: A formula object has an associated environment, and this environment (rather than the parent environment) is used by model.frame' to evaluate variables that are not found in the supplied 'data' argument. So write four functions that: 1) creates a formula 2) creates some data 3) evaluates a formula using model.frame (even implicitly with lm(),say) 4) calls the functions from 1, 2, and 3 When you run '4', the result will depend on the environment of data from 2 and the environment of the formula from 1. If they are both in the same environment, fine. If not, you might get lucky and have the data in a place where it will be found nevertheless. If you are really unlucky the '4' function will find some other data that match the formula and use it. HTH, Chuck __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,
Re: [R] problem subsetting data.frame in R version 2.15.2 for Windows
On Mar 21, 2013, at 7:39, Pierrick Bruneau pbrun...@gmail.com wrote: Hi Borja, You may issue: attach(data) No -- bad idea -- dangerous -- confusing statefulness, etc. (See explanations in the archives as to why) which results in adding your column names to the search path of R for name resolving. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 11:17 PM, Borja . borjalato...@outlook.com wrote: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29 10 10 20 30 I understand I should get the same result by saying data[a7,0] but I don't. Instead I get: Error in `[.data.frame`(data, a 7, 0) : object 'a' not Try instead with(dat, dat[a 0, ]) for a cleaner option. MW found Thank you very much 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] problem subsetting data.frame in R version 2.15.2 for Windows
Or simply subset(dat, a 0) HTH, Jorge.- On Thu, Mar 21, 2013 at 6:58 PM, Michael Weylandt wrote: On Mar 21, 2013, at 7:39, Pierrick Bruneau pbrun...@gmail.com wrote: Hi Borja, You may issue: attach(data) No -- bad idea -- dangerous -- confusing statefulness, etc. (See explanations in the archives as to why) which results in adding your column names to the search path of R for name resolving. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 11:17 PM, Borja . borjalato...@outlook.com wrote: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29 10 10 20 30 I understand I should get the same result by saying data[a7,0] but I don't. Instead I get: Error in `[.data.frame`(data, a 7, 0) : object 'a' not Try instead with(dat, dat[a 0, ]) for a cleaner option. MW found Thank you very much 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. [[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. [[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] problem subsetting data.frame in R version 2.15.2 for Windows
OK, I just had a look at the Good Practice section of ?attach, it indeed looks bad... Maybe this danger should be emphasized in ?attach, or the function even deprecated (why maintaining ugly patterns when better solutions exist?) On Thu, Mar 21, 2013 at 8:58 AM, Michael Weylandt michael.weyla...@gmail.com wrote: On Mar 21, 2013, at 7:39, Pierrick Bruneau pbrun...@gmail.com wrote: Hi Borja, You may issue: attach(data) No -- bad idea -- dangerous -- confusing statefulness, etc. (See explanations in the archives as to why) which results in adding your column names to the search path of R for name resolving. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 11:17 PM, Borja . borjalato...@outlook.com wrote: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29 10 10 20 30 I understand I should get the same result by saying data[a7,0] but I don't. Instead I get: Error in `[.data.frame`(data, a 7, 0) : object 'a' not Try instead with(dat, dat[a 0, ]) for a cleaner option. MW found Thank you very much 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. [[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.
[R] boxplot
Hi, It must be an easy question but how to boxplot a subset of data: data = read.table(my_data.txt, header = T) boxplot(data$var1[data$loc == nice]~data$loc_type[data$loc == nice]) #in this case, i want to display only the boxplot loc == nice #doesn't display the boxplot of only loc == nice. It also displays loc == mice Thanks Carol loc typeloc_typevar1var2 niceSA nice_SA 2.96E+033.33E+03 niceSA nice_SA 4.07E+034.44E+03 niceSA nice_SA 3.33E+034.81E+03 niceAm nice_Am 3.70E+020.00E+00 niceAm nice_Am 7.41E+020.00E+00 niceAm nice_Am 1.48E+030.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAp nice_Ap 3.70E+020.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 niceAm_Ap nice_Am_Ap 0.00E+000.00E+00 miceSA mice_SA 9.26E+056.67E+04 miceSA mice_SA 8.52E+057.78E+04 miceSA mice_SA 9.63E+058.15E+04 miceAm mice_Am 5.93E+035.56E+03 miceAm mice_Am 5.56E+037.04E+03 miceAm mice_Am 7.78E+037.41E+03 miceAp mice_Ap 8.89E+034.07E+03 miceAp mice_Ap 9.63E+033.33E+03 miceAp mice_Ap 1.07E+042.59E+03 miceAm_Ap mice_Am_Ap 4.07E+031.11E+03 miceAm_Ap mice_Am_Ap 4.81E+031.11E+03 miceAm_Ap mice_Am_Ap 5.56E+033.70E+02 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to skip part of the code
Hi as David pointed out e is probably slightly bigger than 0. Easiest way is probably if (round(e) 0) { res -bugs(list(); k -5+2 } Regards Petr From: Andras Farkas [mailto:motyoc...@yahoo.com] Sent: Wednesday, March 20, 2013 3:53 PM To: PIKAL Petr; Robert Baer Cc: r-help@r-project.org Subject: Re: [R] how to skip part of the code Dear Pikal and Robert, thanks for the help, I guess trying the if function is worth it, and indeed, it works for the example I provided. Unfortunatelly though I am not getting the expected results with my actual code, which is a lot more complicated using R2OpenBUGS. Let me give you the actual example: using my model and input parameters I am generating res with a bugs function: res -bugs(list() and also have: k -5+2 I have tryed your code as follows: if (e 0) { res -bugs(list(); k -5+2 } my goal is that if e = 0, then not to prompt a call of the model in OpenBUGS, which is what is happening currently with the way it is written here. Any thoughts on how to completiley ignorre a that line or chunk? thanks, Andras --- On Wed, 3/20/13, Robert Baer rb...@atsu.edumailto:rb...@atsu.edu wrote: From: Robert Baer rb...@atsu.edumailto:rb...@atsu.edu Subject: Re: [R] how to skip part of the code To: PIKAL Petr petr.pi...@precheza.czmailto:petr.pi...@precheza.cz Cc: Andras Farkas motyoc...@yahoo.commailto:motyoc...@yahoo.com, r-help@r-project.orgmailto:r-help@r-project.org r-help@r-project.orgmailto:r-help@r-project.org Date: Wednesday, March 20, 2013, 9:27 AM On 3/20/2013 8:21 AM, PIKAL Petr wrote: Hi -Original Message- From: r-help-boun...@r-project.orghttp://us.mc1631.mail.yahoo.com/mc/compose?to=r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.orgmailto:r-help-bounces@r-%0b%3e%3e%20project.org] On Behalf Of Andras Farkas Sent: Wednesday, March 20, 2013 2:11 PM To: r-help@r-project.orghttp://us.mc1631.mail.yahoo.com/mc/compose?to=r-help@r-project.org Subject: [R] how to skip part of the code Dear All, another quick question, this one is on skipping part of my code, so let us say: a -5 b -2 e -0 d -a+b f -a-b what I would like to do is to have R NOT to calculate the value for d in case the value of e equals to zero (essentially skip that chunk), but instead move on to calculate te value for f. In the code I am working with the value of e changes, and I would like to calculate d and f at all times when the value of e is greater then zero. If possible, I would like to do this without using the functions ifelse and if else Why? This is exactly the reason for which if else was invented? I am not sure if some simple solution without if is available. if (e 0) { d - a+b; f - a-b } seems to be simple. Regards Petr I second Petr on the question, why not use if? But this might meet your criteria. a - 5 b - 2 e - 0 # dat - data.frame(a, b, e) dat$d[dat$e 0] - a + b dat$f - a - b appreciate the help, Andras [[alternative HTML version deleted]] __ R-help@r-project.orghttp://us.mc1631.mail.yahoo.com/mc/compose?to=R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA [[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] problem subsetting data.frame in R version 2.15.2 for Windows
Hi in interactive sessions it is convenient way to call data frame columns and repeatedly use them in calculations. You just have to be careful with some functions as they can be useful but dangerous. rm(something) removes an object from environment without warning. It is usually not a fault of a program, when something gets wrong. Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Pierrick Bruneau Sent: Thursday, March 21, 2013 9:13 AM To: Michael Weylandt Cc: r-help@r-project.org Subject: Re: [R] problem subsetting data.frame in R version 2.15.2 for Windows OK, I just had a look at the Good Practice section of ?attach, it indeed looks bad... Maybe this danger should be emphasized in ?attach, or the function even deprecated (why maintaining ugly patterns when better solutions exist?) On Thu, Mar 21, 2013 at 8:58 AM, Michael Weylandt michael.weyla...@gmail.com wrote: On Mar 21, 2013, at 7:39, Pierrick Bruneau pbrun...@gmail.com wrote: Hi Borja, You may issue: attach(data) No -- bad idea -- dangerous -- confusing statefulness, etc. (See explanations in the archives as to why) which results in adding your column names to the search path of R for name resolving. Pierrick Bruneau CRP Gabriel Lippmann On Wed, Mar 20, 2013 at 11:17 PM, Borja . borjalato...@outlook.com wrote: Good day. I create a data frame like this: data - data.frame(a=1:10,b=11:20,c=21:30) I can subset this data.frame by saying: data[data$a7,] and I get this result a b c8 8 18 28 9 9 19 29 10 10 20 30 I understand I should get the same result by saying data[a7,0] but I don't. Instead I get: Error in `[.data.frame`(data, a 7, 0) : object 'a' not Try instead with(dat, dat[a 0, ]) for a cleaner option. MW found Thank you very much 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. [[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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] boxplot
On 03/21/2013 07:40 PM, carol white wrote: Hi, It must be an easy question but how to boxplot a subset of data: data = read.table(my_data.txt, header = T) boxplot(data$var1[data$loc == nice]~data$loc_type[data$loc == nice]) #in this case, i want to display only the boxplot loc == nice #doesn't display the boxplot of only loc == nice. It also displays loc == mice Hi Carol, It's them old factors sneakin' up on you. Try this: boxplot(data$var1[data$loc == nice]~ as.character(data$loc_type[data$loc == nice])) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] All unique combinations
Dear all, I would like to have all unique combinations in the following matrix TimeIndex- rbind (c(1,Week_of_21_07-29_03), c(2,Thursday_21_03), c(3,Friday_22_03), c(4,Saturday_23_03), c(5,Sunday_24_03), c(6,Monday_25_03), c(7,Tuesday_26_03), c(8,Wednesday_27_03), c(9,Thursday_28_03), c(10,Friday_ 29_03)) As have a plotting code that takes two input arguments plot_two_time_frames(time1,LabelTime1,time2,LabelTime2) these inputs are time1: integer from TimeIndex. TimeIndex[i,1] LabelTime1: Labels from TimeIndex[i,2] time2: integer from TimeIndex, TimeIndex[i,1] LabelTime2: Labels from TimeIndex[i,2] the times 1 and time 2 should be unique combinations and never the same number. I understand that my explanation was not the best possible. But I would like to thank you in advance for your support Regards Alex [[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] values for the scree plot (package psych)
Hello, I am using function princomp from the package psych. I have my principle component object mypc: mypc - princomp(covmat=mycor) plot(mypc) # shows me a screeplot Question: how could I actually see the values displayed in the screeplot. I don't mean on the graph - I just want to know the actual value for each component (e.g., 10, 3.2, 1.8, etc.) I need to know how much variance, in total, a certain number of comonents explain. Thanks a lot! -- Dimitri Liakhovitski [[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] All unique combinations
It isn't entirely clear to me if you want to remove duplicates or expand your matrix. Check ?unique or ?expand.grid. Here are some guesses of what you may want to do. unique(TimeIndex) expand.grid(as.data.frame(TimeIndex)) expand.grid(as.data.frame(unique(TimeIndex))) TimeIndex2 - data.frame(time1 = 1:10, label1 = c(Week_of_21_07-29_03, Thursday_21_03, Friday_22_03, Saturday_23_03, Sunday_24_03, Monday_25_03, Tuesday_26_03, Wednesday_27_03, Thursday_28_03, Friday_ 29_03)) expand.grid(unique(TimeIndex2)) Best, Nello -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Alaios Sent: Donnerstag, 21. März 2013 10:23 To: R help Subject: [R] All unique combinations Dear all, I would like to have all unique combinations in the following matrix TimeIndex- rbind (c(1,Week_of_21_07-29_03), c(2,Thursday_21_03), c(3,Friday_22_03), c(4,Saturday_23_03), c(5,Sunday_24_03), c(6,Monday_25_03), c(7,Tuesday_26_03), c(8,Wednesday_27_03), c(9,Thursday_28_03), c(10,Friday_ 29_03)) As have a plotting code that takes two input arguments plot_two_time_frames(time1,LabelTime1,time2,LabelTime2) these inputs are time1: integer from TimeIndex. TimeIndex[i,1] LabelTime1: Labels from TimeIndex[i,2] time2: integer from TimeIndex, TimeIndex[i,1] LabelTime2: Labels from TimeIndex[i,2] the times 1 and time 2 should be unique combinations and never the same number. I understand that my explanation was not the best possible. But I would like to thank you in advance for your support Regards Alex [[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] values for the scree plot (package psych)
The plot shows the variation for each component and mypc$sdev gives you the standard deviation. If you want to know the variation, use mypc$sdev^2. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Liakhovitski Sent: Donnerstag, 21. März 2013 12:26 To: r-help Subject: [R] values for the scree plot (package psych) Hello, I am using function princomp from the package psych. I have my principle component object mypc: mypc - princomp(covmat=mycor) plot(mypc) # shows me a screeplot Question: how could I actually see the values displayed in the screeplot. I don't mean on the graph - I just want to know the actual value for each component (e.g., 10, 3.2, 1.8, etc.) I need to know how much variance, in total, a certain number of comonents explain. Thanks a lot! -- Dimitri Liakhovitski [[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] Compatibility problem Iramuteq / R : help !!!
Hi, I try to run the Iramuteq software with R, on Windows 7 professional (latest version of Iramuteq, and I tried with the three latest versions of R). I properly installed the packages and coded the texts, but anytime I want to run the analysis, I receive this error message : Erreur R None1 None None. Could someone help me to deal with that problem ? Thank you !!! Arthur Borriello PhD student - Political Science CEVIPOL - www.cevipol.be Université Libre de Bruxelles (ULB) Avenue F.D. Roosevelt, 50 CP 124 B - 1050 Bruxelles Room S.11.216 [[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] Excuse me
Dear R software faculty: Â Â Â Â Â Â There is a question bothering me. That is why we can not set the property of row.names=false when we output csv data. But there exists that parameter in R help. Hoping for your reply! Best regards! Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Li Nan [[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] Compatibility problem Iramuteq / R : help !!!
Data? Code? https://github.com/hadley/devtools/wiki/Reproducibility John Kane Kingston ON Canada -Original Message- From: aborr...@ulb.ac.be Sent: Thu, 21 Mar 2013 12:10:13 +0100 To: r-help@r-project.org Subject: [R] Compatibility problem Iramuteq / R : help !!! Hi, I try to run the Iramuteq software with R, on Windows 7 professional (latest version of Iramuteq, and I tried with the three latest versions of R). I properly installed the packages and coded the texts, but anytime I want to run the analysis, I receive this error message : Erreur R None1 None None. Could someone help me to deal with that problem ? Thank you !!! Arthur Borriello PhD student - Political Science CEVIPOL - www.cevipol.be Universiti Libre de Bruxelles (ULB) Avenue F.D. Roosevelt, 50 CP 124 B - 1050 Bruxelles Room S.11.216 [[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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Excuse me
If I remember correctly this was possible a few versions ago but was dropped. To do it now you need to use write.table and set row.names = FALSE. John Kane Kingston ON Canada -Original Message- From: lina...@pku.edu.cn Sent: Thu, 21 Mar 2013 16:27:18 +0800 (CST) To: r-help@r-project.org Subject: [R] Excuse me Dear R software faculty: B B B B B B There is a question bothering me. That is why we can not set the property of row.names=false when we output csv data. But there exists that parameter in R help. Hoping for your reply! Best regards! B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B Li Nan [[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. FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] values for the scree plot (package psych)
Thank you very much! On Thu, Mar 21, 2013 at 8:16 AM, Blaser Nello nbla...@ispm.unibe.ch wrote: The plot shows the variation for each component and mypc$sdev gives you the standard deviation. If you want to know the variation, use mypc$sdev^2. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dimitri Liakhovitski Sent: Donnerstag, 21. März 2013 12:26 To: r-help Subject: [R] values for the scree plot (package psych) Hello, I am using function princomp from the package psych. I have my principle component object mypc: mypc - princomp(covmat=mycor) plot(mypc) # shows me a screeplot Question: how could I actually see the values displayed in the screeplot. I don't mean on the graph - I just want to know the actual value for each component (e.g., 10, 3.2, 1.8, etc.) I need to know how much variance, in total, a certain number of comonents explain. Thanks a lot! -- Dimitri Liakhovitski [[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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Dimitri Liakhovitski [[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] Excuse me
On 03/21/2013 08:38 AM, John Kane wrote: If I remember correctly this was possible a few versions ago but was dropped. To do it now you need to use write.table and set row.names = FALSE. John Kane Kingston ON Canada I used write.csv with row.names=FALSE yesterday with no issues at all in the current version of R. Kevin -Original Message- From: lina...@pku.edu.cn Sent: Thu, 21 Mar 2013 16:27:18 +0800 (CST) To: r-help@r-project.org Subject: [R] Excuse me Dear R software faculty: B B B B B B There is a question bothering me. That is why we can not set the property of row.names=false when we output csv data. But there exists that parameter in R help. Hoping for your reply! Best regards! B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B Li Nan -- Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to look at the source code for predict()
Hello Rui, This also works! Thanks so much! Cheers, Rebecca -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Wednesday, March 20, 2013 3:34 PM To: Yuan, Rebecca Cc: 'R help' Subject: Re: [R] How to look at the source code for predict() Hello, In the case of predict.Arima, you can type at an R prompt the following. stats:::predict.Arima Hope this helps, Rui Barradas Em 20-03-2013 18:43, Yuan, Rebecca escreveu: Hello all, I thought I found it, it is in the arima.R if I use arima to fit the model. But how could we see the source code of some function in R? Thanks, Rebecca From: Yuan, Rebecca Sent: Wednesday, March 20, 2013 2:38 PM To: R help Subject: How to look at the source code for predict() Hello, I try to look at the source code of predict() it turns out that I cannot find it. I can see it with debug(library), but not efficient. Can someone help? Thanks, Rebecca -- This message, and any attachments, is for the intended...{{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Excuse me
I could have sworn I could not to this in 2.10 or something like that. Thanks for saying it is still there. John Kane Kingston ON Canada -Original Message- From: kevin.tho...@utoronto.ca Sent: Thu, 21 Mar 2013 08:52:17 -0400 To: jrkrid...@inbox.com Subject: Re: [R] Excuse me On 03/21/2013 08:38 AM, John Kane wrote: If I remember correctly this was possible a few versions ago but was dropped. To do it now you need to use write.table and set row.names = FALSE. John Kane Kingston ON Canada I used write.csv with row.names=FALSE yesterday with no issues at all in the current version of R. Kevin -Original Message- From: lina...@pku.edu.cn Sent: Thu, 21 Mar 2013 16:27:18 +0800 (CST) To: r-help@r-project.org Subject: [R] Excuse me Dear R software faculty: B B B B B B There is a question bothering me. That is why we can not set the property of row.names=false when we output csv data. But there exists that parameter in R help. Hoping for your reply! Best regards! B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B Li Nan -- Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 on indicator variables
I have two indicator variables ABS and DEFF. I want to create another indicator variable which will take value 1 if either ABS=1 or DEFF=1. Otherwise, it will take value 0. How can I make that? [[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] Need help to plot clara results [clustering]
I am going to use clara for gene expression analysis, so tried to play around with the examples from R document: http://127.0.0.1:10699/library/cluster/html/clara.html Everything looked fine until I tried to plot the results: it says: waiting to confirm page change... I waited for more than 10 min and NO plot came out... Should I wait longer? Anything wrong like this? Thanks for any input:) And the code and results: = x - rbind(cbind(rnorm(200,0,8), rnorm(200,0,8)), + cbind(rnorm(300,50,8), rnorm(300,50,8))) clarax - clara(x, 2, samples=50) clarax Call: clara(x = x, k = 2, samples = 50) Medoids: [,1] [,2] [1,] -0.9695444 0.3985362 [2,] 49.4829294 49.9229633 Objective function: 9.786942 Clustering vector: int [1:500] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 200 300 Best sample: [1] 2 20 21 89 91 104 106 107 129 151 163 188 189 193 217 222 231 235 244 [20] 265 266 288 304 305 313 323 324 339 352 371 387 406 407 412 423 436 441 443 [39] 448 459 461 462 490 494 Available components: [1] sample medoids i.med clustering objective [6] clusinfo diss call silinfo data clarax$clusinfo size max_diss av_diss isolation [1,] 200 24.39542 9.871896 0.3450682 [2,] 300 27.28630 9.730307 0.3859591 all.equal(clarax[-8], + clara(x, 2, samples=50, pamLike = TRUE)[-8]) [1] TRUE plot(clarax) Waiting to confirm page change... [[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] Help on indicator variables
Try ifelse(ABS ==1 | DEFF == 1, 1, 0) HTH, Jorge.- On Fri, Mar 22, 2013 at 12:02 AM, Tasnuva Tabassum t.tasn...@gmail.comwrote: I have two indicator variables ABS and DEFF. I want to create another indicator variable which will take value 1 if either ABS=1 or DEFF=1. Otherwise, it will take value 0. How can I make that? [[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.
[R] multiple peak fit
Hi I went through some extensive search to find suitable method (package, function) to fit multiple peaks. The best I found is ALS package but it requires rather complicated input structure probably resulting from GC-MS experimental data and seems to be an overkill to my problem. I have basically simple two column data frame with columns time and sig dput(temp) structure(list(time = c(33, 34, 37.3, 44.7, 56, 70, 85, 99.7, 114, 127.3, 140, 151.7, 163, 174, 185, 196, 206.7, 217.3, 228, 238.7, 249.3, 260, 271, 282, 292.7, 303.7, 314.3, 325.3, 336, 346.7, 357.3, 368, 379, 389.7, 400.3, 411, 421.7, 432.3, 443, 454, 465, 476, 487, 497.7, 508.3, 519, 530, 541, 551.7, 562.3, 573, 584, 595, 606, 616.7, 627.3, 638, 649, 659.7, 670.3, 681, 692, 703, 713.7, 724.3, 735, 746, 757, 768, 779, 789), sig = c(1.558, 1.5549, 1.5619, 1.5614, 1.5618, 1.6044, 1.6161, 1.6287, 1.6432, 1.6925, 1.7273, 1.6932, 1.669, 1.6863, 1.6962, 1.7186, 1.7513, 1.8325, 1.9181, 2.01, 2.1276, 2.2821, 2.5596, 2.9844, 4.1272, 13.421, 15.422, 14.119, 11.491, 8.8799, 6.7774, 5.6223, 4.8775, 4.3628, 4.0517, 3.9146, 3.8704, 3.9162, 4.0372, 4.0948, 4.2054, 4.1221, 3.9145, 3.5724, 3.2108, 2.8311, 2.4605, 2.1985, 1.9685, 1.8158, 1.7487, 1.692, 1.6565, 1.6374, 1.609, 1.5927, 1.5401, 1.5366, 1.5614, 1.5314, 1.4989, 1.5053, 1.4953, 1.4824, 1.4743, 1.4468, 1.4698, 1.4671, 1.4675, 1.4704, 1.4966)), .Names = c(time, sig), row.names = c(NA, -71L), class = data.frame) When it is plotted there are clearly 2 peaks visible. plot(temp, type=l) Does anybody know how to decompose those data to two (or more) gaussian (or other) peaks? I can only think about nlme but before I start from scratch I try to ask others. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] boxplot
Your variable loc_type combines information from two variables (loc and type). Since you are subsetting on loc, why not just plot by type? boxplot(var1~type, data[data$loc==nice,]) -- 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-bounces@r- project.org] On Behalf Of Jim Lemon Sent: Thursday, March 21, 2013 4:05 AM To: carol white Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] boxplot On 03/21/2013 07:40 PM, carol white wrote: Hi, It must be an easy question but how to boxplot a subset of data: data = read.table(my_data.txt, header = T) boxplot(data$var1[data$loc == nice]~data$loc_type[data$loc == nice]) #in this case, i want to display only the boxplot loc == nice #doesn't display the boxplot of only loc == nice. It also displays loc == mice Hi Carol, It's them old factors sneakin' up on you. Try this: boxplot(data$var1[data$loc == nice]~ as.character(data$loc_type[data$loc == nice])) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to store data frames into pdf file and csv file.
Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Could I get the following stats from arima()?
Hello all, I use the arima to get a model, i.e. fit = arima(x,order=c(1,0,0)) and I know I can get the following from fit via est.coef = coef(fig) est.aic = fit$aic std.err = sqrt(diag(vcov(fit))) t.stat = est.coef/std.err How can I get the following stat from arima? Pr(|t|) r2 adjust_r2 rmse Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to store data frames into pdf file and csv file.
Well, you might start by reading ?pdf, where you will find that it is for storing **graphics** not data! Then read ?write.table -- but this will be a text file, not a pdf. -- Bert On Thu, Mar 21, 2013 at 6:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended...{{dropped:25}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to store data frames into pdf file and csv file.
Here is one way of doing it: x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to store data frames into pdf file and csv file.
Hello Jim, I tried the following as you mentioned, but I still do not have the error while opening the pdf file. pdf(file = result2, paper = a4r) mdl.summary.out-capture.output(mdl.summary) plot.new() text(0,0,paste(mdl.summary.out,collapse='\n'),family='mono') dev.off() I believe this time we try to use pdf to catch the graph via text, are we? Thanks, Rebecca From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, March 21, 2013 9:44 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to store data frames into pdf file and csv file. Here is one way of doing it: x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.commailto:rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:23}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How could I specify no interception term in arima?
Hello, I cannot find it in ?arima, does someone know how to specify no interception term in arima? Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to store data frames into pdf file and csv file.
Here is the script I ran to get PDF output which is attached: x # capture the output as a string vector xo - capture.output(x) pdf('/temp/output.pdf') plot.new() # new page # now add text to plot text(0 , 0.5 , paste(xo, collapse = '\n') , family = 'mono' , cex = 0.6 , adj = c(0,0) ) dev.off() On Thu, Mar 21, 2013 at 9:49 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello Jim, ** ** I tried the following as you mentioned, but I still do not have the error while opening the pdf file. ** ** pdf(file = result2, paper = a4r) mdl.summary.out-capture.output(mdl.summary)** ** plot.new() text(0,0,paste(mdl.summary.out,collapse='\n'),family='mono') dev.off() ** ** I believe this time we try to use pdf to catch the graph via text, are we? ** ** Thanks, ** ** Rebecca ** ** *From:* jim holtman [mailto:jholt...@gmail.com] *Sent:* Thursday, March 21, 2013 9:44 AM *To:* Yuan, Rebecca *Cc:* R help *Subject:* Re: [R] How to store data frames into pdf file and csv file.*** * ** ** Here is one way of doing it: ** ** x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') ** ** ** ** On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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? Tell me what you want to do, not how you want to do it. -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. output.pdf Description: Adobe PDF document __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help on indicator variables
On 03/21/2013 02:08 PM, Jorge I Velez wrote: Try ifelse(ABS ==1 | DEFF == 1, 1, 0) or as.numeric(ABS | DEFF) (faster?) Göran HTH, Jorge.- On Fri, Mar 22, 2013 at 12:02 AM, Tasnuva Tabassum t.tasn...@gmail.comwrote: I have two indicator variables ABS and DEFF. I want to create another indicator variable which will take value 1 if either ABS=1 or DEFF=1. Otherwise, it will take value 0. How can I make that? [[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. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] bigmemory: Using backing file as alternate to write.big.matrix
OK, did a test where I did both - wrote a ~6Mx58 double matrix as a .txt file (write.big.matrix), but also left the backing file + descriptor file as-is (rather than deleting it as I usually do). Opened a different R session. Compared contents of first 100 rows of both, they seem identical. Size-wise, the .bin file is over twice the size of the .txt file (here .bin was 2,641Mb and .txt was 1,184Mb). So my conclusion is this: if the matrix will be read often by downstream programs, save as .bin. Code that reads the matrix can just attach it, which is super fast (0.002s elapsed; in contrast, using read.big.matrix to read the .txt version took 76s on my machine). If space is a constraint and the matrix isn't expected to be read in very often, then save as text file and read using read.big.matrix. - library(bigmemory) m - attach.big.matrix(rawXpr.desc) # attach descriptor -- super fast n - read.table(rawXpr.txt,sep=\t,header=F,as.is=T,nrow=100) # same context saved as txt - read 100 rows for test. n - as.matrix(n) # was a data.frame before sapply(1:nrow(n), function(x) { print(all.equal(n[x,], m[x,])) } ) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE - -- View this message in context: http://r.789695.n4.nabble.com/bigmemory-Using-backing-file-as-alternate-to-write-big-matrix-tp4661958p4662055.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] How to store data frames into pdf file and csv file.
Hello Jim, This graphics.off() helps me to release the previous pdf file that was had the error message. Thanks again for your help! Cheers, Rebecca From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, March 21, 2013 10:07 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to store data frames into pdf file and csv file. If you are getting an error when trying to open the PDF file, then you may of had a error writing out a previous file. I always issue the following command to clear out any pending graphic output: graphics.off() On Thu, Mar 21, 2013 at 9:49 AM, Yuan, Rebecca rebecca.y...@bankofamerica.commailto:rebecca.y...@bankofamerica.com wrote: Hello Jim, I tried the following as you mentioned, but I still do not have the error while opening the pdf file. pdf(file = result2, paper = a4r) mdl.summary.out-capture.output(mdl.summary) plot.new() text(0,0,paste(mdl.summary.out,collapse='\n'),family='mono') dev.off() I believe this time we try to use pdf to catch the graph via text, are we? Thanks, Rebecca From: jim holtman [mailto:jholt...@gmail.commailto:jholt...@gmail.com] Sent: Thursday, March 21, 2013 9:44 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to store data frames into pdf file and csv file. Here is one way of doing it: x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.commailto:rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.orgmailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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? Tell me what you want to do, not how you want to do it. This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at
Re: [R] How to store data frames into pdf file and csv file.
Hello Jim, Thanks very much! This time I am able to get the pdf file. Best regards, Rebecca From: jim holtman [mailto:jholt...@gmail.com] Sent: Thursday, March 21, 2013 10:04 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to store data frames into pdf file and csv file. Here is the script I ran to get PDF output which is attached: x # capture the output as a string vector xo - capture.output(x) pdf('/temp/output.pdf') plot.new() # new page # now add text to plot text(0 , 0.5 , paste(xo, collapse = '\n') , family = 'mono' , cex = 0.6 , adj = c(0,0) ) dev.off() On Thu, Mar 21, 2013 at 9:49 AM, Yuan, Rebecca rebecca.y...@bankofamerica.commailto:rebecca.y...@bankofamerica.com wrote: Hello Jim, I tried the following as you mentioned, but I still do not have the error while opening the pdf file. pdf(file = result2, paper = a4r) mdl.summary.out-capture.output(mdl.summary) plot.new() text(0,0,paste(mdl.summary.out,collapse='\n'),family='mono') dev.off() I believe this time we try to use pdf to catch the graph via text, are we? Thanks, Rebecca From: jim holtman [mailto:jholt...@gmail.commailto:jholt...@gmail.com] Sent: Thursday, March 21, 2013 9:44 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How to store data frames into pdf file and csv file. Here is one way of doing it: x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.commailto:rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.orgmailto:R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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? Tell me what you want to do, not how you want to do it. This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and
Re: [R] How to store data frames into pdf file and csv file.
If you are getting an error when trying to open the PDF file, then you may of had a error writing out a previous file. I always issue the following command to clear out any pending graphic output: graphics.off() On Thu, Mar 21, 2013 at 9:49 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello Jim, ** ** I tried the following as you mentioned, but I still do not have the error while opening the pdf file. ** ** pdf(file = result2, paper = a4r) mdl.summary.out-capture.output(mdl.summary)** ** plot.new() text(0,0,paste(mdl.summary.out,collapse='\n'),family='mono') dev.off() ** ** I believe this time we try to use pdf to catch the graph via text, are we? ** ** Thanks, ** ** Rebecca ** ** *From:* jim holtman [mailto:jholt...@gmail.com] *Sent:* Thursday, March 21, 2013 9:44 AM *To:* Yuan, Rebecca *Cc:* R help *Subject:* Re: [R] How to store data frames into pdf file and csv file.*** * ** ** Here is one way of doing it: ** ** x est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa-0.0813727439 0.0163727943 -4.969997 dummy1-0.0002534873 0.0001204000 -2.105376 dummy2-0.0007784864 0.0001437537 -5.415417 bb-0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 # capture the output as a string vector xo - capture.output(x) plot.new() # new page # now add text to plot text(0, 0, paste(xo, collapse = '\n'), family = 'mono') ** ** ** ** On Thu, Mar 21, 2013 at 9:20 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, I have a data frame mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc0.0003563825 0.0001114803 3.196820 and would like to store it to a pdf file, I use pdf(file = a.pdf, paper = a4r) mdl.summary dev.off() to store this mdl.summary into a pdf file a.pdf. However, I can see from the terminal that: pdf(file = result2, paper = a4r) mdl.summary est.coef std.errt.stat intercept 0.0011625517 0.0002671437 4.351784 aa -0.0813727439 0.0163727943 -4.969997 dummy1 -0.0002534873 0.0001204000 -2.105376 dummy2 -0.0007784864 0.0001437537 -5.415417 bb -0.0002856727 0.0001090387 -2.619920 cc 0.0003563825 0.0001114803 3.196820 dev.off() pdf 2 And when I open the a.pdf, the error message says There was an error opening this document. The file is already open or in use by another application. How could I save this data frame into a pdf file? If I have another data frame, such as st = data.frame(est.aic, est.aic) st est.aic est.aic.1 1 -1654.986 -1654.986 How could I save it to a .csv file? Thanks very much! Cheers, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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? Tell me what you want to do, not how you want to do it. -- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at http://www.bankofamerica.com/emaildisclaimer. If you are not the intended recipient, please delete this message. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. [[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] Bayesian network
HeLLo, I'm new in R, I would like to use it for diagnostics with bayesian network, I want to know how can I calculate inference and if can I enter my probability tables like logical or arithmetic equation, Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-network-tp4662059.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 message installing package R package
I am getting error messages while installing R package lme4. Please advice thanks Pramod trying URL 'http://cran.mtu.edu/src/contrib/lme4_0.99-0.tar.gz' Content type 'application/x-gzip' length 1074142 bytes (1.0 Mb) opened URL == downloaded 1.0 Mb * installing *source* package 'lme4' ... ** package 'lme4' successfully unpacked and MD5 sums checked ** libs /share/apps/R-2.15.3/share/make/shlib.mk:6: warning: overriding commands for target `lme4.so' Makevars:7: warning: ignoring old commands for target `lme4.so' gcc -std=gnu99 -I/share/apps/R-2.15.3/include -DNDEBUG -I/usr/local/include -I/share/apps/R-2.15.3/library/Matrix/include -I/share/apps/R-2.15.3/library/stats/include -fpic -g -O2 -c init.c -o init.o gcc -std=gnu99 -I/share/apps/R-2.15.3/include -DNDEBUG -I/usr/local/include -I/share/apps/R-2.15.3/library/Matrix/include -I/share/apps/R-2.15.3/library/stats/include -fpic -g -O2 -c lmer.c -o lmer.o gcc -std=gnu99 -I/share/apps/R-2.15.3/include -DNDEBUG -I/usr/local/include -I/share/apps/R-2.15.3/library/Matrix/include -I/share/apps/R-2.15.3/library/stats/include -fpic -g -O2 -c local_stubs.c -o local_stubs.o gcc -std=gnu99 -shared -L/usr/local/lib64 -o lme4.so init.o lmer.o local_stubs.o -L/share/apps/R-2.15.3/lib -lRlapack -L/share/apps/R-2.15.3/lib -lRblas -lgfortran -lm /usr/bin/ld: cannot find -lgfortran collect2: ld returned 1 exit status make: *** [lme4.so] Error 1 ERROR: compilation failed for package 'lme4' * removing '/share/apps/R-2.15.3/library/lme4' The downloaded source packages are in '/tmp/RtmpcTIcHw/downloaded_packages' Updating HTML index of packages in '.Library' Making packages.html ... done Warning message: In install.packages(lme4) : installation of package 'lme4' had non-zero exit status [[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] Help on indicator variables
I would use a logical variable, with values TRUE and FALSE, instead of a numeric indicator. E.g., I find the following easier to follow bL - ABS==1 | DEFF==1 if (any(bL)) { do.this() } than bN - ifelse(ABS == 1 | DEFF == 1, 1, 0) if (any(bN == 1)) { do.this() } The latter leaves me wondering what other values bN might have; the former makes it clear this is a TRUE/FALSE dichotomy. Logicals get converted to numbers (FALSE-0, TRUE-1) when used in arithmetic so you can do, e.g., mean(bL) to see what proportion of your cases satisfy the condition. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tasnuva Tabassum Sent: Thursday, March 21, 2013 6:03 AM To: R help Subject: [R] Help on indicator variables I have two indicator variables ABS and DEFF. I want to create another indicator variable which will take value 1 if either ABS=1 or DEFF=1. Otherwise, it will take value 0. How can I make that? [[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] Re-order variables listed in nomogram?
Hi, I am using the function nomogram in the rms package for survival analysis. How is the order in which variables determined and how can I change it? I use it with a cph() model. Many Thanks Eleni Rapsomaniki Clinical Epidemiology Group Department of Epidemiology and Public Health University College London __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] NADA
According to ?ros, one of the arguments is: reverseT: A name of a function to use for reversing the transformation after performing the ROS fit. Defaults to 'exp'. And in the Details section: By default, 'ros' performs a log transformation prior to, and after operations over the data. Given those statements, perhaps the expectation should be a plot in original units? Keep in mind that a main purpose is summary statistics in the original units. After running the first example in ?ros, including the plot, try these: unclass(myros) abline(h=myros$modeled,col='blue') -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/20/13 5:48 PM, Janh Anni annij...@gmail.com wrote: Dear Users Regarding the NADA package, would anyone be able to help me understand what values are actually plotted on the Y axis of the plot obtained by using the *ros* function on the data and plotting the result with the plot() function? The Y axis is labeled Values. According to the NADA user manual, ros performs a log transformation of the data by default, but the user can specify no transformation, or some other transformation besides log, if desired. However the values plotted on the Y axis appear to be the raw data values, regardless of which transformation or no transformation was used. If the log transformation is used for instance, I would have expected the logs of the original data instead of the raw data to be plotted on the Y axis. Thanks for your help. Janh [[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] adaptIntegrate function
Hi all, it seems that there is problem with function adaptIntegrate, when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(cubature) ff - function(x, rho){ mu - rep(0,3) Sigma -(1-rho)*diag(3)+matrix(rho,3,3) f - dmnorm(x, mu, Sigma) f } adaptIntegrate(ff, lower=c(-10, -10, -10), upper=c(3,2,1), rho=0.1, maxEval=1) adaptIntegrate(ff, lower=rep(-Inf, 3), upper=c(3,2,1), rho=0.1, maxEval=1) [[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] easy way of paste
Hello, Is there a better way to use paste such as: a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.indep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep=+) a [1] aa+dummy1+dummy2+bb+cc I tried a = paste(colnames(list.indep)[1:5],sep=+) a [1] aa dummy1 dummy2 bb cc But it will not give me the way I want. Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] easy way of paste
It looks like you want collapse rather than sep: list.indep - data.frame(aa=1:4, dummy1=1:4, dummy2=1:4, bb=1:4, cc=1:4) paste(colnames(list.indep), collapse=+) [1] aa+dummy1+dummy2+bb+cc On Thu, Mar 21, 2013 at 11:15 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, Is there a better way to use paste such as: a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.indep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep=+) a [1] aa+dummy1+dummy2+bb+cc I tried a = paste(colnames(list.indep)[1:5],sep=+) a [1] aa dummy1 dummy2 bb cc But it will not give me the way I want. Thanks, Rebecca -- 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] adaptIntegrate function
Under ?adaptIntegrate, you will find the link to http://ab-initio.mit.edu/wiki/index.php/Cubature#Infinite_intervals, where it says that Integrals over infinite or semi-infinite intervals is possible by a change of variables. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of li li Sent: Donnerstag, 21. März 2013 16:10 To: r-help Subject: [R] adaptIntegrate function Hi all, it seems that there is problem with function adaptIntegrate, when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(cubature) ff - function(x, rho){ mu - rep(0,3) Sigma -(1-rho)*diag(3)+matrix(rho,3,3) f - dmnorm(x, mu, Sigma) f } adaptIntegrate(ff, lower=c(-10, -10, -10), upper=c(3,2,1), rho=0.1, maxEval=1) adaptIntegrate(ff, lower=rep(-Inf, 3), upper=c(3,2,1), rho=0.1, maxEval=1) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] easy way of paste
dat2-as.data.frame(matrix(1:20,ncol=5)) colnames(dat2)- c(aa,dummy1,dummy2,bb,cc) paste(colnames(dat2),collapse=+) #[1] aa+dummy1+dummy2+bb+cc A.K. - Original Message - From: Yuan, Rebecca rebecca.y...@bankofamerica.com To: R help r-help@r-project.org Cc: Sent: Thursday, March 21, 2013 11:15 AM Subject: [R] easy way of paste Hello, Is there a better way to use paste such as: a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.indep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep=+) a [1] aa+dummy1+dummy2+bb+cc I tried a = paste(colnames(list.indep)[1:5],sep=+) a [1] aa dummy1 dummy2 bb cc But it will not give me the way I want. Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] new question
Sorry, I am not sure I understand your question. You have 5 boxplots(if I remember correctly) on a single page and these 5 boxplots have titles a1,a2,c1,c2,t1 (or something like that). Could you try: par(mfcol(c(3,2)) and see if that helps. (not tested) A.K. From: Vera Costa veracosta...@gmail.com To: arun smartpink...@yahoo.com Sent: Thursday, March 21, 2013 11:24 AM Subject: Re: new question Hi. Thank you your help and sorry only answer now. Ok, the boxplots is ok. But I need too by group... on par(mfrow(c(2,2))), I can have par(mfrow(c(3,2)), for example (or more) and have a boxplot for the group. You can help me to group them? About the other function I need to do other things, but now I need to think what to do... Thank you 2013/3/18 arun smartpink...@yahoo.com z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) print(new.list) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplot(ListFacGroup) #prints new.list If you want to turn off that: z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) #print(new.list) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplot(ListFacGroup) A.K. From: Vera Costa veracosta...@gmail.com To: arun smartpink...@yahoo.com Sent: Monday, March 18, 2013 1:59 PM Subject: Re: new question For example, if I run you code without pdf and dev.off I have what I want directory- C:/Users/Vera Costa/Desktop/dados.lixo #modified the function GetFileList - function(directory,number){ setwd(directory) filelist1-dir() lista-dir(directory,pattern = paste(MSMS_,number,PepInfo.txt,sep=), full.names = TRUE, recursive = TRUE) output- list(filelist1,lista) return(output) } file.list.names-GetFileList(directory,23)[[1]] lista-GetFileList(directory,23)[[2]] FacGroup-c(0,1,0,2,2,0,3) ReadDir-function(FacGroup){ list.new-lista[FacGroup!=0] read.list-lapply(list.new, function(x) read.table(x,header=TRUE, sep = \t)) names(read.list)-file.list.names[FacGroup!=0] return (read.list) } ListFacGroup-ReadDir(FacGroup) ListFacGroup z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) print(new.list) #pdf(VeraBP.pdf) par(mfrow=c(2,2)) lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) #dev.off() } z.boxplot(ListFacGroup) But I have the results too (I don't need it) [[1]] [[1]]$a2 [[1]]$a2$stats [,1] [,2] [1,] 0.00 0.00 [2,] 0.00 0.00 [3,] 0.0001355197 0.0002175095 [4,] 0.0010588777 0.0004350190 [5,] 0.0016571381 0.0004350190 [[1]]$a2$n [1] 8 2 [[1]]$a2$conf [,1] [,2] [1,] -0.0004559846 -0.0002685062 [2,] 0.0007270240 0.0007035253 [[1]]$a2$out [1] 0.00494012 [[1]]$a2$group [1] 1 [[1]]$a2$names [1] 2 3 [[2]] [[2]]$c2 [[2]]$c2$stats [,1] [,2] [1,] 0.00 0.00 [2,] 0.00 0.00 [3,] 0.0001355197 0.0002175095 [4,] 0.0010588777 0.0004350190 [5,] 0.0016571381 0.0004350190 [[2]]$c2$n [1] 8 2 [[2]]$c2$conf [,1] [,2] [1,] -0.0004559846 -0.0002685062 [2,] 0.0007270240 0.0007035253 [[2]]$c2$out [1] 0.00494012 [[2]]$c2$group [1] 1 [[2]]$c2$names [1] 2 3 [[3]] [[3]]$c3 [[3]]$c3$stats [,1] [,2] [1,] 0.0 0.00 [2,] 0.0 0.00 [3,] 0.0 0.00 [4,] 0.002226409 0.0002086594 [5,] 0.002226409 0.0004173187 [[3]]$c3$n [1] 6 4 [[3]]$c3$conf [,1] [,2] [1,] -0.001436105 -0.0001648409 [2,] 0.001436105 0.0001648409 [[3]]$c3$out [1] 0.00560348 [[3]]$c3$group [1] 1 [[3]]$c3$names [1] 2 3 [[4]] [[4]]$t2 [[4]]$t2$stats [,1] [,2] [,3] [1,] 0 0.00 0 [2,] 0 0.00 0 [3,] 0 0.0002908668 0 [4,] 0 0.0025929827 0 [5,] 0 0.005251 0 [[4]]$t2$n [1] 1 10 5 [[4]]$t2$conf [,1] [,2] [,3] [1,] 0 -0.001004691 0 [2,] 0 0.001586424 0 [[4]]$t2$out [1] 0.0092051934 0.0007174888 [[4]]$t2$group [1] 2 3 [[4]]$t2$names [1] 1 2 3 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to skip part of the code
Pikal and Robert, sorry for previous email, indeed, the code is working just fine! Thanks for the pointer David Winsemius, you were right, I was getting a character as numeric(0), which the system did not recognize as the number 0, thus the openBUGS run was called. Thanks for the help guys! Andras --- On Wed, 3/20/13, Robert Baer rb...@atsu.edu wrote: From: Robert Baer rb...@atsu.edu Subject: Re: [R] how to skip part of the code To: PIKAL Petr petr.pi...@precheza.cz Cc: Andras Farkas motyoc...@yahoo.com, r-help@r-project.org r-help@r-project.org Date: Wednesday, March 20, 2013, 9:27 AM On 3/20/2013 8:21 AM, PIKAL Petr wrote: Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Andras Farkas Sent: Wednesday, March 20, 2013 2:11 PM To: r-help@r-project.org Subject: [R] how to skip part of the code Dear All, another quick question, this one is on skipping part of my code, so let us say: a -5 b -2 e -0 d -a+b f -a-b what I would like to do is to have R NOT to calculate the value for d in case the value of e equals to zero (essentially skip that chunk), but instead move on to calculate te value for f. In the code I am working with the value of e changes, and I would like to calculate d and f at all times when the value of e is greater then zero. If possible, I would like to do this without using the functions ifelse and if else Why? This is exactly the reason for which if else was invented? I am not sure if some simple solution without if is available. if (e 0) { d - a+b; f - a-b } seems to be simple. Regards Petr I second Petr on the question, why not use if? But this might meet your criteria. a - 5 b - 2 e - 0 # dat - data.frame(a, b, e) dat$d[dat$e 0] - a + b dat$f - a - b appreciate the help, Andras [[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. -- Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA [[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] Bayesian network
You might want to start by reading the Bayesian task view at http://probability.ca/cran/ John Kane Kingston ON Canada -Original Message- From: s_zerm...@esi.dz Sent: Thu, 21 Mar 2013 07:06:40 -0700 (PDT) To: r-help@r-project.org Subject: [R] Bayesian network HeLLo, I'm new in R, I would like to use it for diagnostics with bayesian network, I want to know how can I calculate inference and if can I enter my probability tables like logical or arithmetic equation, Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-network-tp4662059.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. FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] adaptIntegrate function
Got it. Thank you very much! library(mnormt) library(cubature) ff - function(x, rho){ mu - rep(0,3) Sigma -(1-rho)*diag(3)+matrix(rho,3,3) f - dmnorm(x/(1-x^2), mu, Sigma)*((1+x^2)/(1-x^2)^2) f } adaptIntegrate(ff, lower=rep(-1, 3), upper=rep(1,3), rho=0, maxEval=1) 2013/3/21 Blaser Nello nbla...@ispm.unibe.ch Under ?adaptIntegrate, you will find the link to http://ab-initio.mit.edu/wiki/index.php/Cubature#Infinite_intervals, where it says that Integrals over infinite or semi-infinite intervals is possible by a change of variables. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of li li Sent: Donnerstag, 21. März 2013 16:10 To: r-help Subject: [R] adaptIntegrate function Hi all, it seems that there is problem with function adaptIntegrate, when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(cubature) ff - function(x, rho){ mu - rep(0,3) Sigma -(1-rho)*diag(3)+matrix(rho,3,3) f - dmnorm(x, mu, Sigma) f } adaptIntegrate(ff, lower=c(-10, -10, -10), upper=c(3,2,1), rho=0.1, maxEval=1) adaptIntegrate(ff, lower=rep(-Inf, 3), upper=c(3,2,1), rho=0.1, maxEval=1) [[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.htmlhttp://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] how to skip part of the code
On Mar 21, 2013, at 8:30 AM, Andras Farkas wrote: Pikal and Robert, sorry for previous email, indeed, the code is working just fine! Thanks for the pointer David Winsemius, you were right, I was getting a character as numeric(0), which the system did not recognize as the number 0, thus the openBUGS run was called. That is NOT zero. Actually you were getting a vector of length == 0. numeric(0) == 0 logical(0) isTRUE(numeric(0) == 0) [1] FALSE Some sort of selection activity apparently found no matches: (1:10)[(1:10) 0] integer(0) Another potential source of error would be passing an alphabetic value: e 0 #[1] TRUE -- David. Thanks for the help guys! Andras --- On Wed, 3/20/13, Robert Baer rb...@atsu.edu wrote: From: Robert Baer rb...@atsu.edu Subject: Re: [R] how to skip part of the code To: PIKAL Petr petr.pi...@precheza.cz Cc: Andras Farkas motyoc...@yahoo.com, r-help@r-project.org r-help@r-project.org Date: Wednesday, March 20, 2013, 9:27 AM On 3/20/2013 8:21 AM, PIKAL Petr wrote: Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Andras Farkas Sent: Wednesday, March 20, 2013 2:11 PM To: r-help@r-project.org Subject: [R] how to skip part of the code Dear All, another quick question, this one is on skipping part of my code, so let us say: a -5 b -2 e -0 d -a+b f -a-b what I would like to do is to have R NOT to calculate the value for d in case the value of e equals to zero (essentially skip that chunk), but instead move on to calculate te value for f. In the code I am working with the value of e changes, and I would like to calculate d and f at all times when the value of e is greater then zero. If possible, I would like to do this without using the functions ifelse and if else Why? This is exactly the reason for which if else was invented? I am not sure if some simple solution without if is available. if (e 0) { d - a+b; f - a-b } seems to be simple. Regards Petr I second Petr on the question, why not use if? But this might meet your criteria. a - 5 b - 2 e - 0 # dat - data.frame(a, b, e) dat$d[dat$e 0] - a + b dat$f - a - b appreciate the help, Andras [[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. -- Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA [[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. David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] easy way of paste
Hello Sarah, Yes, that is what I want. Thanks! Cheers, Rebecca -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: Thursday, March 21, 2013 11:21 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] easy way of paste It looks like you want collapse rather than sep: list.indep - data.frame(aa=1:4, dummy1=1:4, dummy2=1:4, bb=1:4, cc=1:4) paste(colnames(list.indep), collapse=+) [1] aa+dummy1+dummy2+bb+cc On Thu, Mar 21, 2013 at 11:15 AM, Yuan, Rebecca rebecca.y...@bankofamerica.com wrote: Hello, Is there a better way to use paste such as: a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.in dep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep=+) a [1] aa+dummy1+dummy2+bb+cc I tried a = paste(colnames(list.indep)[1:5],sep=+) a [1] aa dummy1 dummy2 bb cc But it will not give me the way I want. Thanks, Rebecca -- Sarah Goslee http://www.functionaldiversity.org -- This message, and any attachments, is for the intended r...{{dropped:2}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] easy way of paste
Hello A.K., Thanks! I use collapse instead of sep and get the answer. Cheers, Rebecca -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Thursday, March 21, 2013 11:21 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] easy way of paste dat2-as.data.frame(matrix(1:20,ncol=5)) colnames(dat2)- c(aa,dummy1,dummy2,bb,cc) paste(colnames(dat2),collapse=+) #[1] aa+dummy1+dummy2+bb+cc A.K. - Original Message - From: Yuan, Rebecca rebecca.y...@bankofamerica.com To: R help r-help@r-project.org Cc: Sent: Thursday, March 21, 2013 11:15 AM Subject: [R] easy way of paste Hello, Is there a better way to use paste such as: a = paste(colnames(list.indep)[1],colnames(list.indep)[2],colnames(list.indep)[3],colnames(list.indep)[4],colnames(list.indep)[5],sep=+) a [1] aa+dummy1+dummy2+bb+cc I tried a = paste(colnames(list.indep)[1:5],sep=+) a [1] aa dummy1 dummy2 bb cc But it will not give me the way I want. Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:15}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] rJava problem on ubuntu
i'm having trouble using rJava on ubuntu 11.10 amd 64-bit. when i try to source my code that uses rJava, i get the following error: Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib/R/site-library/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory Error: package/namespace load failed for 'rJava' the rJava.so does indeed exist in the above location. prior to sourcing the file, i ran the following: sudo R CMD javareconf JAVA_HOME=/usr/lib/jvm/default-java/jre/ Java interpreter : /usr/lib/jvm/default-java/jre//bin/java Java version : 1.7.0_11 Java home path : /usr/lib/jvm/default-java/jre/ Java compiler: /usr/lib/jvm/default-java/jre//../bin/javac Java headers gen.: /usr/lib/jvm/default-java/jre//../bin/javah Java archive tool: /usr/lib/jvm/default-java/jre//../bin/jar Java library path: :/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib JNI linker flags : -L -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm JNI cpp flags: -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux Updating Java configuration in /etc/R Done. i suspect there is a problem with locating the libjvm.so file. any help with tracking down the problem would be greatly appeciated. thank you. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 message installing package R package
Pramod Anugu pramod.r.anugu at jsums.edu writes: I am getting error messages while installing R package lme4. Please advice This would be better on the r-sig-mixed-mod...@r-project.org list. You haven't told us, but I'm guess from what you've pasted below that you're on a Unix system, and most obviously one without the 'gfortran' FORTRAN compiler installed. The procedures for installing gfortran will be system-specific (for Linux probably either apt-get install ... or yum ...) -- there may be useful instructions on the web, or on the main r-project web site. trying URL 'http://cran.mtu.edu/src/contrib/lme4_0.99-0.tar.gz' Content type 'application/x-gzip' length 1074142 bytes (1.0 Mb) opened URL == downloaded 1.0 Mb [snip] gcc -std=gnu99 -shared -L/usr/local/lib64 -o lme4.so init.o lmer.o local_stubs.o -L/share/apps/R-2.15.3/lib -lRlapack -L/share/apps/R-2.15.3/lib -lRblas -lgfortran -lm /usr/bin/ld: cannot find -lgfortran collect2: ld returned 1 exit status __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] new question
Hi, Try this: directory- /home/arunksa111/dados GetFileList - function(directory,number){ setwd(directory) filelist1-dir()[file.info(dir())$isdir] direct-dir(directory,pattern = paste(MSMS_,number,PepInfo.txt,sep=), full.names = FALSE, recursive = TRUE) direct-lapply(direct,function(x) paste(directory,/,x,sep=)) lista-unlist(direct) output- list(filelist1,lista) return(output) } file.list.names-GetFileList(directory,23)[[1]] lista-GetFileList(directory,23)[[2]] FacGroup-c(0,1,0,2,2,0,3) ReadDir-function(FacGroup){ list.new-lista[FacGroup!=0] read.list-lapply(list.new, function(x) read.table(x,header=TRUE, sep = \t)) names(read.list)-file.list.names[FacGroup!=0] return (read.list) } ListFacGroup-ReadDir(FacGroup) z.boxplotgroup- function(lst){ lst1- lapply(lst,function(x) x[x$FDR0.01,]) library(plyr) new.list-lapply(split(lst1,gsub(\\d+,,names(lst1))),function(x) join_all(lapply(x,function(x) x),type=full)) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplotgroup(ListFacGroup) z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) #print(new.list) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplot(ListFacGroup) pdf(Veraboxplot.pdf) z.boxplot(ListFacGroup) z.boxplotgroup(ListFacGroup) Joining by: Seq, Mod, z, score, FDR, Count, E, C, pos, spec, Pro dev.off() A.K. From: Vera Costa veracosta...@gmail.com To: arun smartpink...@yahoo.com Sent: Thursday, March 21, 2013 11:24 AM Subject: Re: new question Hi. Thank you your help and sorry only answer now. Ok, the boxplots is ok. But I need too by group... on par(mfrow(c(2,2))), I can have par(mfrow(c(3,2)), for example (or more) and have a boxplot for the group. You can help me to group them? About the other function I need to do other things, but now I need to think what to do... Thank you 2013/3/18 arun smartpink...@yahoo.com z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) print(new.list) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplot(ListFacGroup) #prints new.list If you want to turn off that: z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) #print(new.list) par(mfrow=c(2,2)) b1-lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) } z.boxplot(ListFacGroup) A.K. From: Vera Costa veracosta...@gmail.com To: arun smartpink...@yahoo.com Sent: Monday, March 18, 2013 1:59 PM Subject: Re: new question For example, if I run you code without pdf and dev.off I have what I want directory- C:/Users/Vera Costa/Desktop/dados.lixo #modified the function GetFileList - function(directory,number){ setwd(directory) filelist1-dir() lista-dir(directory,pattern = paste(MSMS_,number,PepInfo.txt,sep=), full.names = TRUE, recursive = TRUE) output- list(filelist1,lista) return(output) } file.list.names-GetFileList(directory,23)[[1]] lista-GetFileList(directory,23)[[2]] FacGroup-c(0,1,0,2,2,0,3) ReadDir-function(FacGroup){ list.new-lista[FacGroup!=0] read.list-lapply(list.new, function(x) read.table(x,header=TRUE, sep = \t)) names(read.list)-file.list.names[FacGroup!=0] return (read.list) } ListFacGroup-ReadDir(FacGroup) ListFacGroup z.boxplot- function(lst){ new.list- lapply(lst,function(x) x[x$FDR0.01,]) print(new.list) #pdf(VeraBP.pdf) par(mfrow=c(2,2)) lapply(names(new.list),function(x) lapply(new.list[x],function(y) boxplot(FDR~z,data=y,xlab=Charge,ylab=FDR,main=x))) #dev.off() } z.boxplot(ListFacGroup) But I have the results too (I don't need it) [[1]] [[1]]$a2 [[1]]$a2$stats [,1] [,2] [1,] 0.00 0.00 [2,] 0.00 0.00 [3,] 0.0001355197 0.0002175095 [4,] 0.0010588777 0.0004350190 [5,] 0.0016571381 0.0004350190 [[1]]$a2$n [1] 8 2 [[1]]$a2$conf [,1] [,2] [1,] -0.0004559846 -0.0002685062 [2,] 0.0007270240 0.0007035253 [[1]]$a2$out [1] 0.00494012 [[1]]$a2$group [1] 1 [[1]]$a2$names [1] 2 3 [[2]] [[2]]$c2 [[2]]$c2$stats [,1] [,2] [1,] 0.00 0.00 [2,] 0.00 0.00 [3,] 0.0001355197 0.0002175095 [4,] 0.0010588777 0.0004350190 [5,] 0.0016571381 0.0004350190 [[2]]$c2$n [1] 8 2 [[2]]$c2$conf [,1] [,2] [1,] -0.0004559846 -0.0002685062 [2,] 0.0007270240 0.0007035253 [[2]]$c2$out [1] 0.00494012 [[2]]$c2$group [1] 1 [[2]]$c2$names [1] 2 3 [[3]] [[3]]$c3 [[3]]$c3$stats [,1] [,2] [1,] 0.0 0.00 [2,] 0.0 0.00 [3,] 0.0 0.00 [4,] 0.002226409
[R] Check if a character vector can be coerced to numeric?
Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c(2,3,4) I would like to develop a function that will convert any vectors that can be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves character vectors which cannot be converted (myvect1) alone. Is there any simple way to do this (e.g. some function that tests if a vector is coercible to a numeric before doing so)? --j -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 607 South Mathews Avenue, MC 150 Urbana, IL 61801 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 [[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] Check if a character vector can be coerced to numeric?
On 21/03/2013 18:20, Jonathan Greenberg wrote: Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c(2,3,4) I would like to develop a function that will convert any vectors that can be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves character vectors which cannot be converted (myvect1) alone. Is there any simple way to do this (e.g. some function that tests if a vector is coercible to a numeric before doing so)? --j ?type.convert It does depend what you mean by 'properly'. Can 123.456789012344567890123455 be converted 'properly'? [See the NEWS for R-devel.] -- 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] Check if a character vector can be coerced to numeric?
Using capital letters does not improve clarity... it just offends people. Does read.table and friends not do this to your satisfaction already with as.is=TRUE? If not, shouldn't coercing it and checking for NA serve? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Jonathan Greenberg j...@illinois.edu wrote: Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c(2,3,4) I would like to develop a function that will convert any vectors that can be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves character vectors which cannot be converted (myvect1) alone. Is there any simple way to do this (e.g. some function that tests if a vector is coercible to a numeric before doing so)? --j __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How could I specify no interception term in arima?
Hello, In fact, it's written there, in ?arima: Further, if include.mean is true (the default for an ARMA model), this formula applies to X - m rather than X. So, use include.mean = FALSE Hope this helps, Rui Barradas Em 21-03-2013 13:56, Yuan, Rebecca escreveu: Hello, I cannot find it in ?arima, does someone know how to specify no interception term in arima? Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] how do I read certain files from a directory based on number of columns?
Hi Arun, thank you. I will look through that later on today when I get a chance. I have to complete another part of this project now. Irucka -Original Message- From: arun kirshna [via R] [ml-node+s789695n4661145...@n4.nabble.com] Sent: 3/12/2013 10:35:39 PM To: iruc...@mail2world.com Subject: Re: how do I read certain files from a directory based on number of columns? Hi, Suppose, I have three files File1.txt, File2.txt, File3.txt in a folder. list.files() #[1] File1.txt File2.txt File3.txt read.table(File2.txt,header=TRUE,stringsAsFactors=FALSE) # dload_4 dload_2 d1 #1 1 4 3 #2 4 9 9 #3 3 8 3 lapply(list.files(),function(x) {x1-x[any(scan(file=x,what=,nlines=1)%in% dload_6)]; if(length(x1)!=0) read.table(x1,header=TRUE,stringsAsFactors=FALSE) else NULL}) #Read 3 items #Read 3 items #Read 1 item #[[1]] # dload_4 dload_6 d1 #1 1 5 3 #2 4 6 9 #3 3 4 3 #[[2]] #NULL #[[3]] # dload_6 #1 11 #2 44 #3 33 May be this helps you in getting started. A.K. If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/how-do-I-read-certain-files-from-a-direct ory-based-on-number-of-columns-tp4661144p4661145.html To unsubscribe from how do I read certain files from a directory based on number of columns?, click here. NAML span id=m2wTlpfont face=Arial, Helvetica, sans-serif size=2 style=font-size:13.5px___BRGet the Free email that has everyone talking at a href=http://www.mail2world.com target=newhttp://www.mail2world.com/abr font color=#99Unlimited Email Storage #150; POP3 #150; Calendar #150; SMS #150; Translator #150; Much More!/font/font/span -- View this message in context: http://r.789695.n4.nabble.com/how-do-I-read-certain-files-from-a-directory-based-on-number-of-columns-tp4661144p4662101.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [[i]]$ - indexing and lapply
Hi Arun, thank-you very much! The 2nd option worked perfectly. That was what I wanted. Now, I have another question. I am using the R packages dataRetrieval and EGRET from https://github.com/USGS-CIDA/WRTDS. I have 2 objects Daily and Sample that have the naming convention (Names = 21NC02WQ.C100 or whatevver the list of site names happens to be) that I need to have after running modelEstimation, but the names are stripped after running modelEstimation (see below). The new names after running modelEstimation for both Sample and Daily are the names of the columns rather than the site name. ## modelEstimation -- this is the code that I use to do the loop through modelEstimation for(i in Daily) { modelEstimation(localDaily = Daily[[i]], localSample = Sample[[i]], localINFO = INFO[[i]], windowY=10, windowQ=2, windowS=0.5,minNumObs=10,minNumUncen=6, env=parent.frame()) } # shows the correct naming convention before being ran through modelEstimation dput(Daily) structure(list(`21NC02WQ.C100` = structure(list(Date = structure(c(11231, 11232, 11233, 11234, 11235, 11236), class = Date), Q = c(0.886534950681092, 0.857937049046218, 0.829339147411344, 0.80074124577647, 0.772143344141596, 0.743545442506722), Julian = c(55060, 55061, 55062, 55063, 55064, 55065), Month = c(10, 10, 10, 10, 10, 10), Day = c(275, 276, 277, 278, 279, 280), DecYear = c(2000.75, 2000.75273224044, 2000.75546448087, 2000.75819672131, 2000.76092896175, 2000.76366120219), MonthSeq = c(1810, 1810, 1810, 1810, 1810, 1810), i = 1:6, LogQ = c(-0.120434728772853, -0.153224551595844, -0.187126103271526, -0.17423082796, -0.258585067253671, -0.296325395236517)), .Names = c(Date, Q, Julian, Month, Day, DecYear, MonthSeq, i, LogQ), row.names = c(NA, -6L), class = data.frame)), .Names = 21NC02WQ.C100) # shows the correct naming convention before being ran through modelEstimation dput(Sample) structure(list(`21NC02WQ.C100` = structure(list(Date = structure(numeric(0), class = Date), ConcLow = numeric(0), ConcHigh = numeric(0), Uncen = numeric(0), ConcAve = numeric(0), Julian = numeric(0), Month = numeric(0), Day = numeric(0), DecYear = numeric(0), MonthSeq = numeric(0), SinDY = numeric(0), CosDY = numeric(0)), .Names = c(Date, ConcLow, ConcHigh, Uncen, ConcAve, Julian, Month, Day, DecYear, MonthSeq, SinDY, CosDY), row.names = integer(0), class = data.frame)), .Names = 21NC02WQ.C100) # shows the Daily incorrect naming convention after being ran through modelEstimation , .Names = c(Date, Q, Julian, Month, Day, DecYear, MonthSeq, i, LogQ, Q7, Q30, yHat, SE, ConcDay, FluxDay, FNConc, FNFlux), row.names = c(NA, -1461L), class = data.frame) # shows the Sample incorrect naming convention after being ran through modelEstimation , .Names = c(Date, ConcLow, ConcHigh, Uncen, ConcAve, Julian, Month, Day, DecYear, MonthSeq, SinDY, CosDY, Q, LogQ, yHat, SE, ConcHat ), row.names = 176:198, class = data.frame) Is there anyway to make the Name of the object Daily and Sample the site name after being processed through modelEstimation, i.e. making the current names the column names which they should be? I also have a question about the INFO object that I will address in the next e-mail. Thank you for all of your continued great assistance Arun! Irucka ## the modelEstimation function and its major components are below modelEstimation function (localDaily = Daily, localSample = Sample, localINFO = INFO, windowY = 10, windowQ = 2, windowS = 0.5, minNumObs = 100, minNumUncen = 50, env = parent.frame()) { cat(\n first step running estCrossVal may take about 1 minute) Sample1 - estCrossVal(SampleCrossV = localSample, windowY, windowQ, windowS, minNumObs, minNumUncen) surfaceIndexParameters - surfaceIndex(localDaily = localDaily) localINFO$bottomLogQ - surfaceIndexParameters[1] localINFO$stepLogQ - surfaceIndexParameters[2] localINFO$nVectorLogQ - surfaceIndexParameters[3] localINFO$bottomYear - surfaceIndexParameters[4] localINFO$stepYear - surfaceIndexParameters[5] localINFO$nVectorYear - surfaceIndexParameters[6] localINFO$windowY - windowY localINFO$windowQ - windowQ localINFO$windowS - windowS localINFO$minNumObs - minNumObs localINFO$minNumUncen - minNumUncen cat(\nNext step running estSurfaces with survival regression:\n) surfaces1 - estSurfaces(localDaily = localDaily, localSample = localSample, windowY, windowQ, windowS, minNumObs, minNumUncen) Daily1 - estDailyFromSurfaces(localDaily = localDaily, localINFO = localINFO, localsurfaces = surfaces1) env$Daily - Daily1 env$INFO - localINFO env$Sample - Sample1 env$surfaces - surfaces1 cat(\nDone with modelEstimation,\nnow do AnnualResults-setupYears()\nor if using a period of analysis other than Water Year specify the arguments paStart and paLong in call to setupYears ) } environment: namespace:EGRET estSurfaces function (localDaily = Daily, localSample = Sample, windowY = 10, windowQ = 2, windowS = 0.5, minNumObs = 100, minNumUncen = 50) {
Re: [R] plot and save as png
Hi A.K This is working layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() but if I add this line png(filename = fname.png, width = 900, height = 600, units = 'px') no plot is generated. where is the problem?. thanks veepsirtt png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() null device 1 sessionInfo() R version 2.15.1 (2012-06-22) 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.15.1 On Mon, Mar 18, 2013 at 6:36 PM, arun kirshna [via R] ml-node+s789695n4661660...@n4.nabble.com wrote: Hi, Couldn't reproduce your problem. Using your code, I am getting the image below: A.K. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/plot-and-save-as-png-tp4661435p4661660.html To unsubscribe from plot and save as png, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4661435code=dmVlcHNpcnR0QGdtYWlsLmNvbXw0NjYxNDM1fDY5NzkzMTE3Nw== . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/plot-and-save-as-png-tp4661435p4662114.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Bayesian network
Yes, thanks but with package for the Bayesians networks ? -- View this message in context: http://r.789695.n4.nabble.com/Bayesian-network-tp4662059p4662085.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 Message During ANOVA
I am teaching myself R for use in Psych research. I don't understand the error message I am getting or how to fix it. Any suggestions will be greatly appreciated df1=read.table(fastfood.txt, header=TRUE); df1 c(t(as.matrix(df1))) r = c(t(as.matrix(df1))) # response data r f=c(item1,item2, item3) k=3 n=6 tm =gl(k,1, n*k, factor(f)) tm [1] item1 item2 item3 item1 item2 item3 item1 item2 item3 item1 item2 item3 [13] item1 item2 item3 item1 item2 item3 Levels: item1 item2 item3 av=aov(r~tm) Error in model.frame.default(formula = r ~ tm, drop.unused.levels = TRUE) : variable lengths differ (found for 'tm') Thanks in advance Harold Rodinsky PhD Associate Professor Department of Psychology University of the Incarnate Word 4301 Broadway San Antonio, TX 78209 This email and any files transmitted with it may be conf...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] basic sweave question
you are welcome! On Thu, Mar 14, 2013 at 6:01 PM, susieboyce [via R] ml-node+s789695n4661296...@n4.nabble.com wrote: Thank you for your reply. I have found the pdflatex file. I was able to solve my 'Sweave.sty not found' error by coping the Sweave.sty file and pasting it into the working directory for the LaTeX file. -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/basic-sweave-question-tp876734p4661296.html To unsubscribe from basic sweave question, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=876734code=bGdoMDUwNEBnbWFpbC5jb218ODc2NzM0fC0xODczMTIwODc1 . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/basic-sweave-question-tp876734p4662102.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] step halving factor reduced below minimum
Hello, I am attempting to use nlme to model the response of 19 groups. I am able to get a reasonable fit of all of the groups to the observed data using an exponential decay model (a*exp-x*b). The problem is that when I plot the fitted values to residuals, it demonstrates a pattern of increasing variance. I attempt to model this variance using Sig3.nlme - update(Sig2.nlme, weights = varConstPower(power=0.1), verbose = TRUE) I get the message that 'step halving factor reduced below minimum in PNLS step'. Some of the curves are actually flat lines where there is a value of 0 for the response at every observation within the group. My thought is that, because this corresponds to 0 variance, it is causing problems for the pnls. Don't know that this is the correct interpretation. Is there anyway to model this type of data using nlme or do I need to find another option? Thanks for any 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] basic sweave question
The pdflatex is the an excutable programe located in your MiKTexâ bin folder, I guess you have not add your MikTex bin folder into your Windows PATH environment On Thu, Mar 14, 2013 at 12:55 AM, susieboyce [via R] ml-node+s789695n4661220...@n4.nabble.com wrote: I have located my Sweave.sty in my R program files and I've tried copying and pasting this into many folders in the C/.../MiKTeX/tex/latex environment, including making a new folder called 'Sweave' and storing in here and still my .tex file gives me an error when I try to compile it. What is this pdflatex? Is it an R command? If so, what package is it in? Where does this go? In the original .rnw file, do you type this into R or somewhere else?: pdflatex --include-directory=C:\Program Files\R\R-2.14.0\share\texmf\tex\latex your_tex.tex -- If you reply to this email, your message will be added to the discussion below: http://r.789695.n4.nabble.com/basic-sweave-question-tp876734p4661220.html To unsubscribe from basic sweave question, click herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=876734code=bGdoMDUwNEBnbWFpbC5jb218ODc2NzM0fC0xODczMTIwODc1 . NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://r.789695.n4.nabble.com/basic-sweave-question-tp876734p4662100.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Check if a character vector can be coerced to numeric?
Yep, type.convert was exactly what I was looking for (with as.is=TRUE). Thanks! On Thu, Mar 21, 2013 at 1:31 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote: On 21/03/2013 18:20, Jonathan Greenberg wrote: Given an arbitrary set of character vectors: myvect1 - c(abc,3,4) myvect2 - c(2,3,4) I would like to develop a function that will convert any vectors that can be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves character vectors which cannot be converted (myvect1) alone. Is there any simple way to do this (e.g. some function that tests if a vector is coercible to a numeric before doing so)? --j ?type.convert It does depend what you mean by 'properly'. Can 123.456789012344567890123455 be converted 'properly'? [See the NEWS for R-devel.] -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~**ripley/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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 607 South Mathews Avenue, MC 150 Urbana, IL 61801 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn...@hotmail.com, Gchat: jgrn307, Skype: jgrn3007 [[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] plot and save as png
Hi, So when you run the code suggested: png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() exactly like that, you do not get a file named fname.png in your working directory? Do you get an error message, or any other information from the R console? Sarah On Thu, Mar 21, 2013 at 1:55 PM, veepsirtt veepsi...@gmail.com wrote: Hi A.K This is working layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() but if I add this line png(filename = fname.png, width = 900, height = 600, units = 'px') no plot is generated. where is the problem?. thanks veepsirtt png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() null device 1 sessionInfo() R version 2.15.1 (2012-06-22) 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.15.1 On Mon, Mar 18, 2013 at 6:36 PM, arun kirshna [via R] ml-node+s789695n4661660...@n4.nabble.com wrote: Hi, Couldn't reproduce your problem. Using your code, I am getting the image below: A.K. -- 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] How could I specify no interception term in arima?
Hello Rui, Thanks! I get it now. Should have read the documentation carefully! Cheers, Rebecca -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: Thursday, March 21, 2013 2:46 PM To: Yuan, Rebecca Cc: R help Subject: Re: [R] How could I specify no interception term in arima? Hello, In fact, it's written there, in ?arima: Further, if include.mean is true (the default for an ARMA model), this formula applies to X - m rather than X. So, use include.mean = FALSE Hope this helps, Rui Barradas Em 21-03-2013 13:56, Yuan, Rebecca escreveu: Hello, I cannot find it in ?arima, does someone know how to specify no interception term in arima? Thanks, Rebecca -- This message, and any attachments, is for the intended...{{dropped:14}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] plot and save as png
Hi, I am not sure about the problem. I am able to generate the pdf. with the codes: png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() A.K. - Original Message - From: Sarah Goslee sarah.gos...@gmail.com To: veepsirtt veepsi...@gmail.com Cc: r-help r-help@r-project.org Sent: Thursday, March 21, 2013 3:18 PM Subject: Re: [R] plot and save as png Hi, So when you run the code suggested: png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() exactly like that, you do not get a file named fname.png in your working directory? Do you get an error message, or any other information from the R console? Sarah On Thu, Mar 21, 2013 at 1:55 PM, veepsirtt veepsi...@gmail.com wrote: Hi A.K This is working layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() but if I add this line png(filename = fname.png, width = 900, height = 600, units = 'px') no plot is generated. where is the problem?. thanks veepsirtt png(filename = fname.png, width = 900, height = 600, units = 'px') layout(matrix(c(1,2,3,4), 4, 1, byrow = TRUE)) plot(sin, -pi, 10*pi) plot(sin, -pi, 20*pi) plot(sin, -pi, 30*pi) plot(sin, -pi, 40*pi) dev.off() null device 1 sessionInfo() R version 2.15.1 (2012-06-22) 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.15.1 On Mon, Mar 18, 2013 at 6:36 PM, arun kirshna [via R] ml-node+s789695n4661660...@n4.nabble.com wrote: Hi, Couldn't reproduce your problem. Using your code, I am getting the image below: A.K. -- 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. attachment: fname.png__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 Message During ANOVA
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Rodinsky, Dr Harold R. Sent: Thursday, March 21, 2013 11:32 AM To: 'r-help@r-project.org' Subject: Re: [R] Error Message During ANOVA I am teaching myself R for use in Psych research. I don't understand the error message I am getting or how to fix it. Any suggestions will be greatly appreciated df1=read.table(fastfood.txt, header=TRUE); df1 c(t(as.matrix(df1))) r = c(t(as.matrix(df1))) # response data r f=c(item1,item2, item3) k=3 n=6 tm =gl(k,1, n*k, factor(f)) tm [1] item1 item2 item3 item1 item2 item3 item1 item2 item3 item1 item2 item3 [13] item1 item2 item3 item1 item2 item3 Levels: item1 item2 item3 av=aov(r~tm) Error in model.frame.default(formula = r ~ tm, drop.unused.levels = TRUE) : variable lengths differ (found for 'tm') It looks like you are working way too hard to run your anova. First, the posting guide (see link at bottom or emails) asks you to provide a reproducible example. The error message states that r and tm have different lengths. At a minimum, we need to see what the df1 looks like. Show us the output of str(df1) so we can understand what your commands are doing. Without more information there is not much we can do to help. Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Could I get the following stats from arima()?
Hello, Inline. Em 21-03-2013 13:34, Yuan, Rebecca escreveu: Hello all, I use the arima to get a model, i.e. fit = arima(x,order=c(1,0,0)) and I know I can get the following from fit via est.coef = coef(fig) est.aic = fit$aic std.err = sqrt(diag(vcov(fit))) t.stat = est.coef/std.err How can I get the following stat from arima? Pr(|t|) Check this link: http://stats.stackexchange.com/questions/8868/how-to-calculate-the-p-value-of-parameters-for-arima-model-in-r r2 adjust_r2 rmse Also, reread the answer to one of your previous posts by Prof.Brian Ripley. If it's not available in R, there must be a good reason why not. Rui Barradas Thanks, Rebecca -- This message, and any attachments, is for the intended r...{{dropped:5}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Displaying median value over the horizontal(median)line in the boxplot
Hi, set.seed(45) test1-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data apply(test1,2,function(x) sprintf(%.1f,median(x))) #columnA columnB # 44.5 10.2 par(mfrow=c(1,2)) lapply(test1,function(x) {b- boxplot(x,range=0,horizontal=TRUE);mtext(sprintf(%.1f,b$stats[3]),side=3,at=b$stats[3],line=-8)}) A.K. - Original Message - From: shanthimuli...@gmail.com shanthimuli...@gmail.com To: smartpink...@yahoo.com Cc: Sent: Thursday, March 21, 2013 4:05 PM Subject: Re: Displaying median value over the horizontal(median)line in the boxplot Here is what I am doing my=read.csv(test.csv) apply(my,2,median,na.rm=TRUE) b-boxplot(my,range=0, pars=list(boxwex=0.6)) After this I am not sure how to automatically list the median in each of the two boxplots test.csv has columnA columnB 1 1 2 2 3 3 4 4 5 5 6 6 7 7 Finally how do I control the output. My actual data has a median value of 7.642552 but I only want it to be displayed as 7.6. Thank you so much for your help. I am very sorry for troubling you but I am very very new to this programming and to R as you can see. quote author='arun kirshna' Hi, Lines1-readLines(textConnection(Column1 -1,2,3,4,5,6,6,7 COlumn2- 3,4,5,6,7,8,8 Column3-- 45,66,7,8,89, COlumn4-5,6,7,7,8,9 Column5 -5,6,7,8,8)) vec1-unlist(strsplit(Lines1,-)) dat1-as.data.frame(t(read.table(text=vec1[grepl(,,vec1)],sep=,,fill=TRUE))) row.names(dat1)-NULL colnames(dat1)-tolower(gsub( $,,vec1[grepl(^C,vec1)])) dat1 # column1 column2 column3 column4 column5 #1 1 3 45 5 5 #2 2 4 66 6 6 #3 3 5 7 7 7 #4 4 6 8 7 8 #5 5 7 89 8 8 #6 6 8 NA 9 NA #7 6 8 NA NA NA #8 7 NA NA NA NA apply(dat1,2,median,na.rm=TRUE) #column1 column2 column3 column4 column5 # 4.5 6.0 45.0 7.0 7.0 #to save it as a pdf pdf(Shanthiboxplot.pdf) par(mfrow=c(3,2)) lapply(dat1,function(x) {b-boxplot(x,range=0,horizontal=TRUE);mtext(b$stats[3],side=3,at=b$stats[3],line=-8)}) dev.off() #to just print it on screen par(mfrow=c(3,2))# you can change this according to your need lapply(dat1,function(x) {b-boxplot(x,range=0,horizontal=TRUE);mtext(b$stats[3],side=3,at=b$stats[3],line=-8)}) A.K. /quote Quoted from: http://r.789695.n4.nabble.com/Displaying-median-value-over-the-horizontal-median-line-in-the-boxplot-tp4661854p4661935.html __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] PGLMM in Picante Question
Hi Guys, Using the PGLMM function in Picante it is theoretically possible to generate other models (than the 5 flagged ones indicated) by differently structuring the independent variable (Y), dependent variables (X), and covariance matrices (VV). I was wondering anyone could give me some advice (or code) for generating a model that includes the phylogenetic repulsion model (3) with the traits model? Thanks a million! Frank -- *** Frank T. Burbrink, Ph.D. Professor Biology Department 6S-143 2800 Victory Blvd. College of Staten Island/CUNY Staten Island, New York 10314 E-Mail:frank.burbr...@csi.cuny.edu Phone:718-982-3961 Web Page: http://scholar.library.csi.cuny.edu/~fburbrink/ *** Chair Ecology, Evolutionary Biology, and Behavior Doctoral Subprogram Biology Program City University of New York Graduate Center 365 Fifth Avenue New York, NY 10016-4309 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Control variables in mediation analysis
Hi everyone,I would like to test a mediation model, that has several control variables. More specifically, I would like to test the indirect effect with bootstrapping. However, all the packages I have found so far (e.g. MBESS) only allow testing a simple mediation model (One independent, one mediator, one dependent) so that I cannot include any controls. Can somebody help me? [[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] order statistic of multivariate normal
Hi all, Is there an R function that computes the probabilty or quantiles of order statistics of multivariate normal? Thank you. Hanna [[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] Control variables in mediation analysis
Hi, Just about anything can be bootstrapped, that's one of the things that makes bootstrapping great! Use e.g., the boot package, and bootstrap the product of the coefficients. Alternatively the mediation package (http://cran.r-project.org/web/packages/mediation/index.html) might help, though I'm not sure if it uses bootstrap. Best, Ista On Thu, Mar 21, 2013 at 3:21 PM, F.Doerwald f.doerw...@student.rug.nl wrote: Hi everyone,I would like to test a mediation model, that has several control variables. More specifically, I would like to test the indirect effect with bootstrapping. However, all the packages I have found so far (e.g. MBESS) only allow testing a simple mediation model (One independent, one mediator, one dependent) so that I cannot include any controls. Can somebody help me? [[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] [mgcv][gam] Odd error: Error in PredictMat(object$smooth[[k]], data) : , `by' variable must be same dimension as smooth arguments
Dear List, I'm getting an error in mgcv, and I can't figure out where it comes from. The setup is the following: I've got a fitted GAM object called MI, and a vector of prediction data (with default values for predictors). I feed this into predict.gam(object, newdata = whatever) via the following function: makepred = function(varstochange,val){ for (i in 1:length(varstochange)){ if (varstochange[i] == pot.trial){j=1} if (varstochange[i] == year){j=2} if (varstochange[i] == crop.legume){j=3} if (varstochange[i] == crop.fruit){j=4} if (varstochange[i] == feedstock){j=5} if (varstochange[i] == BCAR.imp){j=8} if (varstochange[i] == INAR.imp){j=9} if (varstochange[i] == bcph.imp){j=10} if (varstochange[i] == phi.imp){j=11} if (varstochange[i] == htt.imp){j=12} if (varstochange[i] == bc.prc.C.imp){j=13} if (varstochange[i] == CEC.imp){j=14} if (varstochange[i] == soc.imp){j=15} if (varstochange[i] == sand.imp){j=16} if (varstochange[i] == clay.imp){j=17} if (varstochange[i] == abslat.imp){j=18} preddat[j] = val[i] } predict.gam(MI,newdata=preddat,se.fit=TRUE) } I then make predictions that look like this: a = makepred(c(phi.imp,bcph.imp,year),c(4.5,7.25,1)) b = makepred(c(phi.imp,bcph.imp,year),c(5.5,7.25,1)) c = makepred(c(phi.imp,bcph.imp,year),c(6.5,7.25,1)) d = makepred(c(phi.imp,bcph.imp,year),c(7.5,7.25,1)) makepHplot(a,b,c,d,title=1st harvest, BC pH = 7.25) where makepHplot is a different function that I made. This worked for quite some time. Then I added some data to the model and changed the specification slightly. Now I'm getting this error message: 1 a = makepred(c(bcph.imp,year),c(7.5,1)) Error in PredictMat(object$smooth[[k]], data) : `by' variable must be same dimension as smooth arguments I never got this message with the old fitted model (and still don't). What is happening? I can't figure out what about the new fitted model is causing this problem. Typing PredictMat isn't helping me, nor is google. The problem isn't that all of the variables aren't in the prediction data. Would appreciate any help here. Thanks, Andrew __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] order statistic of multivariate normal
On Mar 21, 2013, at 1:44 PM, li li wrote: Hi all, Is there an R function that computes the probabilty or quantiles of order statistics of multivariate normal? Thank you. There is an mvtnorm package. I don't know what you mean by quantiles of order statistics of multivariate normal, though. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] PGLMM in Picante Question
Frank Burbrink burbrink666 at gmail.com writes: Using the PGLMM function in Picante it is theoretically possible to generate other models (than the 5 flagged ones indicated) by differently structuring the independent variable (Y), dependent variables (X), and covariance matrices (VV). I was wondering anyone could give me some advice (or code) for generating a model that includes the phylogenetic repulsion model (3) with the traits model? This would probably get more informed responses on the r-sig-ph...@r-project.org mailing list (phylogenetics/comparative methods Special Interest Group) Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Re-order variables listed in nomogram?
nomogram does not have an option for specifying a new order for the variables. With some exceptions you should be able to reorder the variables in the model formula to achieve the desired result. Frank Eleni Rapsomaniki-3 wrote Hi, I am using the function nomogram in the rms package for survival analysis. How is the order in which variables determined and how can I change it? I use it with a cph() model. Many Thanks Eleni Rapsomaniki Clinical Epidemiology Group Department of Epidemiology and Public Health University College London __ R-help@ mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in context: http://r.789695.n4.nabble.com/Re-order-variables-listed-in-nomogram-tp4662070p4662139.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] order statistic of multivariate normal
R^n for n 1 is not an ordered set. albyn On Thu, Mar 21, 2013 at 02:32:44PM -0700, David Winsemius wrote: On Mar 21, 2013, at 1:44 PM, li li wrote: Hi all, Is there an R function that computes the probabilty or quantiles of order statistics of multivariate normal? Thank you. There is an mvtnorm package. I don't know what you mean by quantiles of order statistics of multivariate normal, though. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Albyn Jones Reed College jo...@reed.edu __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Control variables in mediation analysis
Dear Ista and F.Doerwald, F.Doerwald could also fit a model using sem() in the sem package, and then use deltaMethod() in the car package to get the estimated value and standard error of any function of model coefficients that he or she chooses. Sorry, I didn't read the original posting. I hope this helps, John John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ On Thu, 21 Mar 2013 16:49:46 -0400 Ista Zahn istaz...@gmail.com wrote: Hi, Just about anything can be bootstrapped, that's one of the things that makes bootstrapping great! Use e.g., the boot package, and bootstrap the product of the coefficients. Alternatively the mediation package (http://cran.r-project.org/web/packages/mediation/index.html) might help, though I'm not sure if it uses bootstrap. Best, Ista On Thu, Mar 21, 2013 at 3:21 PM, F.Doerwald f.doerw...@student.rug.nl wrote: Hi everyone,I would like to test a mediation model, that has several control variables. More specifically, I would like to test the indirect effect with bootstrapping. However, all the packages I have found so far (e.g. MBESS) only allow testing a simple mediation model (One independent, one mediator, one dependent) so that I cannot include any controls. Can somebody help me? [[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-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] multiple peak fit
Petr, You could use nonlinear regression to fit two Guassian peaks. For example, fit - nls(sig ~ d + a1*exp(-0.5*((time-c1)/b1)^2) + a2*exp(-0.5*((time-c2)/b2)^2), start=list(a1=15, b1=20, c1=315, a2=4, b2=50, c2=465, d=1.5), data=temp) plot(temp, type=l) lines(temp$time, predict(fit), lty=2, col=red) Jean On Thu, Mar 21, 2013 at 8:17 AM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi I went through some extensive search to find suitable method (package, function) to fit multiple peaks. The best I found is ALS package but it requires rather complicated input structure probably resulting from GC-MS experimental data and seems to be an overkill to my problem. I have basically simple two column data frame with columns time and sig dput(temp) structure(list(time = c(33, 34, 37.3, 44.7, 56, 70, 85, 99.7, 114, 127.3, 140, 151.7, 163, 174, 185, 196, 206.7, 217.3, 228, 238.7, 249.3, 260, 271, 282, 292.7, 303.7, 314.3, 325.3, 336, 346.7, 357.3, 368, 379, 389.7, 400.3, 411, 421.7, 432.3, 443, 454, 465, 476, 487, 497.7, 508.3, 519, 530, 541, 551.7, 562.3, 573, 584, 595, 606, 616.7, 627.3, 638, 649, 659.7, 670.3, 681, 692, 703, 713.7, 724.3, 735, 746, 757, 768, 779, 789), sig = c(1.558, 1.5549, 1.5619, 1.5614, 1.5618, 1.6044, 1.6161, 1.6287, 1.6432, 1.6925, 1.7273, 1.6932, 1.669, 1.6863, 1.6962, 1.7186, 1.7513, 1.8325, 1.9181, 2.01, 2.1276, 2.2821, 2.5596, 2.9844, 4.1272, 13.421, 15.422, 14.119, 11.491, 8.8799, 6.7774, 5.6223, 4.8775, 4.3628, 4.0517, 3.9146, 3.8704, 3.9162, 4.0372, 4.0948, 4.2054, 4.1221, 3.9145, 3.5724, 3.2108, 2.8311, 2.4605, 2.1985, 1.9685, 1.8158, 1.7487, 1.692, 1.6565, 1.6374, 1.609, 1.5927, 1.5401, 1.5366, 1.5614, 1.5314, 1.4989, 1.5053, 1.4953, 1.4824, 1.4743, 1.4468, 1.4698, 1.4671, 1.4675, 1.4704, 1.4966)), .Names = c(time, sig), row.names = c(NA, -71L), class = data.frame) When it is plotted there are clearly 2 peaks visible. plot(temp, type=l) Does anybody know how to decompose those data to two (or more) gaussian (or other) peaks? I can only think about nlme but before I start from scratch I try to ask others. Best regards Petr __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Reading dataset in R
Hi, con-file(Rout1112.text) Lines1- readLines(con) close(con) indx-rep(rep(c(TRUE,FALSE),each=2),2) Lines2-Lines1[!grepl([A-Za-z],Lines1)] res-read.table(text=paste(gsub(^\\d+\\s+,,Lines2[indx]),gsub(^\\d+\\s+,,Lines2[!indx])),sep=,header=FALSE) nm1-unlist(strsplit(gsub(^ +,,paste(Lines1[grepl([A-Za-z],Lines1)][1:2],collapse= )), )) colnames(res)- nm1[nm1!=] res #m1 n1 m n cterm1_P0L cterm1_P0H c11 c12 c1 c2 alpha beta T_error N #1 4 5 11 9 0.8145062 0.6302494 0.03 0.03 0.15 0.15 0.1 0.4 0.6339515 20 #2 7 4 11 8 0.6983373 0.000 0.03 0.03 0.15 0.15 0.1 0.4 0.4899431 19 #3 4 5 10 9 0.8145062 0.6302494 0.03 0.03 0.15 0.20 0.1 0.4 0.6831988 19 #4 5 4 9 8 0.7737809 0.000 0.03 0.03 0.15 0.20 0.1 0.4 0.6458095 17 # EN BH BL AH AL #1 11.77746 0.12159579 0.3846999 0.09567271 0.03198315 #2 16.20665 0.09819012 0.2550532 0.09581478 0.04088503 #3 11.59196 0.15166360 0.3943098 0.08405337 0.05317206 #4 13.90488 0.14031630 0.3624458 0.08268336 0.06036395 A.K. From: Joanna Zhang zjoanna2...@gmail.com To: arun smartpink...@yahoo.com Sent: Thursday, March 21, 2013 3:03 PM Subject: Re: [R] cumulative sum by group and under some criteria Hi, I used a computer cluster and output the file attached here, I need to read the file in R. I tried to use read.table, but it seems that the format is not recognized by R, could you help? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Control variables in mediation analysis
Well, yeah ... but it doesn't necessarily follow that the result converges to what you want. Bootstrapping extreme order statistics is an example. -- Bert On Thu, Mar 21, 2013 at 1:49 PM, Ista Zahn istaz...@gmail.com wrote: Hi, Just about anything can be bootstrapped, that's one of the things that makes bootstrapping great! Use e.g., the boot package, and bootstrap the product of the coefficients. Alternatively the mediation package (http://cran.r-project.org/web/packages/mediation/index.html) might help, though I'm not sure if it uses bootstrap. Best, Ista On Thu, Mar 21, 2013 at 3:21 PM, F.Doerwald f.doerw...@student.rug.nl wrote: Hi everyone,I would like to test a mediation model, that has several control variables. More specifically, I would like to test the indirect effect with bootstrapping. However, all the packages I have found so far (e.g. MBESS) only allow testing a simple mediation model (One independent, one mediator, one dependent) so that I cannot include any controls. Can somebody help me? [[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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[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] order statistic of multivariate normal
Hello, Em 21-03-2013 21:42, Albyn Jones escreveu: R^n for n 1 is not an ordered set. Theorem. All sets are well ordered. (This theorem is equivalent to the Axiom of Choice.) Rui Barradas albyn On Thu, Mar 21, 2013 at 02:32:44PM -0700, David Winsemius wrote: On Mar 21, 2013, at 1:44 PM, li li wrote: Hi all, Is there an R function that computes the probabilty or quantiles of order statistics of multivariate normal? Thank you. There is an mvtnorm package. I don't know what you mean by quantiles of order statistics of multivariate normal, though. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Problems of exporting raster to ArcGIS
Hello: I am using R raster package to replace ArcGIS when processing multiple shp files. However, when I export R raster back to ArcGIS, it couldn't recognize R raster file correctly. For example, I used {raster} package and got a RasterLayer as followed. class : RasterLayer dimensions : 8280, 18480, 153014400 (nrow, ncol, ncell) resolution : 0.00834, 0.00834 (x, y) extent : -169, -14.9, 6.03, 75.1 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +no_defs data source : G:\_RESEARCH\_GRADUATE\BiodiversityVsGradients\Little_in_R\LittleRasterAll.bil names : LittleRasterAll I used function writeRaster{raster} to write this rasterLayer into every format it supports, and ArcGIS respond to them in three different ways, but none of them works. I wonder why it happens and if there is someway to solve this problem? ArcGIS respond type: 1. Show strange values GTiff, HFA 2. Show even values in whole raster IDRISI, ascii, EHdr 3. Cannot recognize files CDF, raster, SAGA, CDF , ENVI Yuanjing Xu PhD. Student of Biodiversity Conservation [[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] vector field from a 3D scalar field
I have a 3D field of a scalar variable (x, y, z, value). Is there a way to generate a vector field from this data--gradient at defined points? I found the rasterVis package for 2D data, but as yet nothing for 3D data. Thanks, Scott Waichler Pacific Northwest National Laboratory Richland, WA scott.waich...@pnnl.gov __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] vector field from a 3D scalar field
On Mar 21, 2013, at 4:40 PM, Waichler, Scott R wrote: I have a 3D field of a scalar variable (x, y, z, value). Is there a way to generate a vector field from this data--gradient at defined points? I found the rasterVis package for 2D data, but as yet nothing for 3D data. Can't you just think of 'value' as a potential and then differentiate (using sweep?) along the three principal axes to construct the partial derivatives (eg. diff(value)/diff(x) at constant y and z) which would then form the components of the vector field? That's how one goes from gravitational or electrical potential to the corresponding vector fields. E - grad(V), As always: Data would help clarify. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Clever way to match two lists
Hello, I have a large data.frame of 80,000 rows where each row is a record. Each record is indexed by a unique ID in the first column. I need to update values for a column for *some* of the records. I was given a data.frame with about 10,000 rows and two columns. The first is the record ID, the second is the new values. The slow way to do this is to loop through the new data (10,000 rows) and update the value in the corresponding master data.frame. However this will be painfully slow. Does anyone have a clever way to shortcut the process. In English, what I want to do is, For each row in the update list, lookup the corresponding ID in the master data frame and update the value. Ideas? -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Clever way to match two lists
indx - match(main.df$id, key$id, nomatch = 0) main.df$value[indx != 0] - key$value[indx] Sent from my iPad On Mar 21, 2013, at 20:57, Noah Silverman noahsilver...@ucla.edu wrote: Hello, I have a large data.frame of 80,000 rows where each row is a record. Each record is indexed by a unique ID in the first column. I need to update values for a column for *some* of the records. I was given a data.frame with about 10,000 rows and two columns. The first is the record ID, the second is the new values. The slow way to do this is to loop through the new data (10,000 rows) and update the value in the corresponding master data.frame. However this will be painfully slow. Does anyone have a clever way to shortcut the process. In English, what I want to do is, For each row in the update list, lookup the corresponding ID in the master data frame and update the value. Ideas? -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Clever way to match two lists
Jim, That's perfect. Thanks. Also tried Neal's method, but it wound up be MUCH slower to build the index. Thanks, -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Mar 21, 2013, at 6:07 PM, Jim Holtman jholt...@gmail.com wrote: indx - match(main.df$id, key$id, nomatch = 0) main.df$value[indx != 0] - key$value[indx] Sent from my iPad On Mar 21, 2013, at 20:57, Noah Silverman noahsilver...@ucla.edu wrote: Hello, I have a large data.frame of 80,000 rows where each row is a record. Each record is indexed by a unique ID in the first column. I need to update values for a column for *some* of the records. I was given a data.frame with about 10,000 rows and two columns. The first is the record ID, the second is the new values. The slow way to do this is to loop through the new data (10,000 rows) and update the value in the corresponding master data.frame. However this will be painfully slow. Does anyone have a clever way to shortcut the process. In English, what I want to do is, For each row in the update list, lookup the corresponding ID in the master data frame and update the value. Ideas? -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] NADA
Hello Don, Jeff, Thanks a lot for the comments and suggestions. Best Janh On Thu, Mar 21, 2013 at 10:57 AM, MacQueen, Don macque...@llnl.gov wrote: According to ?ros, one of the arguments is: reverseT: A name of a function to use for reversing the transformation after performing the ROS fit. Defaults to 'exp'. And in the Details section: By default, 'ros' performs a log transformation prior to, and after operations over the data. Given those statements, perhaps the expectation should be a plot in original units? Keep in mind that a main purpose is summary statistics in the original units. After running the first example in ?ros, including the plot, try these: unclass(myros) abline(h=myros$modeled,col='blue') -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/20/13 5:48 PM, Janh Anni annij...@gmail.com wrote: Dear Users Regarding the NADA package, would anyone be able to help me understand what values are actually plotted on the Y axis of the plot obtained by using the *ros* function on the data and plotting the result with the plot() function? The Y axis is labeled Values. According to the NADA user manual, ros performs a log transformation of the data by default, but the user can specify no transformation, or some other transformation besides log, if desired. However the values plotted on the Y axis appear to be the raw data values, regardless of which transformation or no transformation was used. If the log transformation is used for instance, I would have expected the logs of the original data instead of the raw data to be plotted on the Y axis. Thanks for your help. Janh [[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.