Comcast | 1 Nov 2011 01:04
Picon

Re: lapply and Two TimeStamps as input

Provide some sample data. For instance, a  data frame with two columns and the function.

On Oct 31, 2011, at 6:37 PM, Alaios <alaios <at> yahoo.com> wrote:

> Dear all,
> 
> I have a function that recognizes the following format for timestamps
> "%Y-%m-%d %H:%M:%S"
> 
> my function takes two input arguments the TimeStart and TimeEnd
> I would like to help me create the right list with pairs of TimeStart and TimeEnd which I can feed to lapply (I
am using mclapply actually). 
> For every lapply I want two inputs to be fed to my function. I only know how to feed one input to the lapply
> 
> Could you please help me with that?
> I would like to thank you in advance for your help
> 
> B.R
> Alex
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help <at> r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Comcast | 1 Nov 2011 01:18
Picon

Re: oversampling code


On Oct 31, 2011, at 1:54 PM, loubna ibn majdoub hassani <loubn181 <at> gmail.com> wrote:

> Hir
> I have an umbalanced data set where I want to predict a binary variable Y.
> I want to do an under sampling by keeping all the 1 and taking just some of
> the 0 such as I'll have 90% of 0 and 10% of 1.

ou haven' t given much detail , buteo thing like  this will take all of the 1's and 10% of the 0's

dfrm[c(rownames(dfrm[dorm$Y==1,]), sample(rownames(dfrm[dfrm$Y==0]), 0.10)) , ]
> Can u help me do that
> Thank u
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help <at> r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Pete Brecknock | 1 Nov 2011 01:21

Re: lapply and Two TimeStamps as input


alaios wrote:
> 
> Dear all,
> 
> I have a function that recognizes the following format for timestamps
> "%Y-%m-%d %H:%M:%S"
> 
> my function takes two input arguments the TimeStart and TimeEnd
> I would like to help me create the right list with pairs of TimeStart and
> TimeEnd which I can feed to lapply (I am using mclapply actually). 
> For every lapply I want two inputs to be fed to my function. I only know
> how to feed one input to the lapply
> 
> Could you please help me with that?
> I would like to thank you in advance for your help
> 
> B.R
> Alex
> 	[[alternative HTML version deleted]]
> 
> 
> ______________________________________________
> R-help <at>  mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

(Continue reading)

Weidong Gu | 1 Nov 2011 01:42
Picon

Re: oversampling code

