Re: [R] result of mean(v1, v2, v3) of three real number not the same as sum(v1, v2, v3)/3

2022-05-12 Thread Ivan Krylov
On Thu, 12 May 2022 19:31:51 + "Sorkin, John" wrote: > > mean(mlagFZ1,mlagFZ2,mlagFZ3) > [1] -0.3326792 match.call(mean.default, quote(mean(mlagFZ1, mlagFZ2, mlagFZ3))) # mean(x = mlagFZ1, trim = mlagFZ2, na.rm = mlagFZ3) mean() takes a vector to compute a mean of and additional arguments

Re: [R] Result show the values of fitting gamma parameter

2018-01-29 Thread Rui Barradas
Hello, I believe the following is simpler. It changes the OP's code a bit and uses lapply, not apply. res2 <- lapply(C, fitdist, "gamma") do.call(rbind, lapply(res2, `[[`, "estimate")) # shape rate #A 3.702253 1.234126 #B 31.300800 3.912649 Hope this helps, Rui Barradas On 1/29/20

Re: [R] Result show the values of fitting gamma parameter

2018-01-29 Thread Eric Berger
Capture the results of the apply command into an object and then work with that. Here is one way to do it: > res <- apply(C, 2, fitdist, "gamma") > out <- c( res$A$estimate["shape"], res$B$estimate["shape"], res$A$estimate["rate"], res$B$estimate["rate"]) > names(out) <- c("A shape","B shape","A r

[R] Result show the values of fitting gamma parameter

2018-01-29 Thread smart hendsome via R-help
Hi, Let say I have data by two columns A and B, and I have fit each column using the gamma distribution by 'fitdist' . I just want the result show only the shape and rate only. Eg: library(fitdistrplus) A <-c(1,2,3,4,5) B<-c(6,7,8,9,10) C <-cbind(A,B) apply(C, 2, fitdist, "gamma") Output sho

Re: [R] Result error using the function

2015-10-06 Thread Adams, Jean
I have simplified your function. And I have transposed your results such that resulting metrics are in columns rather than rows. So, it's not exactly what you were after, but perhaps you will find it useful. monthly_summary <- function(dt, r, tol=1E-6) { # number of days with above tol by year

[R] Result error using the function

2015-10-06 Thread smart hendsome
Hi R-users, I am new to R.  I try to code using the function in R as below:  monthly_summary <- function(dt,r) {  tol <- 1E-6    mn  <- vector(length=12, mode="numeric")    lambda  <- vector(length=12, mode="numeric")    ag  <- aggregate(dt[,4] > tol, list (dt[,2], dt[,1]), sum)    names(ag) <- c

Re: [R] result NA , but expected True or False

2015-08-10 Thread William Dunlap
The || operator will always return a result of type 'logical' and length 1. You gave it two operands of length 0, so it returned the logical value NA, meaning it had no idea what the result should be. If you give it operands of length > 1, it will use the only the first elements of them. (S and S

Re: [R] result NA , but expected True or False

2015-08-09 Thread David Winsemius
On Aug 9, 2015, at 8:45 PM, Ragia Ibrahim wrote: > Dear Group, > Kindly, > > I have those two lines > if( (z_nebla==0) || (z_nebla_dash==0) ) > CM <- 0 else > > CM <- 0.5 *(1/a) + 0.5*(1/b) > > when running it > > I got this > > z_nebla==0

[R] result NA , but expected True or False

2015-08-09 Thread Ragia Ibrahim
Dear Group, Kindly, I have those two lines if( (z_nebla==0) || (z_nebla_dash==0) ) CM <- 0 else CM <- 0.5 *(1/a) + 0.5*(1/b) when running it I got this z_nebla==0) logical(0) > (z_nebla_dash==0) logical(0) > (z_nebla==0) || (z

Re: [R] Result differences in 32-bit vs. 64-bit point.in.polygon?

2015-05-29 Thread Duncan Murdoch
On 29/05/2015 2:36 PM, Lensing, Shelly Y wrote: > Is anyone aware of point.in.polygon giving different results for 32-bit vs. > 64-bit R? Our OS is 64-bit Windows 7 Enterprise. I'm working with someone > else's extensive R program and the final results are close but not exactly > matching. We're

[R] Result differences in 32-bit vs. 64-bit point.in.polygon?

2015-05-29 Thread Lensing, Shelly Y
Is anyone aware of point.in.polygon giving different results for 32-bit vs. 64-bit R? Our OS is 64-bit Windows 7 Enterprise. I'm working with someone else's extensive R program and the final results are close but not exactly matching. We're thinking it might be something with the point.in.polygo

Re: [R] result

2013-12-17 Thread Jim Lemon
On 12/17/2013 05:50 PM, wrote: Mydata is as under. dat=" salary ex + 1 1856 1799 + 2 1856 1800 + 3 1858 1800 + 4 1858 1801 + 5 1862 1803 + 6 1862 1805 + 7 1862 1810 + 8 1865 1805 + 9 1865 1808 + 10 1865 1815 + 11 1865 1820 + 12 1870 1810 + 13 1870 1830 + 14 1880

Re: [R] result

2013-12-16 Thread David Winsemius
On Dec 16, 2013, at 10:50 PM, wrote: > Mydata is as under. > dat=" salary ex > + 1 1856 1799 > + 2 1856 1800 > + 3 1858 1800 > + 4 1858 1801 > snipped > + " > > data<-read.table(text=dat,header=TRUE) > > I want to get the result(please see the attatchment),the header is sal

[R] result

2013-12-16 Thread ????????
Mydata is as under. dat=" salary ex + 1 1856 1799 + 2 1856 1800 + 3 1858 1800 + 4 1858 1801 + 5 1862 1803 + 6 1862 1805 + 7 1862 1810 + 8 1865 1805 + 9 1865 1808 + 10 1865 1815 + 11 1865 1820 + 12 1870 1810 + 13 1870 1830 + 14 1880 1840 + 15 1880 1845 + 16 1880 1851 + 17

Re: [R] Result of clustering on plot

2012-05-11 Thread greyofthedawn
Yes, now it works! Thank you very much for your help! Jane -- View this message in context: http://r.789695.n4.nabble.com/Result-of-clustering-on-plot-tp4625043p4627431.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

Re: [R] Result of clustering on plot

2012-05-11 Thread Jean V Adams
You don't give much information about x, but assuming that the "names" you want to add to the plot are the row names. Try this text(x, col=cl$cluster, rownames(x)) Jean greyofthedawn wrote on 05/10/2012 06:46:05 PM: > Hello! I 'm new to R and need your help in one question... > I did cluste

[R] Result of clustering on plot

2012-05-10 Thread greyofthedawn
Hello! I 'm new to R and need your help in one question... I did cluster analysis using kmeans function. I load data from file: This file also contains headers for objects I want to cluster. After making a clustering procedure I display result on plot: And it shows only points (i.e. objects) wit

Re: [R] result numeric(0) when using variable1[which(variable2="max(variable2)"]

2012-01-17 Thread Berend Hasselman
On 17-01-2012, at 11:35, Nerak wrote: > Dear all, > I have a question about the knowing for which row I have the max value of > one of my variables. > I calculated the Rsquared for different columns and made a list to gather > them. I unlisted this list to create a vector with this values. I want

Re: [R] result numeric(0) when using variable1[which(variable2="max(variable2)"]

2012-01-17 Thread Duncan Murdoch
On 17/01/2012 5:35 AM, Nerak wrote: Dear all, I have a question about the knowing for which row I have the max value of one of my variables. I calculated the Rsquared for different columns and made a list to gather them. I unlisted this list to create a vector with this values. I want to know for

[R] result numeric(0) when using variable1[which(variable2="max(variable2)"]

2012-01-17 Thread Nerak
Dear all, I have a question about the knowing for which row I have the max value of one of my variables. I calculated the Rsquared for different columns and made a list to gather them. I unlisted this list to create a vector with this values. I want to know for which column I have the max value of

Re: [R] Result too long a vector?

2011-11-23 Thread Jess L
Hi, you can try close R and run R again for getting and saving another csv. Or if your max(x) is too big, try split into 4, or 5 or even more like: 1:(max(x)/4) and next run: (max(x)/4+1) : (max(x)/2) etc hope this helps, JL -- View this message in context: http://r.789695.n4.nabble.com/

Re: [R] result of rqss

2009-06-19 Thread David Winsemius
If you do a search on the quantreg documentation for "piecewise", the first hit on the pdf has code on the same page. Running that rqss fit call unaltered with your data produced a straight line (because the data only has a domain of 0-0.5) but lowering lambda lets the piecewise character g

[R] result of rqss

2009-06-19 Thread Michael Hecht
Hello, i have the following data: x=c(0,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.25,0.26,0.27,0.46,0.47,0.48,0.49) y=c(0.48,0.46,0.41,0.36,0.32,0.35,0.48,0.47,0.55,0.56,0.54,0.67,0.61,0.60,0.54,0.51,0.45,0.42,0.44,0.46,0.41,0.43

Re: [R] Result depends on previous result; easy with a loop; but without a loop?

2007-12-14 Thread Ravi Varadhan
aculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roland Rau Sent: Friday, December 14, 2007 2:33 PM To: '[EMAIL PROTECTED]' Subject: Re: [R] Result depends on previous result; easy with a loop; but without a loop? Dear al

Re: [R] Result depends on previous result; easy with a loop; but without a loop?

2007-12-14 Thread Roland Rau
Dear all, in the meantime, I found a solution -- thank to a suggestion sent by Mark Leeds to me off-list. All the best, Roland set.seed(1234) initial.matrix <- rbind(rep(1,4), matrix(0,ncol=4,nrow=5)) the.other.matrix <- matrix(runif(20), ncol=4, nrow=5) for (i in 2:(nrow(initial.matrix))) {

[R] Result depends on previous result; easy with a loop; but without a loop?

2007-12-14 Thread Roland Rau
Dear all, I am pretty sure that this has been discussed before. Unfortunately, I can not find anything in the archives -- probably because I am "RSiteSearching" for the wrong terms. If I remember correctly, I think I even asked this question a few years ago. But I cannot even find this. The ba