Displaying 20 results from an estimated 7000 matches similar to: "Help needed with aggregate or other solution"
2017 Oct 26
3
Help needed with aggregate or other solution
Hi Jeff,
Thank you for the suggestions -- I appreciate your help. Unfortunately, the
result2 has two problems...
(1) there are now 3 date columns (it looks like 2 cols are merged into 1
col)
(2) the output rows should not have any of the basistime dates repeated
(maybe I misstated the problem); I need the max fcst value by basistime,
but also list the date value for that row; for example:
2017 Oct 26
0
Help needed with aggregate or other solution
On Thu, 26 Oct 2017, Thomas Adams wrote:
> Hi Jeff,
>
> Thank you for the suggestions -- I appreciate your help. Unfortunately, the
> result2 has two problems...
>
> (1) there are now 3 date columns (it looks like 2 cols are merged into 1
> col)
No, there are two date columns. Result2 includes the grouping value as a
row name (pulled from the names of the dta2list items
2017 Oct 26
0
Help needed with aggregate or other solution
Thanks for the dput...
#### reproducible example of split-apply-combine ###
dta <- structure(list(date = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 20L, 21L, 22L, 23L, 24L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L), .Label = c("2012-01-25 18:00:00",
2013 Jul 17
2
error message in gev
Hi r-users,
I would like to use gev and my data (annual rainfall ) is as follows:
> head(dat,20) A B C D E F G H I J
1 45.1 41.5 58.5 50.1 46.0 49.1 37.7 49.1 59.8 54.0
2 50.3 39.8 49.4 56.4 49.4 48.8 42.1 49.8 49.4 58.3
3 41.7 39.3 44.6 39.1 35.7 41.5 40.8 40.8 38.5 45.6
4 50.7 33.9 48.4 28.2 35.5 39.1 61.4 17.0 30.7 38.3
5 39.3 30.6 46.9 23.8 25.8
2013 Feb 13
3
Correlation with p value
Dear all,
I have a data (bellow) and I want to make a correlation test with p-value
structure(list(Name = structure(c(3L, 3L, 3L, 3L, 3L, 3L, 3L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("CTJ",
"PKR", "TTK"), class = "factor"), score = c(86.4371428571428,
89.7028571428572, 87.728, 89.99, 89.42, 85.6914285714286, 82.256,
2024 Sep 07
4
Reading a txt file from internet
Hi,
I am trying to the data from
https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt
without any success. Below is the error I am getting:
> read.delim('https://online.stat.psu.edu/onlinecourses/sites/stat501/files/ch15/employee.txt')
Error in make.names(col.names, unique = TRUE) :
invalid multibyte string at '<ff><fe>t'
In
2012 Jul 06
4
differences between survival models between STATA and R
Dear Community,
I have been using two types of survival programs to analyse a data set.
The first one is an R function called aftreg. The second one an STATA
function called streg.
Both of them include the same analyisis with a weibull distribution. Yet,
results are very different.
Shouldn't the results be the same?
Kind regards,
J
--
View this message in context:
2017 Dec 14
2
help with recursive function
Hi, I need some help with running a recursive function. I like to run funlp2 recursively.
When I try to run recursive function in another function named "calclp" I get this "Error: any(!dat2$norm_sd) >= 1 is not TRUE".
I have never built a recursive function before so having trouble executing it in this case. I would appreciate any help or guidance to resolve this issue.
2017 Dec 14
2
help with recursive function
My own typo ... whoops ...
!( any(dat2$norm_sd >= 1 ))
On Thu, Dec 14, 2017 at 3:43 PM, Eric Berger <ericjberger at gmail.com> wrote:
> You seem to have a typo at this expression (and some others like it)
>
> Namely, you write
>
> any(!dat2$norm_sd) >= 1
>
> when you possibly meant to write
>
> !( any(dat2$norm_sd) >= 1 )
>
> i.e. I think your !
2017 Dec 14
3
help with recursive function
If you are trying to understand why the "stopifnot" condition is met you
can replace it by something like:
if ( any(dat2$norm_sd >= 1) )
browser()
This will put you in a debugging session where you can examine your
variables, e.g.
> dat$norm_sd
HTH,
Eric
On Thu, Dec 14, 2017 at 5:33 PM, Eric Berger <ericjberger at gmail.com> wrote:
> The message is coming from
2017 Dec 14
2
help with recursive function
Hi, I accidently left out few lines of code from the calclp function. Updated function is pasted below.
I am still getting the same error ?Error: !(any(data1$norm_sd >= 1)) is not TRUE?
I would appreciate any help.
Nilesh
dput(calclp)
function (dataset)
{
dat1 <- funlp1(dataset)
recursive_funlp <- function(dataset = dat1, func = funlp2) {
dat2 <- dataset %>%
2017 Dec 14
0
help with recursive function
You seem to have a typo at this expression (and some others like it)
Namely, you write
any(!dat2$norm_sd) >= 1
when you possibly meant to write
!( any(dat2$norm_sd) >= 1 )
i.e. I think your ! seems to be in the wrong place.
HTH,
Eric
On Thu, Dec 14, 2017 at 3:26 PM, DIGHE, NILESH [AG/2362] <
nilesh.dighe at monsanto.com> wrote:
> Hi, I need some help with running a
2017 Dec 14
0
help with recursive function
Eric: I will try and see if I can figure out the issue by debugging as you suggested. I don?t know why my code after stopifnot is not getting executed where I like the code to run the funlp2 function when the if statement is TRUE but when it is false, I like it to keep running until the stopifnot condition is met.
When the stopifnot condition is met, I like to get the output from if statement
2017 Dec 14
0
help with recursive function
Eric: Thanks for taking time to look into my problem. Despite of making the change you suggested, I am still getting the same error. I am wondering if the logic I am using in the stopifnot and if functions is a problem.
I like the recursive function to stop whenever the norm_sd column has zero values that are above or equal to 1. Below is the calclp function after the changes you suggested.
2017 Dec 14
0
help with recursive function
The message is coming from your stopifnot() condition being met.
On Thu, Dec 14, 2017 at 5:31 PM, DIGHE, NILESH [AG/2362] <
nilesh.dighe at monsanto.com> wrote:
> Hi, I accidently left out few lines of code from the calclp function.
> Updated function is pasted below.
>
> I am still getting the same error ?Error: !(any(data1$norm_sd >= 1)) is
> not TRUE?
>
>
>
2010 Apr 27
5
get means of elements of 5 matrices in a list
I've got a list of 5 matrices that are each 5 x 6. I'd like to end up with a
5 x 6 matrix that contains the mean value of the 5 original matrices. I can
do this by brute force, but there must be a better way than making each
matrix into a vector and then remaking a matrix
thanks very much for any help
david freedman
ll=list(structure(c(9.7, 17.6, 20.8, 24.1, 33.8, 14.5, 25.7, 29.8,
2013 Nov 24
1
create a new dataframe with intervals and computing a weighted average for each of its rows
I need you help with this problem, I have a data-frame like this:
BHID=c(43,43,43,43,44,44,44,44,44) FROM=c(50.9,46.7,44.2,43.1,52.3,51.9,49.3,46.2,42.38) TO=c(46.7,44.2,43.1,40.9,51.9,49.3,46.2,42.38,36.3) AR=c(45,46,0.0,38.45,50.05,22.9,0,25,9) DF<-data.frame(BHID,FROM,TO,VALUE) #add the length DF$LENGTH=DF$FROM-DF$TO
where:
+ BHID: is the borehole
2010 Jan 29
2
Create matrix with subset from unlist
Hello all,
I'm trying to create a 2x2 matrix, 32 times after unlist() so that I can
convert the list to matrix. I've looked through the R archive but
couldn't find the answer. There is what I've done.
> f <- system("ls *.txt", intern=TRUE)
> x <- lapply(f, read.table)
> x
[[1]]
V1 V2
1 -27.3 14.4
2 29.0 -38.1
[[2]]
V1 V2
1 14.4
2017 Dec 14
1
help with recursive function
Your code contains the lines
stopifnot(!(any(data1$norm_sd >= 1)))
if (!(any(data1$norm_sd >= 1))) {
df1 <- dat1
return(df1)
}
stop() "throws an error", causing the current function and all functions in
the call
stack to abort and return nothing. It does not mean to stop now and return
a result.
Does the function give
2010 Jan 16
2
Drought severity index: Excel to R
Dear all,
I'm trying to make an R code for the drought severity index (DSI)
developed by Philips and McGregor (1998). You can refer to the
description of the algorithm on page 19 from
http://dissertations.port.ac.uk/229/01/MaloneS.pdf
The code is given in Excel as the following and can be found on page 60
from the same link.
C7 =
IF(C6<0,IF(@SUM(A6:A1)<0,C6+A6,"0"),