Re: [R] dependent column(s) in data frame

2014-02-23 Thread PQuery
Well I first thought of using the MFA by considering my data as categorical but indeed the correspondence analysis methods are better suitable for my data structure, Thanks again, P -- View this message in context: http://r.789695.n4.nabble.com/dependent-column-s-in-data-frame-tp4685561p46857

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
That's what I am looking for. Thanks for being so helpful, I appreciate it very much. On Sun, Feb 23, 2014 at 10:16 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > On Sun, Feb 23, 2014 at 9:06 PM, C W wrote: > > Is there a way to rbind this? Do I have to use use a package like 'zoo

[R] FW: predict.lm() does not take ts objects in formula

2014-02-23 Thread Duncan Mackay
I forgot to send this to the list It may make things easier Duncan -Original Message- From: Duncan Mackay [mailto:dulca...@bigpond.com] Sent: Monday, 24 February 2014 10:01 To: 'C W' Subject: RE: [R] predict.lm() does not take ts objects in formula Hi You have not told us what newdata

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread Gabor Grothendieck
On Sun, Feb 23, 2014 at 9:06 PM, C W wrote: > Is there a way to rbind this? Do I have to use use a package like 'zoo' and > merge()? > > p <- predict(model, data.frame(t = 1, q = factor(1, 1:4)) > rbind(tsdat, p) > If you want to append this to the end of the series then try this: ts(c(tsdat,

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
Is there a way to rbind this? Do I have to use use a package like 'zoo' and merge()? p <- predict(model, data.frame(t = 1, q = factor(1, 1:4)) rbind(tsdat, p) On Sun, Feb 23, 2014 at 8:43 PM, C W wrote: > I guess this is for anyone in the future. > > > predict(model, data.frame(t = 1, q = fac

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
I guess this is for anyone in the future. > predict(model, data.frame(t = 1, q = factor(1, 1:4)) This would be the answer. Thanks again, Gabor! Mike On Sun, Feb 23, 2014 at 8:23 PM, Gabor Grothendieck wrote: > On Sun, Feb 23, 2014 at 7:40 PM, C W wrote: > > Gabor, > > Your response worked p

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread Gabor Grothendieck
On Sun, Feb 23, 2014 at 7:40 PM, C W wrote: > Gabor, > Your response worked perfectly, list(t = 1, q = factor(1, 1:4) was what I > couldn't figure out. Thank you. > > In predict.lm(model, newdata), 2nd argument MUST be data.frame(). Why does > list() also work? > Yes, it would be better to use

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
Gabor, Your response worked perfectly, list(t = 1, q = factor(1, 1:4) was what I couldn't figure out. Thank you. In predict.lm(model, newdata), 2nd argument MUST be data.frame(). Why does list() also work? Mike On Sun, Feb 23, 2014 at 7:32 PM, Gabor Grothendieck wrote: > On Sun, Feb 23, 20

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread Gabor Grothendieck
On Sun, Feb 23, 2014 at 7:25 PM, C W wrote: > Gabor, > Let me change newdata since it's confusing. > > Suppose I want to predict, year 1990, and quarter 2. >> newdata <- data.frame(c(1990, 1, 0, 0) > > Since Q1 is a baseline, we will only see Q2, Q3, Q4. So, 4 parameters in > total. > The formul

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
Gabor, Let me change newdata since it's confusing. Suppose I want to predict, year 1990, and quarter 2. > newdata <- data.frame(c(1990, 1, 0, 0) Since Q1 is a baseline, we will only see Q2, Q3, Q4. So, 4 parameters in total. Mike On Sun, Feb 23, 2014 at 7:13 PM, Gabor Grothendieck wrote: >

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread Gabor Grothendieck
On Sun, Feb 23, 2014 at 6:56 PM, C W wrote: > Gabor, > I want the new data to be this, > newdata <- data.frame(c(1, 0, 0, 0)) > Its not clear what this means. There are two input variables so we must specify two inputs. For example, this would get the prediction for t=1 and for level 1 of q whic

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
Gabor, I want the new data to be this, newdata <- data.frame(c(1, 0, 0, 0)) Here the code with the new data, > dat <- rnorm(20) > tsdat <- ts(dat, start=c(1900, 1), freq=4) > q <- as.factor(rep(1:4, 5)) > t <- 1:20 > lm(tsdat~t+q) Call: lm(formula = tsdat ~ t + q) Coefficients: (Intercept)

Re: [R] predict.lm() does not take ts objects in formula

2014-02-23 Thread Gabor Grothendieck
On Sun, Feb 23, 2014 at 6:34 PM, C W wrote: > Hello, > I don't know how to use predict.lm() for ts object. > > Here's the time series regression. > y = t + Q1 + Q2 + Q3 + Q4 > > Here's my R code, > >> dat <- rnorm(20) >> tsdat <- ts(dat, start=c(1900, 1), freq=4) >> q <- as.factor(rep(1:4, 5)) >>

Re: [R] Basic R codes

2014-02-23 Thread arun
HI, For the first question: you could do,  vec1 <- c(rep(0:4,each=5),rep(0:4,5:1)) as.vector(tapply(vec1,cumsum(abs(c(0,diff(vec1,FUN=paste,collapse="")) # [1] "0" "1" "2" "3" "4" "0" ""  "222"   "33"   #[10] "4"    Second question is not clear.  May be this link

[R] predict.lm() does not take ts() objects in formula

2014-02-23 Thread C W
Hello list, Does predict.lm() take ts object. I am aware that it requires data to come in data.frame Here's the time series regression. y = t + Q1 + Q2 + Q3 + Q4 Here's my R code, > dat <- rnorm(20) > tsdat <- ts(dat, start=c(1900, 1), freq=4) > q <- as.factor(rep(1:4, 5)) > t <- 1:20 > lm(ts

[R] predict.lm() does not take ts objects in formula

2014-02-23 Thread C W
Hello, I don't know how to use predict.lm() for ts object. Here's the time series regression. y = t + Q1 + Q2 + Q3 + Q4 Here's my R code, > dat <- rnorm(20) > tsdat <- ts(dat, start=c(1900, 1), freq=4) > q <- as.factor(rep(1:4, 5)) > t <- 1:20 > lm(tsdat~t+q) Call: lm(formula = tsdat ~ t + q)

[R] Running an encryption function on a column in a data.frame

2014-02-23 Thread Gavin Rudge
I am trying to encrypt postcodes (zipcodes) which, in my datasets, are strings with 8 characters, including spaces. By referring to other help files and other R resources I've built some (clumsy looking) code that turns a postcode into an output I'm happy with. See below. library("PKI") #make a

[R] help with encrypting a text string in a data.frame

2014-02-23 Thread gavinr
I am trying to encrypt postcodes (zipcodes) which, in my datasets, are strings with 8 characters, including spaces. By referring to other help files and other R resources I've built some (clumsy looking) code that turns a postcode into an output I'm happy with. See below. library("PKI") #make a

Re: [R] equivalent of $\check Y$ in plotmath

2014-02-23 Thread Ranjan Maitra
Thanks, Yihui!! This works!! Best wishes, Ranjan On Sun, 23 Feb 2014 11:31:35 -0600 Yihui Xie wrote: > Whenever plotmath is unable to provide what you want, you can always > go to tikzDevice for native LaTeX support: > http://yihui.name/en/2011/04/produce-authentic-math-formulas-in-r-graphics/

Re: [R] equivalent of $\check Y$ in plotmath

2014-02-23 Thread Yihui Xie
Whenever plotmath is unable to provide what you want, you can always go to tikzDevice for native LaTeX support: http://yihui.name/en/2011/04/produce-authentic-math-formulas-in-r-graphics/ Here is an example: library(tikzDevice) tikz('test-math.tex', standAlone = TRUE) plot(1, main = '$\\check{Y}$'

Re: [R] Proportional Venn diagram 6 sets with labels with pkg:venneuler

2014-02-23 Thread David Winsemius
On Feb 23, 2014, at 7:11 AM, Luigi Marongiu wrote: > Dear all, Dear Luigi; Please stop posting triplicate postings and also learn to post in plain text. > > I would like to draw a Venn plot for data represented by 6 variables (or > sets). I know how to do this using the package venneuler (wh

[R] Proportional Venn diagram 6 sets with labels

2014-02-23 Thread Luigi Marongiu
Dear all, I would like to draw a Venn plot for data represented by 6 variables (or sets). I know how to do this using the package venneuler (which requires rJava). However this package does not report the numbers of elements within each class. Do you know an alternative to this package to draw th

[R] Proportional Venn diagram with 6 sets and labels

2014-02-23 Thread Luigi Marongiu
Dear all, I would like to draw a Venn plot for data represented by 6 variables (or sets). I know how to do this using the package venneuler (which requires rJava). However this package does not report the numbers of elements within each class. Do you know an alternative to this package to draw th

[R] Proportional Venn diagram with 6 sest and labels

2014-02-23 Thread Luigi Marongiu
Dear all, I would like to draw a Venn plot for data represented by 6 variables (or sets). I know how to do this using the package venneuler (which requires rJava). However this package does not report the numbers of elements within each class. Do you know an alternative to this package to draw th