Hi
As usual in R, things could be done by different ways.
idx <- (0:(ncol(dfr)-1))%/%3
aggregate(t(dfr), list(idx), median)
Group.1 V1 V2 V3
1 0 2 3 4
2 1 4 5 1
Results should be OK although its structure is different, performance is not
tested.
Cheers
Petr
> -Origina
Anna wrote:
Hi all,
I need to calculate a row median for every three columns of a
dataframe. I made it work using the following script, but not happy
with the script. Is there a simpler way for doing this?
To which Jim L responded:
Hi Anna,
I can't think of a simple way, but this fun
Hi Peter,
One way is to process the strings before converting them to dates:
x2<-c("45-12-03","01-06-24","04-9-15","1901-03-04")
add_century<-function(x,changeover=68,previous=19,current=20) {
centuries<-sapply(sapply(x,strsplit,"-"),"[",1)
shortyears<-which(!(nchar(centuries)>2))
century<-rep(
Thanks
Bernard
Sent from my iPhone so please excuse the spelling!"
> On Apr 16, 2020, at 9:01 PM, Ista Zahn wrote:
>
> On Thu, Apr 16, 2020 at 8:05 PM Bernard Comcast
> wrote:
>>
>> Yes Ista, that is what I meant by interactive. Something that is menu driven
>> with a GUI rather than comman
Thanks
Bernard
Sent from my iPhone so please excuse the spelling!"
> On Apr 16, 2020, at 6:10 PM, Bert Gunter wrote:
>
> In addition ...
>
> https://cran.r-project.org/web/views/TeachingStatistics.html
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming alon
Inline.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Apr 16, 2020 at 5:28 PM Jim Lemon wrote:
> Hi Anna,
> I can't think of a simple way, but this fun
On Thu, Apr 16, 2020 at 8:05 PM Bernard Comcast
wrote:
>
> Yes Ista, that is what I meant by interactive. Something that is menu driven
> with a GUI rather than command line.
There are several. I'm aware of these
https://jasp-stats.org/
https://socialsciences.mcmaster.ca/jfox/Misc/Rcmdr/
http:/
Hi Anna,
I can't think of a simple way, but this function may make you happier:
step_median<-function(x,window) {
x<-unlist(x)
stop<-length(x)-window+1
xout<-NA
nindx<-1
for(i in seq(1,stop,by=window)) {
xout[nindx]<-do.call("median",list(x[i:(i+window-1)]))
nindx<-nindx+1
}
return(xout
Yes Ista, that is what I meant by interactive. Something that is menu driven
with a GUI rather than command line.
Thanks
Bernard
Sent from my iPhone so please excuse the spelling!"
> On Apr 16, 2020, at 5:44 PM, Ista Zahn wrote:
>
> On Thu, Apr 16, 2020 at 4:48 PM Bernard Comcast
> wrote:
>
In addition ...
https://cran.r-project.org/web/views/TeachingStatistics.html
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Apr 16, 2020 at 2:44 PM Ista Z
On Thu, Apr 16, 2020 at 4:48 PM Bernard Comcast
wrote:
>
> Do any of you know of any interactive stats analysis packages built on top of
> R?
R _is_ an interactive stats package, please be more specific :-)
Maybe you mean something like https://dreamrs.github.io/esquisse/index.html
Best,
Ista
Do any of you know of any interactive stats analysis packages built on top of R?
Bernard
Sent from my iPhone so please excuse the spelling!"
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
Hi!
For more solutions look at
https://stackoverflow.com/questions/33221603/r-lubridate-returns-unwanted-century-when-given-two-digit-year
The proposed solution:
some_dates <- c("3/18/75", "March 10, 1994", "10/1/80", "June 15, 1979")
dates <- mdy(some_dates)
future_dates <- year(dates
You have *not* calculated row medians for all combinations of (is that
what you meant?) 3 columns of your data frame.
?combn with column indexing can help you do that. If that is not what
you meant, then ??
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and s
Hi all,
Does anyone know whether there was a change to the algorithm of the glm
function between versions 3.4.0 and 3.5.1 of the stats package? I noticed the
introduction of the 'singular.ok' option, but I'm seeing more fundamental
differences in the output of Generalised Linear Models between
I have a data set (.csv) with date (eg date of birth) information stored as
character vectors that I’m attempting to transform to POSIXct objects using the
package lubridate (1.7.4). The problem that I’m trying to address is that my
two digit years are invariably (?) parsed to 20xx. For example,
Hi all,
I need to calculate a row median for every three columns of a dataframe. I
made it work using the following script, but not happy with the script. Is
there a simpler way for doing this?
df = data.frame("a"=c(2,3,4),
"b"=c(3,5,1),"c"=c(1,3,6),"d"=c(7,2,1),"e"=c(2,5,3),"f"=c(4,5,1))tmed
17 matches
Mail list logo