[R] Problems in setting up in MARSS package

2013-08-29 Thread Nilesh Gupta
I am trying to model a state space process using the MARSS package. My model has two unobservable states and 5 observable time series along with external covariates in the observation process only. None of the coefficients in either of the two processes are time varying. After running my setup and

Re: [R] Validating data type

2013-08-29 Thread Jeff Newmiller
The answer to your question is yes. You can convert a column of values to Date using the as.Date function with the appropriate format, and then test if any values are NA using the is.na function, and find them with the which function. If you want something less vague then you should read the Pos

[R] Validating data type

2013-08-29 Thread jeffjohn
I'm very new to R. I have a data file that I have read in via read.csv. I expect one of the "columns" to be of type date for example. However at least one value in that column is not of date type. I know this because another program I am trying to process the file with is erroring, yet it doesn't

Re: [R] Omitted/blank variables in R function

2013-08-29 Thread Greg Snow
Look at the "missing" function. Or set the default value of the arguments to NA. On Thu, Aug 29, 2013 at 3:23 PM, newruser12345 wrote: > Hi All, > > I'm very green user and have little programming background, but appreciate > any and all help/direction. I have a spreadsheet that successfully s

Re: [R] Problem with "Peaks" package - followup…

2013-08-29 Thread arun
Hi, I am getting the same error with R 3.0.1 SpectrumSearch(y, sigma=3.0, threshold=1.0, background=TRUE, iterations=13, markov=FALSE, window=3) #Error in .Call("R_SpectrumSearchHighRes", as.vector(y), as.numeric(sigma),  :  # "R_SpectrumSearchHighRes" not available for .Call() for package "Pea

[R] Omitted/blank variables in R function

2013-08-29 Thread newruser12345
Hi All, I'm very green user and have little programming background, but appreciate any and all help/direction. I have a spreadsheet that successfully sends values from Excel cells to R as variables for a function, which then runs and generates a plot. I cannot figure out how to make R recognize

[R] Problem with "Peaks" package - followup…

2013-08-29 Thread Wildgruber, Christoph U.
Hi, I apologize for not following the posting rules… Here is the text from my previous post: "I started evaluating the 'Peaks' package a couple of months ago and found it to be quite useful. Getting back to it last week I had to set up my R environment due to hardware changes again. The Peaks

[R] Missing value handling for felm function in lfe package

2013-08-29 Thread Megha Patnaik
Dear All, I am trying to use the felm function in the lfe package. However it does not seem to deal with missing values the way the lm function does. I wish to tell it na.omit or na.action = na.omit but it does not recognize this. I need to allow for missing values as I have different specificatio

[R] Running pre R.14 version of R with R3.0.0

