Re: [R] DCC help

2012-10-13 Thread R. Michael Weylandt
Forwarding to R-SIG-Finance where I believe you're likely to get more help: In the meanwhile, I think you may wish to look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Finally, I note you're posting from Nabble. Please include context in your

Re: [R] Loss of dimensions in subsetting arrays

2012-10-13 Thread Markku Karhunen
Ok, apologies. On Oct 12, 2012, at 2:52 AM, Markku Karhunen wrote: Hi all, I've been wondering for a long time why R drops the dimensions of an array/matrix when you try to take a subset of one column. I mean this: dim(A) [1] 2 5 2 B=A[1,,] dim(B) 5 2 # so now dim(B)[3] doesn't work

[R] hep on arithmetic covariance conversion to log-covariance

2012-10-13 Thread Andras Farkas
Dear All,   is there a function in R that would help me convert a covariance matrix built based on arithmetic returns to a covariance matrix from log-returns?   As an example of the means and covariance from arithmetic:   mu -c(0.094,0.006,1.337,1.046,0.263) sigma

Re: [R] better example for multivariate data simulation question-please help if you can

2012-10-13 Thread R. Michael Weylandt
[Lightly edited for legibility.] On Fri, Oct 12, 2012 at 7:39 PM, Andras Farkas motyoc...@yahoo.com wrote: Dear All, [A] few weeks ago I have posted a question on the R help listserv that some of you have responded to with a great solution, would like to thank you for that again. I

Re: [R] RTAQ - convert function: warning causes incorrect loading of data

2012-10-13 Thread Nicolae Caprarescu
Hi Michael, Thank you for pointing me in the right direction, I'm now using an email client rather than Nabble. Related to the issue I described below, it's resolved now, I have managed to fix it myself. However, I believe this might be a bug, or at least something that needs improving; I have

[R] Function hatTrace in package lme4