You should figure out how many samples you want for Y=1 and 0, then
sample from the relevant subset dfrm[dfrm$Y==1] by sampling
row.names(dfrm[dfrm$Y==1] using replace=FALSE
?sample

On Mon, Oct 31, 2011 at 8:18 PM, Comcast <dwinsemius <at> comcast.net> wrote:
>
>
> On Oct 31, 2011, at 1:54 PM, loubna ibn majdoub hassani <loubn181 <at> gmail.com> wrote:
>
>> Hir
>> I have an umbalanced data set where I want to predict a binary variable Y.
>> I want to do an under sampling by keeping all the 1 and taking just some of
>> the 0 such as I'll have 90% of 0 and 10% of 1.
>
> ou haven' t given much detail , buteo thing like  this will take all of the 1's and 10% of the 0's
>
> dfrm[c(rownames(dfrm[dorm$Y==1,]), sample(rownames(dfrm[dfrm$Y==0]), 0.10)) , ]
>> Can u help me do that
>> Thank u
>>
>>    [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help <at> r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
(Continue reading)

Comcast | 1 Nov 2011 02:05
Picon

Re: Vectorize 'eol' characters


On Oct 31, 2011, at 2:01 PM, "Stefano Conti" <Stefano.Conti <at> hpa.org.uk> wrote:

> Thanks to Dr Shepard and Prof Riply for their helpful replies.
> 
> In my original query I should have also specified that I have tried the trick, also suggested by Prof
Ripley, of appending the extra-column to the original matrix before dumping to text; however, in cases
where the field separator string (argument of the 'sep' option in write.table) is non-null, I'd then have
it also between the original matrix's last column and the appended text column -- which is not what I want.
> 
> Any additional suggestion / follow-up on this?  With continued thanks,
> 

Sometimes it would help to answer the question, "why bother?"

I can imagine and have have even tested as a concept the possibility of intercepting the output of
capture.output(write.table(...)) so that the last separator could be removed. Before posting any code
I would like to see if the effort would be on target and worth the further effort. What separator are you
thinking would be used and how complex is this rolling eol???

(it's a bit like an actor saying to the director ... What's my motivation?)

--

-- 
David.
> 
> --
> Dr Stefano Conti
> Statistics Unit (room #2A19)
> Health Protection Services
> HPA Colindale
(Continue reading)

Vinny Moriarty | 1 Nov 2011 04:27
Picon

Multiple time series with zoo

Thanks for everyone's input so far, it is greatly appreciated. But I've got
one last task I could use some advice on

Here are the first few lines of my data set:

site,time_local,time_utc,reef_type_code,sensor_type,sensor_depth_m,temperature_c
06,2006-04-09 10:20:00,2006-04-09 20:20:00,BAK,sb39, 2, 29.63
06,2006-04-09 10:40:00,2006-04-09 20:40:00,BAK,sb39, 2, 29.56
06,2006-04-09 11:00:00,2006-04-09 21:00:00,BAK,sb39, 2, 29.51
06,2006-04-09 11:20:00,2006-04-09 21:20:00,BAK,sb39, 10, 29.53
06,2006-04-09 11:40:00,2006-04-09 21:40:00,BAK,sb39, 2, 29.57
06,2006-04-09 12:00:00,2006-04-09 22:00:00,BAK,sb39, 2, 29.60
06,2006-04-09 12:20:00,2006-04-09 22:20:00,BAK,sb39, 2, 29.66
06,2006-04-09 12:40:00,2006-04-09 22:40:00,BAK,sb39, 2, 29.68
06,2006-04-09 13:00:00,2006-04-09 23:00:00,BAK,sb39, 10, 29.68
06,2006-04-09 13:20:00,2006-04-09 23:20:00,BAK,sb39, 2, 29.71
06,2006-04-09 13:40:00,2006-04-09 23:40:00,BAK,sb39, 2, 29.68
06,2006-04-09 14:00:00,2006-04-10 00:00:00,BAK,sb39, 10, 29.49
06,2006-04-09 14:20:00,2006-04-10 00:20:00,BAK,sb39, 2, 29.31
06,2006-04-09 14:40:00,2006-04-10 00:40:00,BAK,sb39, 10, 29.27

My goal was to extract all of the 10m data (all of the "10"'s from the
"sensor_depth_m" column) and than calculate daily averages.

With the help from this forum I came up with this:

library(zoo)
Data=read.table("06_BottomMountThermistors.csv",sep=",",header=TRUE,as.is
=TRUE)
Ten=subset(Data,sensor_depth_m==10L)
(Continue reading)

RdR | 1 Nov 2011 04:38
Picon

Re: low sigma in lognormal fit of gamlss

Actually, I think I've spotted it: the link function for sigma is "log" and
exp(0.69) is nearly 2 -- the original sigma

-RdR

--
View this message in context: http://r.789695.n4.nabble.com/low-sigma-in-lognormal-fit-of-gamlss-tp3962480p3962487.html
Sent from the R help mailing list archive at Nabble.com.

RdR | 1 Nov 2011 04:34
Picon

low sigma in lognormal fit of gamlss

Hi,

I'm playing around with gamlss and don't entirely understand the sigma
result from an attempted lognormal fit.

In the example below, I've created lognormal data with mu=10 and sigma=2. 
When I try a gamlss fit, I get an estimated mu=9.947 and sigma=0.69

The mu estimate seems in the ballpark, but sigma is very low. I get similar
results on repeated trials and with Normal and standard normal
distributions.  How should I understand sigma in these results?

cheers,
RdR

######### Example  #########
# enable reproduction
set.seed(1234)

# create some lognormal data
X <- rlnorm(1000,meanlog=10,sdlog=2)

# try gamlss fit
gLNO <- gamlss(X~1,family=LNO)

summary(gLNO)

*******************************************************************
Family:  c("LNO", "Box-Cox") 

(Continue reading)

mmstat | 1 Nov 2011 05:49
Picon

drawing ellipses in R

Hello, 

I have been following the thread dated Monday, October 9, 2006 when Kamila Naxerova asked a question about
plotting elliptical shapes. Can you explain the equations for X and Y. I believe they used the parametric
form of x and y (x=r cos(theta), y=r sin(theta). I don't know what r is here ? Can you explain 1)the origin of
these equations and 2) what is r? 

Sincerely, 
Mary A. Marion 

	[[alternative HTML version deleted]]

ATANU | 1 Nov 2011 07:38
Picon

Re: quantmod package

Dear Michael ,
 Thanks for your help. I figured out the fault. Actually i was running the
code for a very short time(less than one minute) and was then trying to make
chart out of that. The code works well if I run it for more than one minute.
Thanks again for your help.

Atanu

--
View this message in context: http://r.789695.n4.nabble.com/quantmod-package-tp3921071p3962665.html
Sent from the R help mailing list archive at Nabble.com.


Gmane