2013-08-29 Thread Luvalle, Michael J (Michael)
I upgraded R from 2.12.1 to 3.0.0 (on windows XP(, and as soon as I saved the 3.0.0 workspace, was unable to access .Rdata from 2.12.1. The message in the R console is "Error in loadNamesSpace(name): there is no package called parallel" and a popup window that says "Fatal error: unable to resto

Re: [R] calculate with different columns from different datasets

2013-08-29 Thread laro
Thank you for your answer. But further calculations will be much more difficult, like (1-b)^2 * Var(V1) for all matching columns where b is the slope from a regression V1 (from datset 1) on V1 (dataset 2) and Var(V1) the variance from V1(from dataset2). So what I'm looking for is somethi

[R] calculate with different columns from different datasets

2013-08-29 Thread laro
Hi thereI've got two datasets of the following form (just an example, the real dataset got a lot more columns)dataset1V1 V2 V32 6 84 3 41 9 8and dataset 2V1 V2 V36 8 42 0 78 1 3First, I'd like to calculate the followin

Re: [R] new.env() and attach for write?

2013-08-29 Thread Greg Snow
Or you can use with: > a <- new.env() > with(a, b <- function(x) x ) > a$b function(x) x On Wed, Aug 28, 2013 at 3:45 PM, ivo welch wrote: > duh! > > > > Ivo Welch (ivo.we...@gmail.com) > http://www.ivo-welch.info/ > J. Fred Weston Professor of Finance > Anderson School at UCLA, C519 >

Re: [R] scale breaks

2013-08-29 Thread Jim Lemon
On 08/30/2013 01:28 AM, Shane Carey wrote: Hello all, I have decided to go ahead with gap.boxplot. I am trying to suppress the axis labels, both x and y labels. I tried using axis.labels=NULL but it would not work. Hi Shane, To suppress the axis labels, pass an empty string: gap.barplot(...,x

Re: [R] why is this a factor?

2013-08-29 Thread Steve Lianoglou
Hi, On Thu, Aug 29, 2013 at 3:03 PM, Rolf Turner wrote: > On 29/08/13 12:10, Ista Zahn wrote: >> >> On Wed, Aug 28, 2013 at 7:44 PM, Steve Lianoglou >> wrote: >>> >>> Hi, >>> >>> On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn wrote: Or go all the way and put options(stringsAsFac

Re: [R] Vectorized version of colMeans/rowMeans for higher dimension arrays?

2013-08-29 Thread arun
Hi, You could try: res<-colMeans(aperm(moo,c(2,1,3))) resOld<-apply(moo,c(1,3),mean)  identical(res,resOld) #[1] TRUE #Speed: set.seed(285) moo1<- array(runif(1400*9*15),dim=c(1400,9,15)) system.time({res1<- colMeans(aperm(moo1,c(2,1,3)))})  #user  system elapsed  # 0.004   0.000   0.002 syste

Re: [R] why is this a factor?

2013-08-29 Thread Rolf Turner
On 29/08/13 12:10, Ista Zahn wrote: On Wed, Aug 28, 2013 at 7:44 PM, Steve Lianoglou wrote: Hi, On Wed, Aug 28, 2013 at 3:58 PM, Ista Zahn wrote: Or go all the way and put options(stringsAsFactors = FALSE) at the top your script or in your .Rprofile. This will prevent this kind of annoyanc

[R] Vectorized version of colMeans/rowMeans for higher dimension arrays?

2013-08-29 Thread Jonathan Greenberg
For matrices, colMeans/rowMeans are quick, vectorized functions. But say I have a higher dimensional array: moo <- array(runif(400*9*3),dim=c(400,9,3)) And I want to get the mean along the 2nd dimension. I can, of course, use apply: moo1 <- apply(moo,c(1,3),mean) But this is not a vectorized

Re: [R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Thanks, I'll try this as well. Srecko On Thu, Aug 29, 2013 at 3:26 PM, arun wrote: > > > Hi Srecko, > Try this: > dat1<- read.table(text=" > id module event time time_on_task Categurl > 1sys login 1373502892 80 B http:// > 2 taskadd 1373502892

Re: [R] Add new calculated column to data frame

2013-08-29 Thread arun
Hi Srecko, Try this: dat1<- read.table(text=" id module  event   time time_on_task Categ    url 1    sys  login 1373502892   80 B http:// 2   task    add 1373502892   80 A http://post/add?id=33&idp=67 3   task    add 1373502972   23 A  

Re: [R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Hi Arun, this could to the work... Thanks so much! On Thu, Aug 29, 2013 at 3:10 PM, arun wrote: > HI, > It's not really clear, but you can try this: > dat1<- read.table(text=" > id module event time time_on_task Categurl > 1sys login 1373502892 80 B > http://po

Re: [R] Add new calculated column to data frame

2013-08-29 Thread arun
HI, It's not really clear, but you can try this: dat1<- read.table(text=" id module  event   time time_on_task Categ    url   1    sys  login 1373502892   80 B    http://post/add?id=42&idp=45  2   task    add 1373502892   80 A http://post/add?id=33&idp=45  3   task 

Re: [R] spacing problem in main title using car package scatterplot

2013-08-29 Thread John Fox
Dear Gerard, Without your data, it's not possible to reproduce your problem exactly, but it's clear that it isn't specific to the scatterplot() function in the car package. For example, try plot(1:10) title(main=bquote(paste("Hypothesis 9.4.1\nBaseline XYZ with Disease Activity (DAS28)\nat Month

Re: [R] Help If

2013-08-29 Thread MacQueen, Don
In addition to the other suggestions, try typing help('&') -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 8/29/13 1:16 AM, "Mª Teresa Martinez Soriano" wrote: >Hi to everyone and sorry for my question, I would like

[R] spacing problem in main title using car package scatterplot

2013-08-29 Thread Gerard Smits
Hi All, I'm using R 3.0.0. I'm trying to add the sample size of the paired data (calculated by a function n(), which returns a value of 70, correctly). My main title works fine except that the '70' appears far to the right on the line as in: at Month 18 (N=

Re: [R] calculate with different columns from different datasets

2013-08-29 Thread arun
Hi, Try:  res<-sapply(seq_len(ncol(dat1)),function(i) setNames(((1-coef(lm(dat1[,i]~dat2[,i]))[2])^2)*var(dat2[,i]),NULL))  res #[1] 21.0 16.11842 18.69231 A.K. Thank you for your answer. But further calculations will be much more difficult, like (1-b)^2 * Var(V1)       for all matching

Re: [R] calculate with different columns from different datasets

2013-08-29 Thread arun
Hi, Try: dat1<- read.table(text=" V1 V2 V3 2 6 8 4 3 4 1 9 8 ",sep="",header=TRUE) dat2<- read.table(text=" V1 V2 V3 6 8 4 2 0 7 8 1 3 ",sep="",header=TRUE) res1<- as.matrix(dat1-dat2) res1 #    V1 V2 V3 #[1,] -4 -2  4 #[2,]  2  3 -3 #[3,] -7  8  5 res2<-t(t(dat1)-colMeans(dat2)) res2 #

Re: [R] Add new calculated column to data frame

2013-08-29 Thread arun
Hi, You could try this: dat1<- read.table(text=" id  module    event   time   time_on_task 1   sys login 1373502892   80 2   task    add  1373502892   80 3   task    add  1373502972   23 4   sys login 

Re: [R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Thanks Berend, I don't know why I didn't try that before posting the question... but... anyways, thanks for your help Srecko On Thu, Aug 29, 2013 at 11:34 AM, Berend Hasselman wrote: > > On 29-08-2013, at 20:15, srecko joksimovic > wrote: > > > Thanks Arun, > > > > this is great. However, it

Re: [R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Hi Arun, There is one more question... you explained me how to use split(dat1,cumsum(dat1$action=="login")) in one of previous questions, and that is great. Now, if I have something like this: id moduleevent time time_on_task 1 sys login 13735028

Re: [R] Add new calculated column to data frame

2013-08-29 Thread Berend Hasselman
On 29-08-2013, at 20:15, srecko joksimovic wrote: > Thanks Arun, > > this is great. However, it should be just a little bit different: > > # id event time time_on_task > #1 1add 1373502892 80 > #2 2add 1373502972 23 > #3 3 delete 1373502995 901

Re: [R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Thanks Arun, this is great. However, it should be just a little bit different: # id event time time_on_task #1 1add 1373502892 80 #2 2add 1373502972 23 #3 3 delete 1373502995 901 #4 4 view 1373503896 100 #5 5add 1373503996

Re: [R] Add new calculated column to data frame

2013-08-29 Thread arun
Hi, Try: dat1<- read.table(text=" id    event    time 1    add  1373502892 2    add  1373502972 3    delete  1373502995 4    view  1373503896 5    add  1373503996 ",sep="",header=TRUE,stringsAsFactors=FALSE)  dat1$time_on_task<- c(NA,diff(dat1$time))  dat1 #  id  event   time

Re: [R] A question about multivariate normal distribution with a diagonal covariance matrix

2013-08-29 Thread Marino David
You got the point. Thank you for pointing out the problem. Thanks again. David 2013/8/30 Duncan Murdoch > On 29/08/2013 1:37 PM, Marino David wrote: > >> Hi all R users: >> >> >> >> I am a little bit confused about the following results. See as follows: >> >> >> >> library(mvtnorm) >> >> >> >>

Re: [R] A question about multivariate normal distribution with a diagonal covariance matrix

2013-08-29 Thread Duncan Murdoch
On 29/08/2013 1:37 PM, Marino David wrote: Hi all R users: I am a little bit confused about the following results. See as follows: library(mvtnorm) xMean<-c(24.12,66.92,77.65,131.97,158.8) xVar<-c(0.01,0.06,0.32,0.18,0.95) xFloor<-floor(xMean) # use “mvtnorm” package p1<-dmvnorm(xF

[R] Add new calculated column to data frame

2013-08-29 Thread srecko joksimovic
Hi, I have a following data set: ideventtime (in sec) 1 add 1373502892 2 add 1373502972 3 delete 1373502995 4 view 1373503896 5 add 1373503996 ... I'd like to add new column "time on task" which is time elapsed between two events (id2 - id1...).

[R] A question about multivariate normal distribution with a diagonal covariance matrix

2013-08-29 Thread Marino David
Hi all R users: I am a little bit confused about the following results. See as follows: library(mvtnorm) xMean<-c(24.12,66.92,77.65,131.97,158.8) xVar<-c(0.01,0.06,0.32,0.18,0.95) xFloor<-floor(xMean) # use “mvtnorm” package p1<-dmvnorm(xFloor,mean=xMean,sigma=diag(xVar)) p2<-dmvnor

Re: [R] Help for a function

2013-08-29 Thread Rui Barradas
Hello, You should post your questions to r-help@r-project.org, the odds of getting more and better answers are greater. As for the question, try the following. Note that the functions now have an extra argument. incub <- function(x, n = 2){ x$Incubation <- 0 x$Incubation[1] <- x$Sympt

Re: [R] scale breaks

2013-08-29 Thread Shane Carey
"I would also like to display a y-axis value in the upper box" I got this part working now. On Thu, Aug 29, 2013 at 4:28 PM, Shane Carey wrote: > Hello all, > > I have decided to go ahead with gap.boxplot. I am trying to suppress the > axis labels, both x and y labels. I tried using axis.label

Re: [R] scale breaks

2013-08-29 Thread Shane Carey
Hello all, I have decided to go ahead with gap.boxplot. I am trying to suppress the axis labels, both x and y labels. I tried using axis.labels=NULL but it would not work. gap.boxplot(DATA$Conductivity~factor(DATA$UnitName_1),ylim=c(LOWER_Y_Conductivity,UPPER_Y_Conductivity_int),gap=gap_Conductiv

Re: [R] Narrowing values collected from .txt file

2013-08-29 Thread Morway, Eric
On Thu, Aug 29, 2013 at 5:40 AM, jim holtman wrote: > Here is how I would do it since are reading in the entire file. This > breaks on each "Flow Budget" section, extracts the RECHARGE values and > puts them in a list with the name of the Flow Budget: > I learned more R in studying your solutio

Re: [R] Plotting time vs number

2013-08-29 Thread John Kane
Please use dput() to supply data. It's a lot easier for readers to just copy and paste into R. I have no idea of what variables are associated with the columns below. John Kane Kingston ON Canada > -Original Message- > From: mohan.radhakrish...@polarisft.com > Sent: Thu, 29 Aug 2013 09

Re: [R] Help R

2013-08-29 Thread Jose Iparraguirre
As said by arun, the code is not clear. Ma Teresa, what is it that you actually want to do? Regards, José -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of arun Sent: 29 August 2013 15:12 To: R help Subject: Re: [R] Help R HI, You

Re: [R] Few doubts about ANOVA

2013-08-29 Thread John Kane
Looks like school is starting up again. We don't usually help with homework especially at this level. Read a text book John Kane Kingston ON Canada > -Original Message- > From: bal.chan...@gmail.com > Sent: Thu, 29 Aug 2013 15:57:29 +0530 > To: r-help@r-project.org > Subject: [R] Few do

Re: [R] Help R

2013-08-29 Thread arun
HI, Your code is not clear:  for( i in 1: nrow(D))  {    for( j in 5:ncol(D))    {     D[((D[i,j]/D[i,2])>1.5)]15999)]<-100   ##  "1.5)]15999)]"    }    ^^^    } D<- structure(list(X. = c(1108L, 1591L,

Re: [R] Help R

2013-08-29 Thread Zsurzsa Laszlo
Do you have NA/NAN in your data set? If yes our check with an IF or substitute them with a value that fits your need. I hope I understood correctly your problem. - - László-András Zsurzsa,

[R] Help R

2013-08-29 Thread Mª Teresa Martinez Soriano
Hi to everyone, I would like to replace some values in a data.frame (D) > str(D) 'data.frame': 116 obs. of 10 variables: $ X. : int 1108 1591 3408 3872 5823 8099 10640 12600 14680 14698 ... $ media : num 22 86.6 807 103.2 73 ... $ IE.2003: num 32 92 166 237 161 ... $ IE.2004: num

Re: [R] XLSX package + Excel creation question

2013-08-29 Thread Zsurzsa Laszlo
I understand you response but it does not solve the problem. I'am aware that one can simply color every cell in an excel file by using his own algorithm. The question was if I can write my data to a *single* cells and use different formatting for every piece of data. -

Re: [R] Sensitivy / Specificity and nulls

2013-08-29 Thread Donald Catanzaro
Hi All, I apologize for the opaqueness and I will try to make it clearer. I am comparing two diagnostic tests G (gold standard) and N (new). Both are real tests, real experiments. G is currently the gold standard because it is the best test available, not because it is a perfect test. G is a g

Re: [R] XLSX package + Excel creation question

2013-08-29 Thread Rainer Hurling
Am 29.08.2013 15:03 (UTC+1) schrieb Zsurzsa Laszlo: > First of all thank you for the quick resposen. > > I know I can color and set up every cell. I will take a look again * > CellStyle* but is it possbile for example to write an array to a single > cell that has different colors for some data. Ba

Re: [R] Calculation with Times Series

2013-08-29 Thread arun
HI, May be this helps:  ts1<- ts(1:20)  ts2<- ts(1:25) ts1[-(1:3)]<- ts1[-(1:3)]+ts2[1:17]  as.numeric(ts1) # [1]  1  2  3  5  7  9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 A.K. Hey everyone, I`m an absolut beginner in R and need some help for an exercise: I want to do ordinary calculati

[R] Few doubts about R

2013-08-29 Thread bala chand
Hi can you please give the brief explanation about anova? what is the purpose of null hypothesis in anova? how can we find future predictive value from existing data? [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] Few doubts about ANOVA

2013-08-29 Thread bala chand
Hi can you please give the brief explanation about anova? what is the purpose of null hypothesis in anova? how can we find future predictive value from existing data? [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] XLSX package + Excel creation question

2013-08-29 Thread Zsurzsa Laszlo
First of all thank you for the quick resposen. I know I can color and set up every cell. I will take a look again * CellStyle* but is it possbile for example to write an array to a single cell that has different colors for some data. Basically the color depends on the data. --

Re: [R] XLSX package + Excel creation question

2013-08-29 Thread Rainer Hurling
Am 29.08.2013 12:08 (UTC+1) schrieb Zsurzsa Laszlo: > Dear R users, > > I have a question about the xlsx package. It's possible to create excel > files and color cells and etc. yes, with package xlsx you can colourize you data sheets, even the fonts. See for example ?CellStyle . A good demonstra

[R] Fwd: Narrowing values collected from .txt file

2013-08-29 Thread jim holtman
Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. -- Forwarded message -- From: jim holtman Date: Thu, Aug 29, 2013 at 8:43 AM Subject: Re: [R] Narrowing values collected from .txt file To: "Mo

Re: [R] Narrowing values collected from .txt file

2013-08-29 Thread jim holtman
Here is how I would do it since are reading in the entire file. This breaks on each "Flow Budget" section, extracts the RECHARGE values and puts them in a list with the name of the Flow Budget: > # read entire file > input <- readLines("C:\\Users\\jh52822\\Downloads\\MCR_Budgets.txt") > # determ

Re: [R] Unsuccessful beginner's struggle with lm

2013-08-29 Thread Duncan Murdoch
On 13-08-29 8:23 AM, David Epstein wrote: I have two data frames, "train" and "response". Here is my attempt to do a linear regression. All entries of both data frames are numeric. I am expecting the intercept value to lie between 2 and 3 (in particular, non-zero). lm expects the variables in t

Re: [R] Sensitivy / Specificity and nulls

2013-08-29 Thread Michael Dewey
At 15:18 28/08/2013, Donald Catanzaro wrote: Good Day All, I am working with a diagnostic test and comparing the new test to an old test. Normally I would be able to calculate sensitivity and specificity quite easily. However, the 'gold standard' that I am comparing my new diagnostic with is r

[R] Unsuccessful beginner's struggle with lm

2013-08-29 Thread David Epstein
I have two data frames, "train" and "response". Here is my attempt to do a linear regression. All entries of both data frames are numeric. I am expecting the intercept value to lie between 2 and 3 (in particular, non-zero). Here is a record of my interaction with R: > class(response) [1] "data.fr

Re: [R] Plotting time vs number

2013-08-29 Thread Jim Lemon
On 08/29/2013 02:19 PM, mohan.radhakrish...@polarisft.com wrote: Hi, ... The plots are all there but the x=axis labels are not there. The graph labels are only '12:30', '13:30' and '14:30' I think I need to use your code to get all the values. Hi Mohan, Try this: plot(strptime(data$Time,"%H:

[R] XLSX package + Excel creation question

2013-08-29 Thread Zsurzsa Laszlo
Dear R users, I have a question about the xlsx package. It's possible to create excel files and color cells and etc. My question would be that is it possible to color only some part of the data hold in a cell. Let's assume I've got the following data : 167,153,120,100 and I want to color to red

Re: [R] Help If

2013-08-29 Thread Zsurzsa Laszlo
Hey if (( (1==1) && (2==2) ) || (3==3)) { print( "hello world") } - - László-András Zsurzsa,- - Msc. Infromatics, Technical University Munich, Germany - - Scientif

Re: [R] scale breaks

2013-08-29 Thread Shane Carey
Ok, thanks all :-) On Thu, Aug 29, 2013 at 2:39 AM, Jim Lemon wrote: > On 08/29/2013 02:52 AM, Shane Carey wrote: > >> Hi, >> >> Has anyone ever created scale breaks in R something like what is shown >> here >> in the section, >> Use a Scale Break >> >> http://www.r-bloggers.com/**graphing-high

Re: [R] Help If

2013-08-29 Thread Rui Barradas
Hello, and is && ; or is || ; and print() needs the parenthesis around its argument if((condition1 && condition2) || (condition3 && condition4)) {print(uhvef)} Hope this helps, Rui Barradas Em 29-08-2013 09:16, Mª Teresa Martinez Soriano escreveu: Hi to everyone and sorry for my question,

[R] Help If

2013-08-29 Thread Mª Teresa Martinez Soriano
Hi to everyone and sorry for my question, I would like to use IF in an example like this: If((condition1 and condition2) Or (condition 3 and condition4)) {print uhvef} BUt I don´t know how to write it correctly, Thanks in advance [[alternative