2012-10-13 Thread ingaschwabe
Dear all, For a project I need to calculate the conditional AIC of a mixed effects model. Luckily, I found a reference in the R help forum for a function to be used: CAIC - function(model) { sigma - attr(VarCorr(model), 'sc') observed - attr(model, 'y') predicted -

[R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread siddu479
Dear R-Users and experts, This is my first post in this forum. I have two csv files file1 and file2. file1(many rows and columns) is read into dataframe *data1* File2 is read into dataframe *data2* which have only one column of data which contains the column names that need to be removed from

Re: [R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread Jeff Newmiller
I suggest you go back to the Introduction to R document supplied with the software and read about indexing. In particular, pay attention to indexing into a matrix or data frame using data1[rowspec,columnspec] syntax. There are three kinds of row and column specification types, and any of the

Re: [R] ccf(x,y) vs. cor() of x and lagged values of y

2012-10-13 Thread R. Michael Weylandt
On Fri, Oct 12, 2012 at 12:28 AM, Mihnea Constantinescu mihnea.co...@gmail.com wrote: Hi I'm computing the correlation between two time-series x_t and y_t-1 (time-series lagged using the lag(y,-1) function) using the cor() function and the returned value is different from the value of ccf()

Re: [R] hep on arithmetic covariance conversion to log-covariance

2012-10-13 Thread Berend Hasselman
On 13-10-2012, at 13:21, Andras Farkas wrote: Dear All, is there a function in R that would help me convert a covariance matrix built based on arithmetic returns to a covariance matrix from log-returns? As an example of the means and covariance from arithmetic: mu

[R] XML_3.95-0.1.tar.gz does not build on FreeBSD

2012-10-13 Thread Rainer Hurling
I tried to build (and install) XML_3.95-0.1.tar.gz on FreeBSD 10.0-CURRENT amd64, but it stopped during the check of R_HAS_REMOVE_FINALIZERS (full log appended): -- R CMD INSTALL XML_3.95-0.1.tar.gz [..snip..] Checking for 1.8: -DR_HAS_REMOVE_FINALIZERS=1

Re: [R] [R-SIG-Finance] RTAQ - convert function: warning causes incorrect loading of data

2012-10-13 Thread Jeff Ryan
FWIW %m is the proper conversion for months. %M is minutes. Looks like a bug. Jeffrey Ryan|Founder|jeffrey.r...@lemnica.com www.lemnica.com On Oct 13, 2012, at 10:33 AM, Nicolae Caprarescu capra...@cs.man.ac.uk wrote: Hi Michael, Thank you for pointing me in the right

Re: [R] RWinEdt will not start properly

2012-10-13 Thread Uwe Ligges
RWinEdt has not yet been updated to work with WinEdt 7 (which shows some incompatible changes). Please try with WinEdt 6 or earlier. An update is under consideration but may take another month or two. Best, Uwe Ligges On 12.10.2012 18:20, Mark Irwin wrote: When trying to start RWinEdt

Re: [R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread siddu479
Thanks Arun for your quick reply.. Short code.. but brilliant. It works very well for my requirement. My actual data has thousands of columns fed into random forest model where I need to remove some of the columns fed from another file by keep adding/removing the input sensors. Thanks once again.

Re: [R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread Rui Barradas
Hello, Try the following. keep - which(!names(data2) %in% names(data1)) data1[, keep] Hope this helps, Rui Barradas Em 13-10-2012 15:48, siddu479 escreveu: Dear R-Users and experts, This is my first post in this forum. I have two csv files file1 and file2. file1(many rows and columns) is

Re: [R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread arun
Hi Rui, By running your code on an example dataset: set.seed(1) dat1-data.frame(Sno=sample(1:50,10,replace=TRUE),Data_1=rnorm(10,15),Data_2=rnorm(10,25),Data_3=runif(10,0.5)) dat2-read.table(text= Data_2 Data_3 ,sep=,header=FALSE,stringsAsFactors=FALSE) keep - which(!names(dat2) %in%

[R] Replace column values in R conditional on values from different column

2012-10-13 Thread GradStudentDD
Dear List, I am working on a stats project and have been stumped by the issue of replacing values in a column conditional on values from a different column. I searched the forum and google in general, and was able to put some code together, but it's not working the way it's supposed to... I

[R] WLS regression weights

2012-10-13 Thread Eiko Fried
Hello. I'm am trying to follow a recommendation to deal with a dependent variable in a linear regression. I read that, due to the positive trend in my dependent variable residual vs mean function, I should 1) run a linear regression to estimate the standard deviations from this trend, and 2) run

Re: [R] Replace column values in R conditional on values from different column

2012-10-13 Thread Pascal Oettli
Hello, No need for a loop. else if doesn't exist in R. And Health2$CohenM and Health2_CohenF have to be created first, in case of a loop If Health2$q_5a only have 1 and 2 as possible values, just use which and -. And I would suggest to not add new variables in your data frame, because you

Re: [R] Replace column values in R conditional on values from different column

2012-10-13 Thread arun
HI, Not sure how your dataset looks like and not very clear whether this is what you want. Try this: set.seed(1) Health1-data.frame(q_5=sample(1:2,10,replace=TRUE),CohenSum=rnorm(10,25)) Health2-data.frame(Health1,CohenM=NA,CohenF=NA) idxM-which(Health2$q_5==1)  idxF-which(Health2$q_5==2)

Re: [R] Replace column values in R conditional on values from different column

2012-10-13 Thread GradStudentDD
Thank you so much!!! This is exactly what I needed!! Have a wonderful rest of the weekend!! -- View this message in context: http://r.789695.n4.nabble.com/Replace-column-values-in-R-conditional-on-values-from-different-column-tp4646087p4646091.html Sent from the R help mailing list archive at

Re: [R] Filtering few column from one data frame based on another data frame

2012-10-13 Thread Rui Barradas
Hello, You're right, that's the result of not having test data (and being in a hurry). Anyway, apologies to the op, and thanks for the correction. Rui Barradas Em 13-10-2012 19:13, arun escreveu: Hi Rui, By running your code on an example dataset: set.seed(1)

Re: [R] White test

2012-10-13 Thread Rui Barradas
Hello, Try package tseries, function white.test(). Hope this helps, Rui Barradas Em 13-10-2012 21:40, Afrae Hassouni escreveu: Hello, Is there a way to perform a White test (testing heteroscedasticity) under R? Best regards, Afrae Hassouni __

[R] input arguments in a file into rscript

2012-10-13 Thread Wensui Liu
dear listers, with rscript, i know how to feed arguments by command line directly, e.g. Rscript test.r 10 20. however, if i saved all arguments in a file, how do i make rscript to take arguments in this file? Rscript test.r input.txt doesn't seem to work for me. (ps: i am using windows) thanks

Re: [R] Problem with a submission to jss

2012-10-13 Thread Duncan Murdoch
On 12-10-13 3:20 PM, Christophe Genolini wrote: Hi the list, I am about to submit an article describing an R package to the Journal of Statistical Software but I encounter a strange behavior of LaTeX: the numbering of the figure is correct (1. 2. 3. ...), but when I make a reference to a

Re: [R] input arguments in a file into rscript

2012-10-13 Thread Duncan Murdoch
On 12-10-13 5:16 PM, Wensui Liu wrote: dear listers, with rscript, i know how to feed arguments by command line directly, e.g. Rscript test.r 10 20. however, if i saved all arguments in a file, how do i make rscript to take arguments in this file? Rscript test.r input.txt doesn't seem to work

Re: [R] WLS regression weights

2012-10-13 Thread Rui Barradas
Hello, I find your recommended procedure not very sensible but: a) sum(fit$residuals^2)/fit|$d||f.residual | b) This is a statistical question but, for instance, in the case of repeated mesures. But you'd use the precision (1/variance) of the original data, computed by groups of regressor.

Re: [R] Replace column values in R conditional on values from different column

2012-10-13 Thread Pieter Schoonees
Or have a look at tapply(). -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pascal Oettli Sent: Saturday, October 13, 2012 22:16 To: GradStudentDD Cc: r-help@r-project.org Subject: Re: [R] Replace column values in R

[R] Problems with coxph and survfit in a stratified model with interactions

2012-10-13 Thread rm
I’m trying to set up proportional hazard model that is stratified with respect to covariate 1 and has an interaction between covariate 1 and another variable, covariate 2. Both variables are categorical. In the following, I try to illustrate the two problems that I’ve encountered, using the lung

[R] Please remove my email address from the list

2012-10-13 Thread Jenny
Hi, Please remove my email address from the list. Thanks a lot! Sent from my iPad __ 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

[R] Problems with coxph and survfit in a stratified model with interactions

2012-10-13 Thread rm
I’m trying to set up proportional hazard model that is stratified with respect to covariate 1 and has an interaction between covariate 1 and another variable, covariate 2. Both variables are categorical. In the following, I try to illustrate the two problems that I’ve encountered, using the lung

[R] Pivot Table like structure

2012-10-13 Thread Bhupendrasinh Thakre
HI Team, I am currently working on problem and stumped on for loop. Data: structure(list(Coutry = structure(c(3L, 3L, 3L, 3L, 2L, 2L, 1L, 1L), .Label = c(J, M, U), class = factor), State = structure(c(1L, 1L, 4L, 2L, 5L, 5L, 3L, 6L), .Label = c(A, C, K, O, S, T), class = factor), City =

Re: [R] Pivot Table like structure

2012-10-13 Thread arun
Hi, Not very clear whether this is you want. #dat1 -data aggregate(cbind(dat1$State,dat1$Coutry,dat1$City),list(dat1$Char1,dat1$Char2,dat1$Char3),length) #or  ddply(dat1,.(Char1,Char2,Char3),colwise(length,c(State,Coutry,City))) #  Char1 Char2  Char3 State Coutry City #1 A  ABCD  ASDFG 1  

[R] svyhist and svyboxplot

2012-10-13 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, The following code is expected to produce 4 charts. But, I only get charts 1,2 , 4, NOT CHART # 3. For Chart# 3, I am getting the following error message: Error in tapply(1:NROW(x), list(factor(strata)), function(index) { : arguments must have same length I would appreciate if

Re: [R] svyhist and svyboxplot

2012-10-13 Thread Anthony Damico
R is case sensitive either change subset (nhis, xsmoke=='Never SMK') to subset (nhis, xsmoke=='Never Smk') or change labels=c('Current SMK','Former SMK', 'Never Smk') to labels=c('Current SMK','Former SMK', 'Never SMK') but not both :) On Sat, Oct 13, 2012 at 10:02 PM, Muhuri, Pradip

Re: [R] Please remove my email address from the list

2012-10-13 Thread Jim Lemon
On 10/14/2012 10:26 AM, Jenny wrote: Hi, Please remove my email address from the list. Thanks a lot! Hi Jenny, Look at the bottom of this message, 2nd line, and go there. Follow the instructions. Sent from my iPad figures __

Re: [R] svyhist and svyboxplot

2012-10-13 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Anthony, I now can't afford to forget that R is case-sensitive! Thank you so much! Pradip Muhuri From: Anthony Damico [ajdam...@gmail.com] Sent: Saturday, October 13, 2012 10:10 PM To: Muhuri, Pradip (SAMHSA/CBHSQ) Cc: Thomas Lumley; R help Subject: Re:

[R] daily batch mail in R?

2012-10-13 Thread Alok K. |Bohara, PhD
Is there anyway I could receive R emails once a day (in a batch)? How could I set it up? Alok -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide