[R] Odp: xtabs - missing combination

2009-12-13 Thread Petr PIKAL
Hi

I am not sure if it solves your problem

tab1<-xtabs(value ~ r07 + r08, df1)
tab1[xtabs( ~ r07 + r08, df1)==0]<-NA
tab1
   r08
r07  A  B  C  D
  A  1  2 4
  B  5  6  7  8
  C  9 10 11 12
  D 13  0 15 16
>

however this is slightly different from tapply output. As I understand 
help page if you put value at the left hand side you get result summed for 
all levels. Combination AC does not exist however A and C levels are 
present so the result tells you correctly that the sum of AC combination 
is zero.

Regards
Petr




r-help-boun...@r-project.org napsal dne 13.12.2009 01:21:48:

> Dear list,
> 
> I am trying to make a contingency table with xtabs but I am getting
> a 0 where I expect a 'NA'. Here is a simple example:
> 
> options(stringsAsFactors = FALSE)
> rn <- LETTERS[1:4]
> df1 <- data.frame(r07 = rep(rn, each=4),
>r08 = rep(rn, 4), value = 1:16)
> xtabs(value ~ r07 + r08, df1)
> 
> # Delete the combination [A, C]
> df1 <- df1[-3,]
> 
> # Set 'value' for this combination to 0
> df1[13, 3] <- 0
> 
> # This is the output I want
> tapply(df1[, "value"], df1[, c("r07", "r08")], c)
> 
> # but using 'xtabs' I get a 0 for [A, C]
> xtabs(value ~ r07 + r08, df1)
> 
> Hmm, what have I missed...
> 
> Thanks for any help!
> 
> Best,
> Patrick
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.

__
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 provide commented, minimal, self-contained, reproducible code.


[R] R square in NLS-urgent help

2009-12-13 Thread ruchita gupta
Hello

I need one urgent help
I am trying to fit the Sigmod curve of logistic growth model using NLS
estimation.
But i do not get the R square value in that even after getting the "Summary"
In that case how to compare the fit for 3 models and find which one is
better fit??

How to get this R Square value when using NLS estimation?

Thanks
Ruchita

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] R square in NLS-urgent help

2009-12-13 Thread ruchita gupta
Hello

I need one urgent help
I am trying to fit the Sigmod curve of logistic growth model using NLS
estimation.
But i do not get the R square value in that even after getting the "Summary"
In that case how to compare the fit for 3 models and find which one is
better fit??

How to get this R Square value when using NLS estimation?

Thanks
Ruchita

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] RPART - printing full splitting rule number on tree plot

2009-12-13 Thread Rebecca O'Leary
Dear R-users

 

I am using RPART package to get regression trees.  However having trouble 
getting the text function to put the full splitting rule number on the plot, 
instead to puts it in scientific notation.  When a covariate has 1e4 or greater 
number of digits then the splitting rule number displayed on the plot is in 
scientific notation.  But print.rpart displays the splitting rules in full.  I 
have tried using digits option in text function but this only alters digits of 
the mean displayed at terminal nodes.  How do I get the full splitting rule 
number displayed on the tree plot?

Below is an example. 

 

library(rpart)

temp <- as.data.frame(cbind(kyphosis, Start2=kyphosis$Start))

 

temp$Start2 <- temp$Start2+1

 

fit1 <- rpart(Age~ Kyphosis +Number + Start2, data=temp)

plot(fit1)

text(fit1, use.n=TRUE, digits=5)

Thanks


 Dr Rebecca O'Leary, PhD

 Biostatistician
 Senior Research Officer
 UWA Centre for Child Health Research
 Telethon Institute for Child Health Research, 100 Roberts Rd, Subiaco
 Perth WA 6008 Australia
 Email: role...@ichr.uwa.edu.au
 Tel: +61-8-9489 7745
 Fax: +61-8-9489 7700


#
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal
#

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] hierarchical model in R

2009-12-13 Thread albina

Hi!

I have the following situation of mixture distributions:

The number of eggs, N, laid by a female of certain species of butterfly
follows a Poisson(F) distribution, where the fertility F follows an
exponential distribution with expectation 1/lambda. Each egg hatches with
probability p, and approximately half of the eggs develop into females. 
Simulate sets of 1000 and 5000 samples for the number eggs hatching, and the
corresponding number of females for each group of eggs. Draw histograms for
the two variables and use your data for obtaining the mean and variance of
the number of eggs hatching and the number of females. Use the following
combinations of parameters:

lambda p
100 0.4
100 0.2
50   0.4
50   0.8


So far I have 
 
F=rexp(1000, 1/100)
N=rpois(1000,F)
X=rbinom(N, 1000,0.4)
hist(X)

I've done the same for all the values but I'm not sure

Thanks in advance, 
albina


-- 
View this message in context: 
http://n4.nabble.com/hierarchical-model-in-R-tp963168p963168.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


[R] Error with hgu133a2.db

2009-12-13 Thread mkna005 mkna005
Hi,
I'm trying to get this library working under R2.10.0. I downloaded it
and installed it from zip file. i get the following output.

> library(hgu133a2.db)
Error in library(hgu133a2.db) : there is no package called 'hgu133a2.db'
> utils:::menuInstallLocal()
package 'hgu133a2.db' successfully unpacked and MD5 sums checked
> library(hgu133a2.db)
Loading required package: AnnotationDbi
Loading required package: Biobase

Welcome to Bioconductor

 Vignettes contain introductory material. To view, type
 'openVignette()'. To cite Bioconductor, see
 'citation("Biobase")' and for packages 'citation(pkgname)'.

Loading required package: DBI
Error in fun(...) : could not find function "createAnnObjs.HUMANCHIP_DB"
In addition: Warning message:
package 'hgu133a2.db' was built under R version 2.7.0 and help will
not work correctly
Please re-install it
Error : .onLoad failed in 'loadNamespace' for 'hgu133a2.db'
Error: package/namespace load failed for 'hgu133a2.db'

Whats the problem and how can I fix it?

Thanks

Christoph

__
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 provide commented, minimal, self-contained, reproducible code.


[R] how to use Rengine instance to parse R script String

2009-12-13 Thread hobartlul

Hello everyone

I am currently developing a web based R script editor. My idea is to pass
the R script command as a string into the backend , then use the Rengine
instance to parse the R script command and get the resutls. Do anyone know
how to use Rengine instance to parse a R script String? if so, could you
give me a small example (in Java)? i really appreciate.

 
-- 
View this message in context: 
http://n4.nabble.com/how-to-use-Rengine-instance-to-parse-R-script-String-tp963194p963194.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] help: forest plots

2009-12-13 Thread Kim Jung Hwa
Thanks for this link. It helps, but I have to make lots of forest plots and
these R scripts are not generic.

Are you aware of similar functions as forest(), which can take input in the
form of estimates, lower_limit, upper_limit? Thanks a lot!

~Kim

On Sun, Dec 13, 2009 at 8:12 PM, C.H.  wrote:

> This one does required the metafor package.
>
> http://tables2graphs.com/doku.php?id=04_regression_coefficients
>
>
>
> On Mon, Dec 14, 2009 at 8:13 AM, Kim Jung Hwa 
> wrote:
> > Hi All,
> >
> > I'm fitting a Poisson regression. And I want to plot 95% Confidence
> Interval
> > of Regression Estimates.
> >
> > After coming back to original scale (using following formula):
> >
> > exponential(estimate +/- 1.96*SE),
> >
> > at best I can get the output in the form of estimates, lower_limit,
> > upper_limit values.
> >
> > As far I know forest() in metafor package needs input in the form of
> > estimates and their variances. In the above case can I still use
> forest()?
> > OR if there exists some other function which takes such input and gives
> > forest plots?
> >
> > Any help would be highly appreciated,
> > Thanks,
> > Kim
> >
> >[[alternative HTML version deleted]]
> >
> > __
> > 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 provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
> CH Chan
> Research Assistant - KWH
> http://www.macgrass.com
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread ivan popivanov


Alright, one more idea - try the zoo merge function. According to the 
documentation, it allows intersection based on the index. Later you can remove 
the columns that you don't need. Something like:

 

C = merge(A, B, all=FALSE) --- the last parameter request intersect instead of 
union

 

now you only need to remove the columns that you don't need from C:).

 

Hope this helps,

Ivan

 
> Date: Sun, 13 Dec 2009 15:30:35 -0800
> From: shef...@googlemail.com
> To: r-help@r-project.org
> Subject: Re: [R] Need help to complete missing value (Date and Time) in Sp500 
> Data
> 
> 
> 
> Hi Ivan,
> thanks for the code. 
> I think the other way would be to compare the both data series and remove
> (shorted) the longest. For that I need a function to compare this both
> Matrices and then cut the rows. 
> I did not find any proper packege in R to compare vectors or matrices( in
> respect to one date/time colomb). 
> The routin must be (I think): Compare the date/time colomb of both matrices
> (or ts object) and then remove the redunant rows.
> 
> I know I asked before for extended the rows but after checking the data I
> saw that the holidays make trouble and the only what I must do is compare
> and remov.
> 
> 
> 
> Thanks.
> 
> 
> ivan popivanov wrote:
> > 
> > 
> > Hi Hamid,
> > 
> > Not sure why would you need missing data, but you can definitely generate
> > it:).
> > 
> > 
> > 
> > A few random thoughts:
> > 
> > First, you can generate all possible timestamps from the beginning to the
> > end of the interval (skipping weekends and skipping the stamps when the
> > markets are closed). Then for each of yours time series, you can check
> > whether it has the missing timestamps.
> > 
> > 
> > 
> > To generate the full set of timestamps, you can use R of course - POSIXlt
> > and POSIXct are the classes to take a look at. They both support
> > arithmetic like adding seconds and IMO can be used together with any time
> > series.
> > 
> > 
> > 
> > I also have a little C# program which generates timestamps in a given
> > interval - let me know and I will send it to you. Then if you are using
> > one of the time series packages in R (xts, zoo, etc) you can check whether
> > a particular timestamp exists like:
> > 
> > 
> > 
> > if(length(gspc["2009-12-05"]) != 0) --- this will be true if the time
> > series gspc has the date.
> > 
> > 
> > 
> > Regards,
> > 
> > Ivan
> > 
> >> Date: Sun, 13 Dec 2009 13:08:25 -0800
> >> From: shef...@googlemail.com
> >> To: r-help@r-project.org
> >> Subject: Re: [R] Need help to complete missing value (Date and Time) in
> >> Sp500 Data
> >> 
> >> 
> >> Hi uwe,
> >> here the example:
> >> 1) Dataset sp500 has values at 01.05.2008:
> >> 
> >> 30.04.2008 21:56;1.385,63;1.385,63;1.385,14;1.385,14;0
> >> 30.04.2008 21:57;1.385,67;1.385,67;1.384,48;1.384,48;0
> >> 30.04.2008 21:58;1.384,74;1.384,91;1.384,27;1.384,91;0
> >> 30.04.2008 21:59;1.385,05;1.385,81;1.385,05;1.385,08;0
> >> 01.05.2008 15:30;1.385,97;1.385,97;1.384,14;1.384,54;0
> >> 01.05.2008 15:31;1.384,61;1.385,30;1.384,61;1.385,30;0
> >> 01.05.2008 15:32;1.385,03;1.385,54;1.385,03;1.385,54;0
> >> 01.05.2008 15:33;1.386,01;1.386,01;1.385,56;1.385,83;0
> >> 01.05.2008 15:34;1.385,61;1.385,61;1.385,00;1.385,00;0
> >> 01.05.2008 15:35;1.384,72;1.385,29;1.384,72;1.385,12;0
> >> 01.05.2008 15:36;1.385,26;1.385,26;1.384,47;1.384,48;0
> >> 01.05.2008 15:37;1.384,11;1.384,11;1.383,89;1.383,89;0
> >> 01.05.2008 15:38;1.383,63;1.383,75;1.383,33;1.383,75;0
> >> 01.05.2008 15:39;1.383,90;1.384,29;1.383,76;1.383,76;0
> >> 01.05.2008 15:40;1.383,66;1.383,66;1.383,07;1.383,08;0
> >> 01.05.2008 15:41;1.383,16;1.383,39;1.383,16;1.383,31;0
> >> 01.05.2008 15:42;1.383,70;1.383,94;1.383,69;1.383,69;0
> >> 01.05.2008 15:43;1.384,11;1.385,12;1.384,11;1.385,12;0
> >> 01.05.2008 15:44;1.385,26;1.385,72;1.385,26;1.385,72;0
> >> 01.05.2008 15:45;1.385,83;1.386,78;1.385,83;1.386,78;0
> >> 01.05.2008 15:46;1.386,89;1.387,09;1.386,89;1.386,96;0
> >> 01.05.2008 15:47;1.386,74;1.386,94;1.386,73;1.386,73;0
> >> 
> >> 2) but in the dataset dax (because the 1.5 is not work day in Germany )
> >> is
> >> missing all the minute data. (there are some of these days the data
> >> missing)
> >> 
> >> 30.04.2008 17:28;6.947,29;6.947,69;6.944,64;6.946,21;547.527
> >> 30.04.2008 17:29;6.945,92;6.948,49;6.945,10;6.945,83;888.986
> >> 02.05.2008 09:00;6.982,06;6.982,06;6.980,25;6.980,88;1.202.110
> >> 02.05.2008 09:01;6.980,08;6.980,75;6.971,93;6.971,93;367.080
> >> 02.05.2008 09:02;6.972,88;7.031,30;6.972,88;7.026,16;2.097.588
> >> 02.05.2008 09:03;7.026,72;7.029,12;7.024,96;7.027,16;373.875
> >> 02.05.2008 09:04;7.027,06;7.029,64;7.024,17;7.026,32;421.565
> >> 02.05.2008 09:05;7.026,32;7.026,67;7.022,40;7.025,08;490.090
> >> 02.05.2008 09:06;7.024,21;7.025,31;7.021,45;7.021,70;500.031
> >> 02.05.2008 09:07;7.021,72;7.022,31;7.015,32;7.015,76;486.933
> >> 02.05.2008 09:08;7.017,90;7.022,94;7.017,90;7.022,23;461.801
> >> 02.05.2008 09:09;7.022,23;7.022,55;7.018,54;7.018,

[R] Confused on using expand.grid(), array(), image() and npudens(np) in my case

2009-12-13 Thread rusers.sh
Hi all,
  I want to use the npudens() function in the np package (multivariate
kernel density estimation), but was confused by the several functions in the
following codes,expand.grid(),array(),image() and npudensbw().
  This confusion will only be generated in >=3 dimensions. I marked the four
places with confusion1-4. I think there should be some kind
of correspondence in those four places,but cannot figure them out.Thanks
very much for chewing on this.
#simulated dataset: d
x1<-c(runif(100,0,1),runif(50,0.67,1));y1<-c(runif(100,0,1),runif(50,0.67,1));d1<-data.frame(x1,y1);colnames(d1)<-c("x","y")
x2<-c(runif(100,0,1),runif(50,0.33,0.67));y2<-c(runif(100,0,1),runif(50,0.33,0.67));d2<-data.frame(x2,y2);colnames(d2)<-c("x","y")
x3<-c(runif(100,0,1),runif(50,0,0.33));y3<-c(runif(100,0,1),runif(50,0,0.33));d3<-data.frame(x3,y3);colnames(d3)<-c("x","y")
d<-rbind(d1,d2,d3)
d$tf<-c(rep(1,150),rep(2,150),rep(3,150))
plot(d1);points(d2,col="red");points(d3,col="green")
attach(d)

#Confusion1:how to specify the formula in the npudensbw() correctly? I find
the sequence of ordered(tf)+x+y is important and here i may have a wrong
specification

bw <- npudensbw(formula=~ordered(tf)+x+y, bwmethod="cv.ml")  #confusion1

year.seq <- sort(unique(d$tf))  #length is 3
x.seq <- seq(0,1,0.02)  #length is 51
y.seq <- seq(0,1,0.02)  #length is 51

#Confusion2:what is the correct sequence for the three variables
(year.seq,x.seq and y.seq) in expand.grid()

data.eval <- expand.grid(tf=year.seq,x=x.seq,y=y.seq)  #confusion2

fhat <- fitted(npudens(bws=bw, newdata=data.eval))

#Confusion3:what is the correct sequence for the three variables in the c()
options of array()

f <- array(fhat, c(51,51,3))  #number of year.seq is 3, and number of x.seq
and y.seq are 51,confusion3

brks <- quantile(f, seq(0,1,0.05));cols <-
heat.colors(length(brks)-1);oldpar <- par(mfrow=c(1,3))

#Confusion4:what is the correct sequence for the three variables(tf,x and y)
in the image()

for (i in 1:3) image(x.seq, y.seq, f[,,i],asp=1, xlab="", ylab="", main=i,
breaks=brks, col=cols)  #confusion4

par(oldpar)

#This was also confused in 4 ,5 and more dimensions.
  Any help or suggestions are greatly appreciated.
-- 
-
Jane Chang
Queen's

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] help with graphing -- Points in my graph are not apparent, always displayed in steps

2009-12-13 Thread philip robinson

Thank you very much, 

 -- Philip



David Winsemius wrote:
> 
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p963227.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Duncan Murdoch

On 13/12/2009 5:22 PM, Carl Witthoft wrote:

Duncan Murdoch wrote:
  "This is by design.  Carriage returns have syntactic meaning in R, so the
editor shouldn't display phantom ones.  In Linux there's no choice
because R doesn't control how text is displayed, but the Windows GUI
gets it right."


I have to disagree here.  Soft-wrapping is the default option in most 
editors, and the OSX R.app gui wraps both input and output.  It's pretty 
easy to tell a bunch of code is (or isn't) all one line unless you don't 
believe in prompts or something :-).


Try this in the OSX GUI (or any other editor that does soft wrapping).

Open a "New Document", and make the window pretty narrow, e.g. about 
10-20 chars wide.  (You can make it wider, but you'll have more typing 
below.)


Type this line into it, with enough ones that it wraps to 3 lines:

x <- 111

It will look something like this in the GUI.

x <-
11
1

Other editors might wrap differently, e.g. vi pays no attention to 
whitespace, and just wraps the characters when it hits the end of the line.


Now put a hard return before the 1 on the third line.  It will look 
almost identical, but (in the GUI editor) you'll see that the third line 
now has a line number 2.  It's a bit hard to see, but I wouldn't complain.


Now copy and paste the whole thing into the console.  If the console is 
also narrow enough, it will look the way I've typed it above, with 
nothing at all to signal it's really two lines, not 1 or 3, until you 
hit enter to execute both lines.


This is fine in languages like C where newlines barely matter, but it 
makes a big difference whether that's one line or two in R.


So I'd say the best practice is to keep your lines short enough that you 
never have your editor wrapping things for you, and to use editors that 
give strong visual signals (e.g. the Windows GUI's $ signs, or the OSX 
GUI editor's line numbering) when you accidentally violate this rule.


Duncan Murdoch

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Error with hgu133a2.db

2009-12-13 Thread Martin Morgan
Hi Christoph --

ask questions about Bioconductor packages on the Bioconductor mailing
list (provide the output of sessionInfo(), as some of the error message
below suggests a seriously out-of-date installation).

http://bioconductor.org/docs/mailList.html

Here the likely problem is that some of your other packages require
updating, as outlined (several topics down) at

http://bioconductor.org/docs/install/

Martin

mkna005 mkna005 wrote:
> Hi,
> I'm trying to get this library working under R2.10.0. I downloaded it
> and installed it from zip file. i get the following output.
> 
>> library(hgu133a2.db)
> Error in library(hgu133a2.db) : there is no package called 'hgu133a2.db'
>> utils:::menuInstallLocal()
> package 'hgu133a2.db' successfully unpacked and MD5 sums checked
>> library(hgu133a2.db)
> Loading required package: AnnotationDbi
> Loading required package: Biobase
> 
> Welcome to Bioconductor
> 
>  Vignettes contain introductory material. To view, type
>  'openVignette()'. To cite Bioconductor, see
>  'citation("Biobase")' and for packages 'citation(pkgname)'.
> 
> Loading required package: DBI
> Error in fun(...) : could not find function "createAnnObjs.HUMANCHIP_DB"
> In addition: Warning message:
> package 'hgu133a2.db' was built under R version 2.7.0 and help will
> not work correctly
> Please re-install it
> Error : .onLoad failed in 'loadNamespace' for 'hgu133a2.db'
> Error: package/namespace load failed for 'hgu133a2.db'
> 
> Whats the problem and how can I fix it?
> 
> Thanks
> 
> Christoph
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] help: forest plots

2009-12-13 Thread C.H.
This one does required the metafor package.

http://tables2graphs.com/doku.php?id=04_regression_coefficients



On Mon, Dec 14, 2009 at 8:13 AM, Kim Jung Hwa  wrote:
> Hi All,
>
> I'm fitting a Poisson regression. And I want to plot 95% Confidence Interval
> of Regression Estimates.
>
> After coming back to original scale (using following formula):
>
> exponential(estimate +/- 1.96*SE),
>
> at best I can get the output in the form of estimates, lower_limit,
> upper_limit values.
>
> As far I know forest() in metafor package needs input in the form of
> estimates and their variances. In the above case can I still use forest()?
> OR if there exists some other function which takes such input and gives
> forest plots?
>
> Any help would be highly appreciated,
> Thanks,
> Kim
>
>        [[alternative HTML version deleted]]
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.com

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] plot merging/compression with R

2009-12-13 Thread Felix Andrews
Hi,

If your PDFs are huge, I suggest you use a different type of plot that
does not explicitly plot millions of data points, but rather produces
some sort of summary. Examples are box plots, or hexagonal binning
(hexbin package).

-Felix


2009/12/14 Walther, Alexander :
> Dear list,
>
> i just encountered a problem concerning the export of multiple plots. is
> it possible to merge several PNGs into one PDF document? i know that
> this could be easily done by pdf(), but the outcome of this is /way/ too
> huge (> 15 MB, four plots) and to my knowledge there's no way to
> compress PDFs directly in R. Hence the PNGs that are saved one at a time
> and afterwards merged by Adobe Acrobat.  Since i would like to
> automatize this process, can this be done by R? Alternatively, is there
> a way to compress a PDF of multiple pages right away?
>
> cheers
>
> Alex
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andr...@anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/

__
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 provide commented, minimal, self-contained, reproducible code.


[R] Fwd: Error with hgu133a2.db

2009-12-13 Thread mkna005 mkna005
Hi,
I'm trying to get this library working under R2.10.0. I downloaded it
and installed it from zip file. i get the following output.

> library(hgu133a2.db)
Error in library(hgu133a2.db) : there is no package called 'hgu133a2.db'
> utils:::menuInstallLocal()
package 'hgu133a2.db' successfully unpacked and MD5 sums checked
> library(hgu133a2.db)
Loading required package: AnnotationDbi
Loading required package: Biobase

Welcome to Bioconductor

 Vignettes contain introductory material. To view, type
 'openVignette()'. To cite Bioconductor, see
 'citation("Biobase")' and for packages 'citation(pkgname)'.

Loading required package: DBI
Error in fun(...) : could not find function "createAnnObjs.HUMANCHIP_DB"
In addition: Warning message:
package 'hgu133a2.db' was built under R version 2.7.0 and help will
not work correctly
Please re-install it
Error : .onLoad failed in 'loadNamespace' for 'hgu133a2.db'
Error: package/namespace load failed for 'hgu133a2.db'

Whats the problem and how can I fix it?

Thanks

Christoph

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single backward slash with a doublebackward slash?

2009-12-13 Thread William Dunlap


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Zhang
> Sent: Sunday, December 13, 2009 4:01 PM
> To: David Winsemius
> Cc: r-help@r-project.org
> Subject: Re: [R] how to replace a single backward slash with 
> a doublebackward slash?
> 
> David and William,
> Thanks for your reply which make me know the concept of 
> escape symbols.
> 
> As David guessed, I was trying to write a function which will
> accept a path cut from windows explorer.
> and as you know windows explorer uses "\".
> 
> e.g., c:\temp\function.r
> 
> I originally would like that the function is able to change 
> the example path
> into "c:/temp/function.r"
> David's final comment seems to suggest this is impossible...
> If so, it is a limitation because I have to manually change 
> "\" into "/"
> each time.

You can use scan to avoid manually changing the backslashes
to slashes.  E.g.,
   > z <- scan(what="",sep="\n")
   1: \\somecomputer\e\Documents and Settings\John Q Public\My
Documents\The Results.pdf
   2: 
   Read 1 item
   > z
   [1] "somecomputer\\e\\Documents and Settings\\John Q Public\\My
Documents\\The Results.pdf"

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> 
> But it is good to know this limitation.
> 
> Correct me, if I misunderstand and there is no such a limitation.
> 
> Thanks again.
> 
> -Sean
> 
> 
> 
> 
> 
> 
> 
> 
> On Sun, Dec 13, 2009 at 5:26 PM, David Winsemius 
> wrote:
> 
> >
> > On Dec 13, 2009, at 5:11 PM, Sean Zhang wrote:
> >
> >  Dear R-helpers:
> >>
> >> Hours ago, I asked how to replace a single forward slash 
> with a double
> >> backward slash and recieved great help. Thanks again for 
> all the repliers.
> >>
> >> In the meantime, I wonder how to replace a single backward 
> slash with a
> >> double backward slash?
> >>
> >> e.g., I want change "c:\test" into "c:\\test"
> >>
> >> I tried the following but does not work.
> >> gsub("\\\","",)
> >>
> >> Can someone help?
> >>
> >
> > Your problem may be that you think there actually is a "\" 
> in "c:\test".
> > There isn't:
> >
> > > grep("", "c:\test")  # which would have found a true "\"
> > integer(0)
> >
> > It's an escaped "t", which is the tab character = "\t":
> >
> > > grep("\\\t", "c:\test")
> > [1] 1
> > > cat("rr\tqq")
> > rr  qq
> >
> > If your goal is to make file paths in Windows correctly, 
> then you have two
> > choices:
> >
> > a) use doubled "\\"'s in the literal strings you type, or ...
> > b) use "/"'s
> >
> > So maybe you should explain what you are doing? We don't 
> request that
> > background out of nosiness, but rather so we can give better answers
> >
> > --
> >
> > David Winsemius, MD
> > Heritage Laboratories
> > West Hartford, CT
> >
> >
> 
>   [[alternative HTML version deleted]]
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.
> 

__
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 provide commented, minimal, self-contained, reproducible code.


[R] help: forest plots

2009-12-13 Thread Kim Jung Hwa
Hi All,

I'm fitting a Poisson regression. And I want to plot 95% Confidence Interval
of Regression Estimates.

After coming back to original scale (using following formula):

exponential(estimate +/- 1.96*SE),

at best I can get the output in the form of estimates, lower_limit,
upper_limit values.

As far I know forest() in metafor package needs input in the form of
estimates and their variances. In the above case can I still use forest()?
OR if there exists some other function which takes such input and gives
forest plots?

Any help would be highly appreciated,
Thanks,
Kim

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single backward slash with a double backward slash?

2009-12-13 Thread Sean Zhang
David and William,
Thanks for your reply which make me know the concept of escape symbols.

As David guessed, I was trying to write a function which will
accept a path cut from windows explorer.
and as you know windows explorer uses "\".

e.g., c:\temp\function.r

I originally would like that the function is able to change the example path
into "c:/temp/function.r"
David's final comment seems to suggest this is impossible...
If so, it is a limitation because I have to manually change "\" into "/"
each time.
But it is good to know this limitation.

Correct me, if I misunderstand and there is no such a limitation.

Thanks again.

-Sean








On Sun, Dec 13, 2009 at 5:26 PM, David Winsemius wrote:

>
> On Dec 13, 2009, at 5:11 PM, Sean Zhang wrote:
>
>  Dear R-helpers:
>>
>> Hours ago, I asked how to replace a single forward slash with a double
>> backward slash and recieved great help. Thanks again for all the repliers.
>>
>> In the meantime, I wonder how to replace a single backward slash with a
>> double backward slash?
>>
>> e.g., I want change "c:\test" into "c:\\test"
>>
>> I tried the following but does not work.
>> gsub("\\\","",)
>>
>> Can someone help?
>>
>
> Your problem may be that you think there actually is a "\" in "c:\test".
> There isn't:
>
> > grep("", "c:\test")  # which would have found a true "\"
> integer(0)
>
> It's an escaped "t", which is the tab character = "\t":
>
> > grep("\\\t", "c:\test")
> [1] 1
> > cat("rr\tqq")
> rr  qq
>
> If your goal is to make file paths in Windows correctly, then you have two
> choices:
>
> a) use doubled "\\"'s in the literal strings you type, or ...
> b) use "/"'s
>
> So maybe you should explain what you are doing? We don't request that
> background out of nosiness, but rather so we can give better answers
>
> --
>
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] CRAN (and crantastic) updates this week

2009-12-13 Thread Crantastic
CRAN (and crantastic) updates this week

New packages


* Bergm (1.0)
  Alberto Caimo
  http://crantastic.org/packages/Bergm

  Functions implementing Bayesian estimation for exponential random
  graph models via exchange algorithm


Updated packages


lmtest (0.9-26), logcondens (1.3.5), MTSKNN (0.0-4), pmml (1.2.21),
r2lUniv (0.9.4), rattle (2.5.11), rgdal (0.6-23), robustX (1.1-2),
sandwich (2.2-4), sp (0.9-51)



This email provided as a service for the R community by
http://crantastic.org.

Like it?  Hate it?  Please let us know: crana...@gmail.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread Hamid


Hi Ivan,
thanks for the code. 
I think the other way would be to compare the both data series and remove
(shorted) the longest. For that I need a function to compare this both
Matrices and then cut the rows. 
I did not find any proper packege in R to compare vectors or matrices( in
respect to one date/time colomb). 
The routin must be (I think): Compare the date/time colomb of both matrices
(or ts object) and then remove the redunant rows.

I know I asked before for extended the rows but after checking the data I
saw that the holidays make trouble and the only what I must do is compare
and remov.



Thanks.


ivan popivanov wrote:
> 
> 
> Hi Hamid,
>  
> Not sure why would you need missing data, but you can definitely generate
> it:).
> 
>  
> 
> A few random thoughts:
>  
> First, you can generate all possible timestamps from the beginning to the
> end of the interval (skipping weekends and skipping the stamps when the
> markets are closed). Then for each of yours time series, you can check
> whether it has the missing timestamps.
> 
>  
> 
> To generate the full set of timestamps, you can use R of course - POSIXlt
> and POSIXct are the classes to take a look at. They both support
> arithmetic like adding seconds and IMO can be used together with any time
> series.
> 
>  
> 
> I also have a little C# program which generates timestamps in a given
> interval - let me know and I will send it to you. Then if you are using
> one of the time series packages in R (xts, zoo, etc) you can check whether
> a particular timestamp exists like:
> 
>  
> 
> if(length(gspc["2009-12-05"]) != 0) --- this will be true if the time
> series gspc has the date.
> 
>  
> 
> Regards,
> 
> Ivan
>  
>> Date: Sun, 13 Dec 2009 13:08:25 -0800
>> From: shef...@googlemail.com
>> To: r-help@r-project.org
>> Subject: Re: [R] Need help to complete missing value (Date and Time) in
>> Sp500 Data
>> 
>> 
>> Hi uwe,
>> here the example:
>> 1) Dataset sp500 has values at 01.05.2008:
>> 
>> 30.04.2008 21:56;1.385,63;1.385,63;1.385,14;1.385,14;0
>> 30.04.2008 21:57;1.385,67;1.385,67;1.384,48;1.384,48;0
>> 30.04.2008 21:58;1.384,74;1.384,91;1.384,27;1.384,91;0
>> 30.04.2008 21:59;1.385,05;1.385,81;1.385,05;1.385,08;0
>> 01.05.2008 15:30;1.385,97;1.385,97;1.384,14;1.384,54;0
>> 01.05.2008 15:31;1.384,61;1.385,30;1.384,61;1.385,30;0
>> 01.05.2008 15:32;1.385,03;1.385,54;1.385,03;1.385,54;0
>> 01.05.2008 15:33;1.386,01;1.386,01;1.385,56;1.385,83;0
>> 01.05.2008 15:34;1.385,61;1.385,61;1.385,00;1.385,00;0
>> 01.05.2008 15:35;1.384,72;1.385,29;1.384,72;1.385,12;0
>> 01.05.2008 15:36;1.385,26;1.385,26;1.384,47;1.384,48;0
>> 01.05.2008 15:37;1.384,11;1.384,11;1.383,89;1.383,89;0
>> 01.05.2008 15:38;1.383,63;1.383,75;1.383,33;1.383,75;0
>> 01.05.2008 15:39;1.383,90;1.384,29;1.383,76;1.383,76;0
>> 01.05.2008 15:40;1.383,66;1.383,66;1.383,07;1.383,08;0
>> 01.05.2008 15:41;1.383,16;1.383,39;1.383,16;1.383,31;0
>> 01.05.2008 15:42;1.383,70;1.383,94;1.383,69;1.383,69;0
>> 01.05.2008 15:43;1.384,11;1.385,12;1.384,11;1.385,12;0
>> 01.05.2008 15:44;1.385,26;1.385,72;1.385,26;1.385,72;0
>> 01.05.2008 15:45;1.385,83;1.386,78;1.385,83;1.386,78;0
>> 01.05.2008 15:46;1.386,89;1.387,09;1.386,89;1.386,96;0
>> 01.05.2008 15:47;1.386,74;1.386,94;1.386,73;1.386,73;0
>> 
>> 2) but in the dataset dax (because the 1.5 is not work day in Germany )
>> is
>> missing all the minute data. (there are some of these days the data
>> missing)
>> 
>> 30.04.2008 17:28;6.947,29;6.947,69;6.944,64;6.946,21;547.527
>> 30.04.2008 17:29;6.945,92;6.948,49;6.945,10;6.945,83;888.986
>> 02.05.2008 09:00;6.982,06;6.982,06;6.980,25;6.980,88;1.202.110
>> 02.05.2008 09:01;6.980,08;6.980,75;6.971,93;6.971,93;367.080
>> 02.05.2008 09:02;6.972,88;7.031,30;6.972,88;7.026,16;2.097.588
>> 02.05.2008 09:03;7.026,72;7.029,12;7.024,96;7.027,16;373.875
>> 02.05.2008 09:04;7.027,06;7.029,64;7.024,17;7.026,32;421.565
>> 02.05.2008 09:05;7.026,32;7.026,67;7.022,40;7.025,08;490.090
>> 02.05.2008 09:06;7.024,21;7.025,31;7.021,45;7.021,70;500.031
>> 02.05.2008 09:07;7.021,72;7.022,31;7.015,32;7.015,76;486.933
>> 02.05.2008 09:08;7.017,90;7.022,94;7.017,90;7.022,23;461.801
>> 02.05.2008 09:09;7.022,23;7.022,55;7.018,54;7.018,99;593.412
>> 
>> 
>> 
>> Uwe Ligges-3 wrote:
>> > 
>> > 
>> > 
>> > Hamid wrote:
>> >> Hi Uwe,
>> >> yes you are right, but I just wanted to show the date format I use.
>> The
>> >> whole data is very huge (about 2 rows).
>> >> 
>> >> Nevertheless I like first to find the missing dates/Times. Then put 0.
>> I
>> >> know they are some different approach to impute missing data, but for
>> me
>> >> is
>> >> important to find a way to identify the missing gaps and then put the
>> >> values
>> >> (I think then it is not complicated to put other values instead of
>> zero).
>> >> Do you have any idea to find it out and put the values in ?
>> > 
>> > 
>> > 
>> > Well, the problem is that I cannot imagine how your "gaps" look like, 
>> > hence I asked for the example. Please provide an example (jus

Re: [R] help with graphing -- Points in my graph are not apparent, always displayed in steps

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 6:06 PM, philip robinson wrote:



Sorry to have not provided enough information in my prior post. Here  
is a
summary of the calculation set that I am doing. The histograms have  
changed
since my last post, but I am not so concerned about them. The  
scatter plots
do not show all of the points, they seem to round off to the most  
common.


You seem to think that qqplots should be giving you scatterplots. That  
is not the case. The qqplot function gives you quantile-quantile plots  
and you have given it arguments that implied that temp$R2SC was a  
theoretical distribution to which you wanted to compare the  
distribution of temp$words


If you want scatterplots, then this would be the way forward:

plot(x=temp$words, y=temp$R2SC, ylab="With Rules applied SC",  
xlab="Number of
 Words",col="blue",main="Subordinating Conjunctions\n(Number of  
Words)")


Or perhaps with some jitter and smaller points to separate identical  
values:


plot(x=temp$words,y=jitter(temp$R2SC, factor=2.3), cex=0.1, ylab="With  
Rules applied SC",xlab="Number of   
Words",col="blue",main="Subordinating Conjunctions\n(Number of Words)")


And given the failure of even that plot to separate the points in that  
2.9 MB file, then perhaps look at density plot strategies.


--
David.


I
have tried doctoring the  http://n4.nabble.com/file/n963172/ESTATS  
ESTATS

file to get a different result, but received no change.




removeOutliers<-function(dataset){
return(
dataset[
			max(sort(dataset$words)[1:(length(dataset$words)/100)])$words &


dataset$words<(min(sort(dataset$words)[(99*length(dataset$words)/ 
100):length(dataset$words)])+1),,

]
)
};

edat.src<-read.csv("ESTATS",head=TRUE,sep="\t");


edat<-removeOutliers(edat.src);

# Only address the subset where there exists appropriate  
conjunctions within

the sentence
temp<-edat[edat$R2SC>0,,]

png("egraph_rules_list_2.png",width=800,height=700,res=72);
par(mfrow=c(2,2));

#	graph that i am having trouble with, it does not seem to reflect  
the data

#   The scatter plots are not recognizing all of the data
qqplot(x=temp$words,y=temp$R2SC,ylab="With Rules applied  
SC",xlab="Number of
Words",col="blue",main="Subordinating Conjunctions\n(Number of  
Words)");

hist(temp$words,col=heat.colors(max(temp$words)),main="Subortinating
Conjunctions \n-- Number of Words");
temp<-edat[edat$R2CC>0,,]
qqplot(x=temp$words,y=temp$R2CC,ylab="With  Rules applied  
CC",xlab="Number
of Words",col="purple",main="Coordinating Conjunctions\n(Number of  
Words)");

hist(temp$words,col=heat.colors(max(temp$words)),main="Coordinating
Conjunctions \n-- Number of Words");
dev.off();




David Winsemius wrote:



You provide no data. This is a guess, therefore. You have used a hist
call that has a ratio as the argument and were expecting it to be
interpreted as a formula.




--
View this message in context: 
http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p963172.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] forest() in metafor package.

2009-12-13 Thread Kim Jung Hwa
Please ignore this email. Got this link:

http://cran.r-project.org/web/packages/metafor/metafor.pdf

Thanks,
Kim

On Sun, Dec 13, 2009 at 6:14 PM, Kim Jung Hwa wrote:

> Hi All,
>
> I'm using forest() from metafor package to plot forest plots. Here is the
> code
>
> e<-1:6
> v<-seq(2,3,.20)
> forest(e,v)
>
> I want to edit default labels "Study 1", "Study 2" and so on... how can I
> do it?
>
> I tried ?forest(), but couldn't find any details. Any suggestions? Thanks,
> Kim
>
>
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] forest() in metafor package.

2009-12-13 Thread Kim Jung Hwa
Hi All,

I'm using forest() from metafor package to plot forest plots. Here is the
code

e<-1:6
v<-seq(2,3,.20)
forest(e,v)

I want to edit default labels "Study 1", "Study 2" and so on... how can I do
it?

I tried ?forest(), but couldn't find any details. Any suggestions? Thanks,
Kim

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread ivan popivanov

Hi Hamid,
 
Not sure why would you need missing data, but you can definitely generate it:).

 

A few random thoughts:
 
First, you can generate all possible timestamps from the beginning to the end 
of the interval (skipping weekends and skipping the stamps when the markets are 
closed). Then for each of yours time series, you can check whether it has the 
missing timestamps.

 

To generate the full set of timestamps, you can use R of course - POSIXlt and 
POSIXct are the classes to take a look at. They both support arithmetic like 
adding seconds and IMO can be used together with any time series.

 

I also have a little C# program which generates timestamps in a given interval 
- let me know and I will send it to you. Then if you are using one of the time 
series packages in R (xts, zoo, etc) you can check whether a particular 
timestamp exists like:

 

if(length(gspc["2009-12-05"]) != 0) --- this will be true if the time series 
gspc has the date.

 

Regards,

Ivan
 
> Date: Sun, 13 Dec 2009 13:08:25 -0800
> From: shef...@googlemail.com
> To: r-help@r-project.org
> Subject: Re: [R] Need help to complete missing value (Date and Time) in Sp500 
> Data
> 
> 
> Hi uwe,
> here the example:
> 1) Dataset sp500 has values at 01.05.2008:
> 
> 30.04.2008 21:56;1.385,63;1.385,63;1.385,14;1.385,14;0
> 30.04.2008 21:57;1.385,67;1.385,67;1.384,48;1.384,48;0
> 30.04.2008 21:58;1.384,74;1.384,91;1.384,27;1.384,91;0
> 30.04.2008 21:59;1.385,05;1.385,81;1.385,05;1.385,08;0
> 01.05.2008 15:30;1.385,97;1.385,97;1.384,14;1.384,54;0
> 01.05.2008 15:31;1.384,61;1.385,30;1.384,61;1.385,30;0
> 01.05.2008 15:32;1.385,03;1.385,54;1.385,03;1.385,54;0
> 01.05.2008 15:33;1.386,01;1.386,01;1.385,56;1.385,83;0
> 01.05.2008 15:34;1.385,61;1.385,61;1.385,00;1.385,00;0
> 01.05.2008 15:35;1.384,72;1.385,29;1.384,72;1.385,12;0
> 01.05.2008 15:36;1.385,26;1.385,26;1.384,47;1.384,48;0
> 01.05.2008 15:37;1.384,11;1.384,11;1.383,89;1.383,89;0
> 01.05.2008 15:38;1.383,63;1.383,75;1.383,33;1.383,75;0
> 01.05.2008 15:39;1.383,90;1.384,29;1.383,76;1.383,76;0
> 01.05.2008 15:40;1.383,66;1.383,66;1.383,07;1.383,08;0
> 01.05.2008 15:41;1.383,16;1.383,39;1.383,16;1.383,31;0
> 01.05.2008 15:42;1.383,70;1.383,94;1.383,69;1.383,69;0
> 01.05.2008 15:43;1.384,11;1.385,12;1.384,11;1.385,12;0
> 01.05.2008 15:44;1.385,26;1.385,72;1.385,26;1.385,72;0
> 01.05.2008 15:45;1.385,83;1.386,78;1.385,83;1.386,78;0
> 01.05.2008 15:46;1.386,89;1.387,09;1.386,89;1.386,96;0
> 01.05.2008 15:47;1.386,74;1.386,94;1.386,73;1.386,73;0
> 
> 2) but in the dataset dax (because the 1.5 is not work day in Germany ) is
> missing all the minute data. (there are some of these days the data missing)
> 
> 30.04.2008 17:28;6.947,29;6.947,69;6.944,64;6.946,21;547.527
> 30.04.2008 17:29;6.945,92;6.948,49;6.945,10;6.945,83;888.986
> 02.05.2008 09:00;6.982,06;6.982,06;6.980,25;6.980,88;1.202.110
> 02.05.2008 09:01;6.980,08;6.980,75;6.971,93;6.971,93;367.080
> 02.05.2008 09:02;6.972,88;7.031,30;6.972,88;7.026,16;2.097.588
> 02.05.2008 09:03;7.026,72;7.029,12;7.024,96;7.027,16;373.875
> 02.05.2008 09:04;7.027,06;7.029,64;7.024,17;7.026,32;421.565
> 02.05.2008 09:05;7.026,32;7.026,67;7.022,40;7.025,08;490.090
> 02.05.2008 09:06;7.024,21;7.025,31;7.021,45;7.021,70;500.031
> 02.05.2008 09:07;7.021,72;7.022,31;7.015,32;7.015,76;486.933
> 02.05.2008 09:08;7.017,90;7.022,94;7.017,90;7.022,23;461.801
> 02.05.2008 09:09;7.022,23;7.022,55;7.018,54;7.018,99;593.412
> 
> 
> 
> Uwe Ligges-3 wrote:
> > 
> > 
> > 
> > Hamid wrote:
> >> Hi Uwe,
> >> yes you are right, but I just wanted to show the date format I use. The
> >> whole data is very huge (about 2 rows).
> >> 
> >> Nevertheless I like first to find the missing dates/Times. Then put 0. I
> >> know they are some different approach to impute missing data, but for me
> >> is
> >> important to find a way to identify the missing gaps and then put the
> >> values
> >> (I think then it is not complicated to put other values instead of zero).
> >> Do you have any idea to find it out and put the values in ?
> > 
> > 
> > 
> > Well, the problem is that I cannot imagine how your "gaps" look like, 
> > hence I asked for the example. Please provide an example (just a few 
> > rows) of the data how it looks like and then how you want it to be 
> > afterwards.
> > 
> > That would be very helpful to allow readers of the list to respond.
> > 
> > Uwe Ligges
> > 
> > 
> > 
> >> Thanks in advance
> >> Hamid
> >> 
> >> Uwe Ligges-3 wrote:
> >>>
> >>>
> >>> Hamid wrote:
>  Dear all,
>  here my problem my be somone can help to solve this.
> 
>  I have tow timeseries from different stock market with different length
>  (diff ca. 4000 )
>  Now I would to add the missing times of the one of this series with
>  proper
>  time (they are minute data) and set the value to 0 since I need to have
>  the
>  same length for my calculation. 
> 
>  I tried to use the seq in R and merge but without success because of
>  form

Re: [R] help with graphing -- Points in my graph are not apparent, always displayed in steps

2009-12-13 Thread philip robinson

Sorry to have not provided enough information in my prior post. Here is a
summary of the calculation set that I am doing. The histograms have changed
since my last post, but I am not so concerned about them. The scatter plots
do not show all of the points, they seem to round off to the most common. I
have tried doctoring the  http://n4.nabble.com/file/n963172/ESTATS ESTATS 
file to get a different result, but received no change.




removeOutliers<-function(dataset){
return(
dataset[

max(sort(dataset$words)[1:(length(dataset$words)/100)])0,,]

png("egraph_rules_list_2.png",width=800,height=700,res=72); 
par(mfrow=c(2,2));

#   graph that i am having trouble with, it does not seem to reflect the 
data
#   The scatter plots are not recognizing all of the data
qqplot(x=temp$words,y=temp$R2SC,ylab="With Rules applied SC",xlab="Number of
Words",col="blue",main="Subordinating Conjunctions\n(Number of Words)");
hist(temp$words,col=heat.colors(max(temp$words)),main="Subortinating
Conjunctions \n-- Number of Words");
temp<-edat[edat$R2CC>0,,]
qqplot(x=temp$words,y=temp$R2CC,ylab="With  Rules applied CC",xlab="Number
of Words",col="purple",main="Coordinating Conjunctions\n(Number of Words)");
hist(temp$words,col=heat.colors(max(temp$words)),main="Coordinating
Conjunctions \n-- Number of Words");
dev.off();




David Winsemius wrote:
> 
> 
> You provide no data. This is a guess, therefore. You have used a hist  
> call that has a ratio as the argument and were expecting it to be  
> interpreted as a formula.
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p963172.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Export R output to Word/RTF?

2009-12-13 Thread Wenjie Lee
Oh okay :), thanks a lot!

On Sun, Dec 13, 2009 at 5:53 PM, Remko Duursma wrote:

> http://en.wikipedia.org/wiki/Software_release_life_cycle#Beta
>
>
>
> r
>
>
> -
> Remko Duursma
> Post-Doctoral Fellow
>
> Centre for Plants and the Environment
> University of Western Sydney
> Hawkesbury Campus
> Richmond NSW 2753
>
> Dept of Biological Science
> Macquarie University
> North Ryde NSW 2109
> Australia
>
> Mobile: +61 (0)422 096908
> www.remkoduursma.com
>
>
>
> On Mon, Dec 14, 2009 at 9:50 AM, Wenjie Lee 
> wrote:
> > Thanks, can anyone explain a little more on what "beta" version means?
> > Thanks!
> >
> >
> > On Sat, Dec 12, 2009 at 10:59 AM, Frank Bloos
> > wrote:
> >
> >>  I am using SWord from statconn: http://rcom.univie.ac.at/download.html
> >> It allows you to put r-commands into Word (similar to odfWeave). Output
> is
> >> directed to Word including figures and tables. It is still a
> beta-version
> >> but works fine.
> >>
> >> Frank Bloos
> >>
> >> >>> Wenjie Lee  12.12.2009 00:28 >>>
> >>
> >> Hi R Experts,
> >>
> >> I'm aware of pdf(), jpeg(),... functions. But,
> >>
> >> 1. Is it also possible to export graphs directly to word or RTF? I use
> to
> >> copy and paste graphs but resolutions are not so great.
> >>
> >> 2. Also, is it possible to export your out to word file? I use sink()
> >> function to export it text files.
> >>
> >> Any suggestions, thanks,
> >>
> >> Wenjie Lee
> >>
> >> [[alternative HTML version deleted]]
> >>
> >>
> >>
> >> 
> >>
> >> Universitätsklinikum Jena
> >> Körperschaft des öffentlichen Rechts und Teilkörperschaft der
> >> Friedrich-Schiller-Universität Jena
> >> Bachstraße 18, 07743 Jena
> >> Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg;
> Medizinischer
> >> Vorstand: Prof. Dr. Klaus Höffken;
> >> Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufmännischer
> >> Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse
> >> Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221;
> Gerichtsstand
> >> Jena
> >> Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777
> >>
> >
>  >[[alternative HTML version deleted]]
> >
> >
> > __
> > 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 provide commented, minimal, self-contained, reproducible code.
> >
> >
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Export R output to Word/RTF?

2009-12-13 Thread Remko Duursma
http://en.wikipedia.org/wiki/Software_release_life_cycle#Beta



r


-
Remko Duursma
Post-Doctoral Fellow

Centre for Plants and the Environment
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753

Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia

Mobile: +61 (0)422 096908
www.remkoduursma.com



On Mon, Dec 14, 2009 at 9:50 AM, Wenjie Lee  wrote:
> Thanks, can anyone explain a little more on what "beta" version means?
> Thanks!
>
>
> On Sat, Dec 12, 2009 at 10:59 AM, Frank Bloos
> wrote:
>
>>  I am using SWord from statconn: http://rcom.univie.ac.at/download.html
>> It allows you to put r-commands into Word (similar to odfWeave). Output is
>> directed to Word including figures and tables. It is still a beta-version
>> but works fine.
>>
>> Frank Bloos
>>
>> >>> Wenjie Lee  12.12.2009 00:28 >>>
>>
>> Hi R Experts,
>>
>> I'm aware of pdf(), jpeg(),... functions. But,
>>
>> 1. Is it also possible to export graphs directly to word or RTF? I use to
>> copy and paste graphs but resolutions are not so great.
>>
>> 2. Also, is it possible to export your out to word file? I use sink()
>> function to export it text files.
>>
>> Any suggestions, thanks,
>>
>> Wenjie Lee
>>
>> [[alternative HTML version deleted]]
>>
>>
>>
>> 
>>
>> Universitätsklinikum Jena
>> Körperschaft des öffentlichen Rechts und Teilkörperschaft der
>> Friedrich-Schiller-Universität Jena
>> Bachstraße 18, 07743 Jena
>> Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg; Medizinischer
>> Vorstand: Prof. Dr. Klaus Höffken;
>> Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufmännischer
>> Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse
>> Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221; Gerichtsstand
>> Jena
>> Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777
>>
>
>        [[alternative HTML version deleted]]
>
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>
>

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Export R output to Word/RTF?

2009-12-13 Thread Wenjie Lee
Thanks, can anyone explain a little more on what "beta" version means?
Thanks!


On Sat, Dec 12, 2009 at 10:59 AM, Frank Bloos
wrote:

>  I am using SWord from statconn: http://rcom.univie.ac.at/download.html
> It allows you to put r-commands into Word (similar to odfWeave). Output is
> directed to Word including figures and tables. It is still a beta-version
> but works fine.
>
> Frank Bloos
>
> >>> Wenjie Lee  12.12.2009 00:28 >>>
>
> Hi R Experts,
>
> I'm aware of pdf(), jpeg(),... functions. But,
>
> 1. Is it also possible to export graphs directly to word or RTF? I use to
> copy and paste graphs but resolutions are not so great.
>
> 2. Also, is it possible to export your out to word file? I use sink()
> function to export it text files.
>
> Any suggestions, thanks,
>
> Wenjie Lee
>
> [[alternative HTML version deleted]]
>
>
>
> 
>
> Universitätsklinikum Jena
> Körperschaft des öffentlichen Rechts und Teilkörperschaft der
> Friedrich-Schiller-Universität Jena
> Bachstraße 18, 07743 Jena
> Verwaltungsratsvorsitzender: Prof. Dr. Walter Bauer-Wabnegg; Medizinischer
> Vorstand: Prof. Dr. Klaus Höffken;
> Wissenschaftlicher Vorstand: Prof. Dr. Klaus Benndorf; Kaufmännischer
> Vorstand und Sprecher des Klinikumsvorstandes Rudolf Kruse
> Bankverbindung: Sparkasse Jena; BLZ: 830 530 30; Kto.: 221; Gerichtsstand
> Jena
> Steuernummer: 161/144/02978; USt.-IdNr. : DE 150545777
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single backward slash with a double backwardslash?

2009-12-13 Thread William Dunlap
> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Zhang
> Sent: Sunday, December 13, 2009 2:11 PM
> To: r-help@r-project.org
> Subject: [R] how to replace a single backward slash with a 
> double backwardslash?
> 
> Dear R-helpers:
> 
> Hours ago, I asked how to replace a single forward slash with a double
> backward slash and recieved great help. Thanks again for all 
> the repliers.
> 
> In the meantime, I wonder how to replace a single backward 
> slash with a
> double backward slash?
> 
> e.g., I want change "c:\test" into "c:\\test"
> 
> I tried the following but does not work.
> gsub("\\\","","c:\test")

The input string "c:\test" contains no backslash
character, nor a "t" character.  It contains
   cee
   colon
   tab ("\t")
   ee
   ess
   tee
If you output the string using cat() you will see
the tab action and the missing "t".

"\t" means tab, "\n" newline, "\r" carriage return,
"\52" octal 52 (asterisk in ASCII encoding), "\x2a"
hexadecimal 2a (also asterisk), etc.  ?Syntax may
give all the details.

If you want to change tabs to the 2-character sequences
backslash t, then do
  > gsub("\t", "t", "c:\test")
  [1] "c:\\test"
  > cat(.Last.value, "\n")
  c:\test

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> 
> Can someone help?
> 
> Thanks a lot in advance.
> 
> -Sean
> 
>   [[alternative HTML version deleted]]
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.
> 

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single backward slash with a double backward slash?

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 5:11 PM, Sean Zhang wrote:


Dear R-helpers:

Hours ago, I asked how to replace a single forward slash with a double
backward slash and recieved great help. Thanks again for all the  
repliers.


In the meantime, I wonder how to replace a single backward slash  
with a

double backward slash?

e.g., I want change "c:\test" into "c:\\test"

I tried the following but does not work.
gsub("\\\","",)

Can someone help?


Your problem may be that you think there actually is a "\" in "c: 
\test". There isn't:


> grep("", "c:\test")  # which would have found a true "\"
integer(0)

It's an escaped "t", which is the tab character = "\t":

> grep("\\\t", "c:\test")
[1] 1
> cat("rr\tqq")
rr  qq

If your goal is to make file paths in Windows correctly, then you have  
two choices:


a) use doubled "\\"'s in the literal strings you type, or ...
b) use "/"'s

So maybe you should explain what you are doing? We don't request that  
background out of nosiness, but rather so we can give better answers


--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Carl Witthoft

Duncan Murdoch wrote:
 "This is by design.  Carriage returns have syntactic meaning in R, so the
editor shouldn't display phantom ones.  In Linux there's no choice
because R doesn't control how text is displayed, but the Windows GUI
gets it right."


I have to disagree here.  Soft-wrapping is the default option in most 
editors, and the OSX R.app gui wraps both input and output.  It's pretty 
easy to tell a bunch of code is (or isn't) all one line unless you don't 
believe in prompts or something :-).


Carl

__
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 provide commented, minimal, self-contained, reproducible code.


[R] plot merging/compression with R

2009-12-13 Thread Walther, Alexander
Dear list,

i just encountered a problem concerning the export of multiple plots. is
it possible to merge several PNGs into one PDF document? i know that
this could be easily done by pdf(), but the outcome of this is /way/ too
huge (> 15 MB, four plots) and to my knowledge there's no way to
compress PDFs directly in R. Hence the PNGs that are saved one at a time
and afterwards merged by Adobe Acrobat.  Since i would like to
automatize this process, can this be done by R? Alternatively, is there
a way to compress a PDF of multiple pages right away?

cheers

Alex

__
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 provide commented, minimal, self-contained, reproducible code.


[R] how to replace a single backward slash with a double backward slash?

2009-12-13 Thread Sean Zhang
Dear R-helpers:

Hours ago, I asked how to replace a single forward slash with a double
backward slash and recieved great help. Thanks again for all the repliers.

In the meantime, I wonder how to replace a single backward slash with a
double backward slash?

e.g., I want change "c:\test" into "c:\\test"

I tried the following but does not work.
gsub("\\\","","c:\test")

Can someone help?

Thanks a lot in advance.

-Sean

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] Drawing an axis with a subset of the data

2009-12-13 Thread Wells Oliver
I have a vector of dates:

> data$date
 [1] "2009-04-06 CDT" "2009-04-07 CDT" "2009-04-08 CDT" "2009-04-09 CDT"
"2009-04-10 CDT" "2009-04-11 CDT" "2009-04-12 CDT" "2009-04-14 CDT"
 [9] "2009-04-15 CDT" "2009-04-16 CDT" "2009-04-17 CDT" "2009-04-18 CDT"
"2009-04-19 CDT" "2009-04-21 CDT" "2009-04-22 CDT" "2009-04-23 CDT"
[17] "2009-04-24 CDT" "2009-04-25 CDT" "2009-04-26 CDT" "2009-04-27 CDT"
"2009-04-28 CDT" "2009-04-29 CDT" "2009-05-01 CDT" "2009-05-02 CDT"
[25] "2009-05-03 CDT" "2009-05-04 CDT" "2009-05-05 CDT" "2009-05-06 CDT"
"2009-05-07 CDT" "2009-05-08 CDT" "2009-05-09 CDT" "2009-05-10 CDT"
[33] "2009-05-12 CDT" "2009-05-13 CDT" "2009-05-14 CDT" "2009-05-15 CDT"
"2009-05-16 CDT" "2009-05-17 CDT" "2009-05-18 CDT" "2009-05-19 CDT"
[41] "2009-05-20 CDT" "2009-05-21 CDT" "2009-05-22 CDT" "2009-05-23 CDT"
"2009-05-24 CDT" "2009-05-25 CDT" "2009-05-26 CDT" "2009-05-27 CDT"
[49] "2009-05-29 CDT" "2009-05-30 CDT" "2009-05-31 CDT" "2009-06-01 CDT"
"2009-06-02 CDT" "2009-06-03 CDT" "2009-06-05 CDT" "2009-06-06 CDT"
[57] "2009-06-07 CDT" "2009-06-09 CDT" "2009-06-10 CDT" "2009-06-11 CDT"
"2009-06-12 CDT" "2009-06-13 CDT" "2009-06-14 CDT"

I'd like to make a subset of this data as the x axis for a graph, using 10,
so the first would be the first date, the final would be the final date, and
the 8 in between would be spread equally through the set.

Currently I have this:

plot(data$date, data$DIFF, xaxt='n', xlab='', type='l', yaxt='n', ylab='',
bg='white', tck=-0.025, main='', col='blue')
axis(1, at=unique(data$date), labels=unique(data$date), lwd=.25, tck=-0.025)

Which renders all 63 dates, which of course is far too cluttered. Any idea
how I can easily reduce this to a subset of 10?


-- 
Wells Oliver
we...@submute.net

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread Hamid

Hi uwe,
here the example:
1) Dataset sp500 has values at 01.05.2008:

30.04.2008 21:56;1.385,63;1.385,63;1.385,14;1.385,14;0
30.04.2008 21:57;1.385,67;1.385,67;1.384,48;1.384,48;0
30.04.2008 21:58;1.384,74;1.384,91;1.384,27;1.384,91;0
30.04.2008 21:59;1.385,05;1.385,81;1.385,05;1.385,08;0
01.05.2008 15:30;1.385,97;1.385,97;1.384,14;1.384,54;0
01.05.2008 15:31;1.384,61;1.385,30;1.384,61;1.385,30;0
01.05.2008 15:32;1.385,03;1.385,54;1.385,03;1.385,54;0
01.05.2008 15:33;1.386,01;1.386,01;1.385,56;1.385,83;0
01.05.2008 15:34;1.385,61;1.385,61;1.385,00;1.385,00;0
01.05.2008 15:35;1.384,72;1.385,29;1.384,72;1.385,12;0
01.05.2008 15:36;1.385,26;1.385,26;1.384,47;1.384,48;0
01.05.2008 15:37;1.384,11;1.384,11;1.383,89;1.383,89;0
01.05.2008 15:38;1.383,63;1.383,75;1.383,33;1.383,75;0
01.05.2008 15:39;1.383,90;1.384,29;1.383,76;1.383,76;0
01.05.2008 15:40;1.383,66;1.383,66;1.383,07;1.383,08;0
01.05.2008 15:41;1.383,16;1.383,39;1.383,16;1.383,31;0
01.05.2008 15:42;1.383,70;1.383,94;1.383,69;1.383,69;0
01.05.2008 15:43;1.384,11;1.385,12;1.384,11;1.385,12;0
01.05.2008 15:44;1.385,26;1.385,72;1.385,26;1.385,72;0
01.05.2008 15:45;1.385,83;1.386,78;1.385,83;1.386,78;0
01.05.2008 15:46;1.386,89;1.387,09;1.386,89;1.386,96;0
01.05.2008 15:47;1.386,74;1.386,94;1.386,73;1.386,73;0

2) but in the dataset dax (because the 1.5 is not work day in Germany ) is
missing all the minute data. (there are some of these days the data missing)

30.04.2008 17:28;6.947,29;6.947,69;6.944,64;6.946,21;547.527
30.04.2008 17:29;6.945,92;6.948,49;6.945,10;6.945,83;888.986
02.05.2008 09:00;6.982,06;6.982,06;6.980,25;6.980,88;1.202.110
02.05.2008 09:01;6.980,08;6.980,75;6.971,93;6.971,93;367.080
02.05.2008 09:02;6.972,88;7.031,30;6.972,88;7.026,16;2.097.588
02.05.2008 09:03;7.026,72;7.029,12;7.024,96;7.027,16;373.875
02.05.2008 09:04;7.027,06;7.029,64;7.024,17;7.026,32;421.565
02.05.2008 09:05;7.026,32;7.026,67;7.022,40;7.025,08;490.090
02.05.2008 09:06;7.024,21;7.025,31;7.021,45;7.021,70;500.031
02.05.2008 09:07;7.021,72;7.022,31;7.015,32;7.015,76;486.933
02.05.2008 09:08;7.017,90;7.022,94;7.017,90;7.022,23;461.801
02.05.2008 09:09;7.022,23;7.022,55;7.018,54;7.018,99;593.412



Uwe Ligges-3 wrote:
> 
> 
> 
> Hamid wrote:
>> Hi Uwe,
>> yes you are right, but  I just wanted to show the date format I use. The
>> whole data is very huge (about 2 rows).
>> 
>> Nevertheless I like first to find the missing dates/Times. Then put 0. I
>> know they are some different approach to impute missing data, but for me
>> is
>> important to find a way to identify the missing gaps and then put the
>> values
>> (I think then it is not complicated to put other values instead of zero).
>> Do you have any idea to find it out and put the values in ?
> 
> 
> 
> Well, the problem is that I cannot imagine how your "gaps" look like, 
> hence I asked for the example. Please provide an example (just a few 
> rows) of the data how it looks like and then how you want it to be 
> afterwards.
> 
> That would be very helpful to allow readers of the list to respond.
> 
> Uwe Ligges
> 
> 
> 
>> Thanks in advance
>> Hamid
>> 
>> Uwe Ligges-3 wrote:
>>>
>>>
>>> Hamid wrote:
 Dear all,
 here my problem my be somone can help to solve this.

 I have tow timeseries from different stock market with different length
 (diff ca. 4000 )
 Now I would to add the missing times of the one of this series with
 proper
 time (they are minute data) and set the value to 0 since I need to have
 the
 same length for my calculation. 

 I tried to use the seq in R and merge but without success because of
 format
 of the date.
 My data of one vector i like to complete and extend to the length of
 the
 other vectors looks like:
>>> Well, this seems to be very complete, hence no idea what you want to 
>>> add, please specify a reproducible example.
>>>
>>> Uwe Ligges
>>>
>>>
>>>
 Date;open;hight;low;close;Volume
 02.04.2008 09:00;6.749,24;6.755,55;6.746,89;6.754,11;0
 02.04.2008 09:01;6.754,70;6.754,70;6.748,13;6.749,55;0
 02.04.2008 09:02;6.749,36;6.757,00;6.745,50;6.749,38;0
 02.04.2008 09:03;6.748,08;6.753,84;6.748,08;6.753,84;0
 02.04.2008 09:04;6.753,79;6.755,59;6.752,18;6.752,41;0
 02.04.2008 09:05;6.753,23;6.753,23;6.748,17;6.748,47;0
 02.04.2008 09:06;6.749,43;6.750,62;6.748,22;6.748,26;0
 02.04.2008 09:07;6.748,26;6.748,89;6.745,54;6.745,54;0
 02.04.2008 09:08;6.745,49;6.746,58;6.744,82;6.745,58;0
 02.04.2008 09:09;6.745,62;6.745,98;6.741,47;6.741,55;0
 02.04.2008 09:10;6.741,58;6.741,73;6.737,21;6.739,85;0
 02.04.2008 09:11;6.739,10;6.742,81;6.738,24;6.742,53;0
 02.04.2008 09:12;6.742,32;6.742,80;6.740,42;6.741,81;0
 02.04.2008 09:13;6.741,84;6.744,78;6.741,84;6.744,60;0
 02.04.2008 09:14;6.744,60;6.744,60;6.740,54;6.740,54;0
 02.04.2008 09:15;6.740,45;6.740,67;6.736,32;6.737,68;0
 02.04.2008 09:16;6.737,72;6.740,68;6.737,45;6.740,11;0
 02.04.2008 09:17;6.

Re: [R] How to resolve include Rcpp.h problems?

2009-12-13 Thread Amine Jallouli

Thank you Romain and Dirk.
The problem is solved. It works well.
I created the file src/Makevars, then I added these lines:

PKG_CPPFLAGS=`Rscript -e 'Rcpp:::CxxFlags()'`
PKG_LIBS=`Rscript -e 'Rcpp:::LdFlags()'` 



Good night.


Dirk Eddelbuettel wrote:
> 
> 
> On 13 December 2009 at 19:37, Romain Francois wrote:
> | Hi,
> | 
> | The file lives in the lib directory of the installed package Rcpp.
> | 
> | Rscript -e "cat(system.file( 'lib', 'Rcpp.h', package = 'Rcpp' ))"
> 
> Yes, and we typically use similar tricks to build with Rcpp -- suppose
> your
> file is called myfile.cpp then you can use (if you have littler)
> 
>  PKG_CPPFLAGS=`r -e'Rcpp:::CxxFlags()'` \
>  PKG_LIBS=`r -e'Rcpp:::LdFlags()'` \
>R CMD SHLIB myfile.cpp
> 
> and R CMD SHLIB will know where to find Rcpp.h and the other headers as
> well
> as libRcpp.so (or .a). 
> 
> If you don't have littler, you can use the same with Rscript as well
> 
>  PKG_CPPFLAGS=`Rscript -e 'Rcpp:::CxxFlags()'` \
>  PKG_LIBS=`Rscript -e 'Rcpp:::LdFlags()'` \
>R CMD SHLIB myfile.cpp
> 
> and that should work portably.  Likewise, you can set
> PKG_CPPFLAGS and PKG_LIBS in src/Makevars if you build a package.
> 
> I am right working on integrating the cfunction() from the rather useful
> inline package into Rcpp; this may also appear appear in the inline
> package
> itself if its maintainer accepts my patch and makes a new release.  With
> version in SVN you can now say
> 
> -
> suppressMessages(library(Rcpp))
> 
> foo <- '
>   SEXP  rl = R_NilValue;// Use this when there is nothing to be
> returned.
>   char* exceptionMesg = NULL;   // msg var in case of error
> 
>   try {
> RcppVector vec(v); // vec parameter viewed as vector of ints.
> int n = vec.size(), i = 0;
> if (n != 1) throw std::length_error("Wrong vector size");
> for (int a = 0; a < 9; a++)
>   for (int b = 0; b < 9; b++)
> for (int c = 0; c < 9; c++)
>   for (int d = 0; d < 9; d++)
> vec(i++) = a*b - c*d;
> 
> RcppResultSet rs;   // Build result set to be returned as a
> list to R.
> rs.add("vec", vec); // vec as named element with name "vec"
> rl = rs.getReturnList();// Get the list to be returned to R.
>   } catch(std::exception& ex) {
> exceptionMesg = copyMessageToR(ex.what());
>   } catch(...) {
> exceptionMesg = copyMessageToR("unknown reason");
>   }
> 
>   if (exceptionMesg != NULL) Rf_error(exceptionMesg);
> 
>   return rl;
> '
> 
> funx <- cfunction(signature(v="numeric"), foo, Rcpp=TRUE)
> 
> dd.inline.rcpp <- function() {
> x <- integer(1)
> res <- funx(v=x)[[1]]
> tabulate(res)
> }
> 
> print(mean(replicate(100,system.time(dd.inline.rcpp())["elapsed"]),trim=0.05))
> -
> 
> which means everything works from within R which is rather convenient. I
> am
> currently extending this for arguments for additional header files and
> libraries.
> 
> | The maintainer of Rcpp (cc'ed, just in case) will tell you more tricks. 
> | Note that Rcpp has its own mailing list. 
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel 
> | where questions like this might be more appropriate.
> 
> Hehe. So far that mailing has only Romain and myself rambling along.
> 
> Dirk
> 
> | Romain
> | 
> | On 12/13/2009 09:56 AM, Amine Jallouli wrote:
> | >
> | > Hi,
> | > I am Linux Ubuntu 9.04 user. I'm using R-2.6.
> | >
> | > Actually, I am developing R package for reading/writing 3D images. I
> needed
> | > to use  the R package Rcpp in order to make profit of available C/C++
> codes.
> | > My problem is that my C code is not able to include the Rcpp.h
> | >
> | > In fact, when I run this command R CMD build rply, I got the following
> error
> | > message in the file /home/amine/R/r-eclipse/rply.Rcheck/00install.out:
> | > * Installing *source* package 'rply' ...
> | > ** libs
> | > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c
> Call_interface.c
> | > -o Call_interface.o
> | > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c
> C_interface.c -o
> | > C_interface.o
> | > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c fifrt.c -o
> | > fifrt.o
> | > g++ -I/usr/share/R/include  -fpic  -g -O2 -c RCPP_test.cpp -o
> | > RCPP_test.o
> | > RCPP_test.cpp:1:18: erreur: Rcpp.h : No such file or directory
> | > RCPP_test.cpp: In function ‘SEXPREC* readRIntVec(SEXPREC*)’:
> | > RCPP_test.cpp:14: erreur: ‘RcppVector’ was not declared in this scope
> | > RCPP_test.cpp:14: erreur: expected primary-expression before ‘int’
> | > RCPP_test.cpp:14: erreur: expected `;' before ‘int’
> | > make: *** [RCPP_test.o] Erreur 1
> | > ERROR: compilation failed for package 'rply'
> | > ** Removing '/home/amine/R/r-eclipse/rply.Rcheck/rply'
> | >
> | > It is evident that I will

[R] Reshape a data set

2009-12-13 Thread dadrivr

I am trying to reshape a data set.  Could someone please help me with the
reshape, cast, and melt functions?  I am new to R and I have tried reading
up on how to use the reshape package, but I am very confused.  Here is an
example of what I am trying to do:
 subject coder score time
[1,]   1 1205
[2,]   1 2304
[3,]   2 310   10
[4,]   2 2 5   12
[5,]   3 215   NA
[6,]   3 1NA   13

Reshape to:
 subject coder.1  score.1 time.1 coder.2 score.2 time.2
[1,]  1   1 20   52  30  4
[2,]  2   3 10  10   2   5  12
[3,]  3   2 15  NA   1  NA 13

Here is the code to setup the original data set that I need to reshape:
subject <- c(1,1,2,2,3,3)
coder <- c(1,2,3,2,2,1)
score <- c(20,30,10,5,15,NA)
time <- c(5,4,10,12,NA,13)
mydata <- cbind(subject,coder,score,time)

Here is where I'm not sure:
library(reshape)
mydata_melt <- melt(mydata, id="subject", na.rm=TRUE) 
mydata_cast <- cast(mydata, ???

Any help would be greatly appreciated.  Thanks so much!
-Isaac
-- 
View this message in context: 
http://n4.nabble.com/Reshape-a-data-set-tp963104p963104.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] different randomForest performance for same data

2009-12-13 Thread Uwe Ligges



Häring wrote:

Hello,

I came across a problem when building a randomForest model. Maybe someone can 
help me.
I have a training- and a testdataset with a discrete response and ten 
predictors (numeric and factor variables). The two datasets are similar in 
terms of number of predictor, name of variables and datatype of variables 
(factor, numeric) except that only one predictor has got 20 levels in the 
training dataset and only 19 levels in the test dataset.
I found that the model performance is different when train and test a model 
with the unchanged datasets on the one hand and after assigning the levels of 
the training dataset on the testdataset. I only assign the levels and do not 
change the dataset itself however the models perform different.
Why???

Here is my code:

library(randomForest)
load("datasets.RData")  # import traindat and testdat
nlevels(traindat$predictor1)

[1] 20

nlevels(testdat$predictor1)

[1] 19

nrow(traindat)

[1] 9838

nrow(testdat)

[1] 3841

set.seed(10)
rf_orig <- randomForest(x=traindat[,-1], y=traindat[,1], xtest=testdat[,-1], 
ytest=testdat[,1],ntree=100)
data.frame(rf_orig$test$err.rate)[100,1]  # Error on test-dataset

[1] 0.3082531

# assign the levels of the training dataset th the test dataset for predictor 1
levels(testdat$predictor1) <- levels(traindat$predictor1)  
nlevels(traindat$predictor1)

[1] 20

nlevels(testdat$predictor1)

[1] 20

nrow(traindat)

[1] 9838

nrow(testdat)

[1] 3841

set.seed(10)
rf_mod <- randomForest(x=traindat[,-1], y=traindat[,1], xtest=testdat[,-1], 
ytest=testdat[,1],ntree=100)
data.frame(rf_mod$test$err.rate)[100,1]   # Error on test-dataset

[1] 0.4808644  # is different



Say testdat has 19 levels called L2, ..., L20 and traindat has 20 levels 
called L1, ..., L20.


After your call
 levels(testdat$predictor1) <- levels(traindat$predictor1)
You renamed L2 -> L1, L3 -> L2, ..., L20 -> L19 and invented a new level 
L20 that is unused.
Hence you confused all levels completely and given your ztrainikng is 
perfect, you will get an error rate of 100% in the end, because you 
renamed the levels in the testdata so that they do not fit to the 
traindata any more.


Uwe Ligges




Cheers,
TIM

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Duncan Murdoch

On 13/12/2009 1:30 PM, Viju Moses wrote:
Thanks again to all for the persuasive expert statements. 


@ Duncan, I tried Rterm.exe as advised by you in the other post, hoping for
my desired (soft wrapping) behavior. I didn't find it there either. 


Right, I rarely use it and didn't notice that.  Running "Rterm --ess" 
will give it to you, but it may have other undesirable side effects: 
that tells Rterm to assume Emacs is controlling things.


Duncan Murdoch



Shouldn't be difficult to get used to breaking lines manually, I guess.

Regards,

Viju

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com] 
Sent: Sunday, December 13, 2009 23:48

To: Viju Moses
Cc: Jorge Ivan Velez; r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

Many applications have what is known as "soft wrapping", where the
text wraps visually without inserting a new line. I don't use Windows,
so I don't know if the R gui can do this or not, but I still maintain
that the proper solution is to break your long input lines manually at
places that both make syntactic sense and make the code easier to
read.

-Ista

-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Sent: Sunday, December 13, 2009 23:51

To: Viju Moses
Cc: r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

On 13/12/2009 12:43 PM, Viju Moses wrote:
Thanks for responding. 


Problem: When I am typing a command, it does not wrap like it does in this
email while typing. As I reach the right border, a horizontal scroll bar
appears, and as I keep typing further, the initial part of the line starts
disappearing below the left border of the console. So, I am unable to see

a

long line completely without moving the scroll bar right and left. R

output,
eg >1:120 (as discussed earlier), is wrapped fine. 


I find this difficult because I had been using R in Linux (terminal), now

it

is necessary for me to use it both in Windows and Linux. My first question
was short because it is exactly the same as in the link I'd pasted. The
purpose of this question is simply to ask how this can be changed. I
understand it's a feature, not a bug. 


A screenshot of the R console is attached. Notice the $ on the left and

the
scrollbar below. 

Hope that's explanation enough. Looking forward to your reply. 


This is by design.  Carriage returns have syntactic meaning in R, so the 
editor shouldn't display phantom ones.  In Linux there's no choice 
because R doesn't control how text is displayed, but the Windows GUI 
gets it right.


Word wrapping in an email is different, because emails generally contain 
  text, not programs.  It becomes problematic when you see things like


  alongvariableanme <- anotherlongvariablename
+ 1

and you don't know how R would interpret it, because it might be either 
one or two statements.


Perhaps a smart wrapping algorithm could introduce line breaks only 
where they don't affect the meaning of the line, but then there would 
have to be statements that were unbreakable.


So my advice is simply to put your own line breaks into your code. 
Don't use an editor that wraps long lines unless it puts hard breaks 
between them.


Duncan Murdoch




__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] How to resolve include Rcpp.h problems?

2009-12-13 Thread Dirk Eddelbuettel

On 13 December 2009 at 19:37, Romain Francois wrote:
| Hi,
| 
| The file lives in the lib directory of the installed package Rcpp.
| 
| Rscript -e "cat(system.file( 'lib', 'Rcpp.h', package = 'Rcpp' ))"

Yes, and we typically use similar tricks to build with Rcpp -- suppose your
file is called myfile.cpp then you can use (if you have littler)

 PKG_CPPFLAGS=`r -e'Rcpp:::CxxFlags()'` \
 PKG_LIBS=`r -e'Rcpp:::LdFlags()'` \
 R CMD SHLIB myfile.cpp

and R CMD SHLIB will know where to find Rcpp.h and the other headers as well
as libRcpp.so (or .a). 

If you don't have littler, you can use the same with Rscript as well

 PKG_CPPFLAGS=`Rscript -e 'Rcpp:::CxxFlags()'` \
 PKG_LIBS=`Rscript -e 'Rcpp:::LdFlags()'` \
 R CMD SHLIB myfile.cpp

and that should work portably.  Likewise, you can set
PKG_CPPFLAGS and PKG_LIBS in src/Makevars if you build a package.

I am right working on integrating the cfunction() from the rather useful
inline package into Rcpp; this may also appear appear in the inline package
itself if its maintainer accepts my patch and makes a new release.  With
version in SVN you can now say

-
suppressMessages(library(Rcpp))

foo <- '
  SEXP  rl = R_NilValue;// Use this when there is nothing to be 
returned.
  char* exceptionMesg = NULL;   // msg var in case of error

  try {
RcppVector vec(v); // vec parameter viewed as vector of ints.
int n = vec.size(), i = 0;
if (n != 1) throw std::length_error("Wrong vector size");
for (int a = 0; a < 9; a++)
  for (int b = 0; b < 9; b++)
for (int c = 0; c < 9; c++)
  for (int d = 0; d < 9; d++)
vec(i++) = a*b - c*d;

RcppResultSet rs;   // Build result set to be returned as a list to 
R.
rs.add("vec", vec); // vec as named element with name "vec"
rl = rs.getReturnList();// Get the list to be returned to R.
  } catch(std::exception& ex) {
exceptionMesg = copyMessageToR(ex.what());
  } catch(...) {
exceptionMesg = copyMessageToR("unknown reason");
  }

  if (exceptionMesg != NULL) Rf_error(exceptionMesg);

  return rl;
'

funx <- cfunction(signature(v="numeric"), foo, Rcpp=TRUE)

dd.inline.rcpp <- function() {
x <- integer(1)
res <- funx(v=x)[[1]]
tabulate(res)
}

print(mean(replicate(100,system.time(dd.inline.rcpp())["elapsed"]),trim=0.05))
-

which means everything works from within R which is rather convenient. I am
currently extending this for arguments for additional header files and
libraries.

| The maintainer of Rcpp (cc'ed, just in case) will tell you more tricks. 
| Note that Rcpp has its own mailing list. 
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel 
| where questions like this might be more appropriate.

Hehe. So far that mailing has only Romain and myself rambling along.

Dirk

| Romain
| 
| On 12/13/2009 09:56 AM, Amine Jallouli wrote:
| >
| > Hi,
| > I am Linux Ubuntu 9.04 user. I'm using R-2.6.
| >
| > Actually, I am developing R package for reading/writing 3D images. I needed
| > to use  the R package Rcpp in order to make profit of available C/C++ codes.
| > My problem is that my C code is not able to include the Rcpp.h
| >
| > In fact, when I run this command R CMD build rply, I got the following error
| > message in the file /home/amine/R/r-eclipse/rply.Rcheck/00install.out:
| > * Installing *source* package 'rply' ...
| > ** libs
| > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c Call_interface.c
| > -o Call_interface.o
| > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c C_interface.c -o
| > C_interface.o
| > gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c fifrt.c -o
| > fifrt.o
| > g++ -I/usr/share/R/include  -fpic  -g -O2 -c RCPP_test.cpp -o
| > RCPP_test.o
| > RCPP_test.cpp:1:18: erreur: Rcpp.h : No such file or directory
| > RCPP_test.cpp: In function ‘SEXPREC* readRIntVec(SEXPREC*)’:
| > RCPP_test.cpp:14: erreur: ‘RcppVector’ was not declared in this scope
| > RCPP_test.cpp:14: erreur: expected primary-expression before ‘int’
| > RCPP_test.cpp:14: erreur: expected `;' before ‘int’
| > make: *** [RCPP_test.o] Erreur 1
| > ERROR: compilation failed for package 'rply'
| > ** Removing '/home/amine/R/r-eclipse/rply.Rcheck/rply'
| >
| > It is evident that I will this error since the file Rcpp.h is not in this
| > directory /usr/share/R/include .
| >
| > I tried to solve this include problem by copying the Rcpp.h to
| > /usr/share/R/include. But, it was not successful and I the following error
| > message.
| >
| > Error in dyn.load(file, DLLpath = DLLpath, ...) :
| >Unable to load shared library
| > '/home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so':
| >/home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so: undefined symbol:
| > _ZN10RcppVectorIiEC1EP7SEX

Re: [R] option for multi thread or multi core machines

2009-12-13 Thread Uwe Ligges

Standard answer:

It is possible to make use of more than 1 CPU cores by linking against 
some optimized BLAS (for matrix computations) or by parallelizing your 
code. Some packages might be of help, they are listed in the "high 
performance computing" task view on CRAN:


http://cran.r-project.org/web/views/HighPerformanceComputing.html

Uwe Ligges

Anderson, Chris wrote:

I notice that R basic installation does not take advantage of multi-thread or 
multi-core processors. Is there an option for multi-threaded processors?  I 
currently run all of my analysis on thinkpad laptop and most processing is very 
quick, however, when I run stepAIC with interaction terms it can take a couple 
of hours to complete. I have tried running the same process and a quad core 
machine 64 bit machine and process finishes about 10 mins.

Is the improved speed purely a result being able to take advantage of the extra 
memory or does the version that installs on a 64 bit machine automatically uses 
the multi-core processor?




Chris Anderson
Data Analyst
Medical Affairs
wk: 925-677-4870
cell: 707-315-8486
Fax:925-677-4670





This electronic message transmission, including any attachments, contains
information which may be confidential, privileged and/or otherwise exempt
from disclosure under applicable law. The information is intended to be for the
use of the individual(s) or entity named above. If you are not the intended
recipient or the employee or agent responsible for delivering the message
to the intended recipient, you are hereby notified that any disclosure, copying,
distribution or use of the contents of this information is strictly prohibited. 
 If
you have received this electronic transmission in error, please notify the 
sender
immediately by telephone (800-676-6777) or by a "reply to sender only"
message and destroy all electronic and hard copies of the communication,
including attachments.  Thank you.

For more information on Paradigm Management Services, LLC, please visit
http://www.paradigmcorp.com

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help creating multiple datasets using loops or vectorization

2009-12-13 Thread Uwe Ligges

Forget the loop and use

vocallGrp <- split(vocallsub, vocallsub$Group)


Uwe Ligges


Anderson, Chris wrote:

I am trying to create multiple dataset by group like the following using either 
a loop or vectorization:

vocallGp1<-subset(vocallsub, Group==1)
vocallGp2<-subset(vocallsub, Group==2)
vocallGp3<-subset(vocallsub, Group==3)
 vocallGp4<-subset(vocallsub, Group==4)
 vocallGp5<-subset(vocallsub, Group==5)

When I create the loop I get the following error:

vocallsub<-vocall[c("PatientID","Group")]

for(i in 1:length(vocallsub$Group)){vocallGrp[i]<-subset(vocallsub, Group==(i))}

Error in vocallGrp[i] <- subset(vocallsub, Group == (i)) :
  object 'vocallGrp' not found

This is my first time attempting to create a loop and am not sure what I am 
missing and I need assistance with the proper syntax.


Chris Anderson
Data Analyst
Medical Affairs
wk: 925-677-4870
cell: 707-315-8486
Fax:925-677-4670





This electronic message transmission, including any attachments, contains
information which may be confidential, privileged and/or otherwise exempt
from disclosure under applicable law. The information is intended to be for the
use of the individual(s) or entity named above. If you are not the intended
recipient or the employee or agent responsible for delivering the message
to the intended recipient, you are hereby notified that any disclosure, copying,
distribution or use of the contents of this information is strictly prohibited. 
 If
you have received this electronic transmission in error, please notify the 
sender
immediately by telephone (800-676-6777) or by a "reply to sender only"
message and destroy all electronic and hard copies of the communication,
including attachments.  Thank you.

For more information on Paradigm Management Services, LLC, please visit
http://www.paradigmcorp.com

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


[R] odfWeave produces output file that OO can't open

2009-12-13 Thread Michael Kubovy
Dear R-helpers,

I'm trying to learn how to use odfSweave.

Here is my source file (in /Users/mk/myTeach/2010-1-7720/odfWeave):

Analysis of the iris Data

Created on \Sexpr{date()}

<>=
# I usually load the libraries first so that any output produced by loading the 
library does not end up in the document
library(MASS)
library(lattice)
library(grid)
data(iris)
@

This famous (Fisher's or Anderson's) iris data set gives the measurements in 
centimeters of the variables sepal length and width and petal length and width, 
respectively, for \Sexpr{dim(iris)[1]/3} flowers from each of 
\Sexpr{length(levels(iris$Species))} species of iris. The species are 
\Sexpr{paste(levels(iris$Species), collapse = ", ")}.

Here is a bulleted list of the species:
<>=
odfItemize(levels(iris$Species))
@


With

R version 2.10.0 (2009-10-26) 
x86_64-apple-darwin9.8.0 
locale:
[1] C/C/en_US/C/C/C
attached base packages:
[1] grid  stats graphics  grDevices datasets  utils methods  
[8] base 
other attached packages:
[1] MASS_7.3-4  odfWeave_0.7.10 XML_2.6-0   lattice_0.17-26
[5] JGR_1.7-0   iplots_1.1-3JavaGD_0.5-2rJava_0.8-1
loaded via a namespace (and not attached):
[1] Matrix_0.999375-32 lme4_0.999375-32   tools_2.10.0  

I run:

> odfWeave('simple1.odt','simpleOut.odt')
  Copying  simple1.odt 
  Setting wd to  
/var/folders/TG/TG6nWu2pHYCI-BdWWiyMxU+++TI/-Tmp-//RtmplOpSLO/odfWeave13103539684
 
  Unzipping ODF file using unzip -o simple1.odt 

  Removing  simple1.odt 
  Creating a Pictures directory

  Pre-processing the contents
  Sweaving  content.Rnw 

  Writing to file content_1.xml
  Processing code chunks ...
1 : term hide(label=loadLibs)
2 : term xml(label=showOutputList)

  'content_1.xml' has been Sweaved

  Removing content.xml

  Post-processing the contents
  Removing content.Rnw 
  Removing styles.xml
  Renaming styles_2.xml to styles.xml
  Removing extra files

  Packaging file using zip -r simple1.odt . 
  Copying  simple1.odt 
  Resetting wd
  Removing  
/var/folders/TG/TG6nWu2pHYCI-BdWWiyMxU+++TI/-Tmp-//RtmplOpSLO/odfWeave13103539684
 

  Done
Warning message:
closing unused connection 3 (content.xml) 


When I try to open simpleOut.odt I get: "Format error discovered in the file in 
sub-document content.xml at 22,124(row,col)." The file content.xml is empty.




__
Professor Michael Kubovy
University of Virginia
Department of Psychology
for mail add:
P.O.Box 400400
Charlottesville, VA 22904-4400
USA
for FedEx or UPS add: 
Gilmer Hall, Room 102
McCormick Road
Charlottesville, VA 22903
USA
roomphone
Office:B011 +1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single forward slash with a double backward slash in a string?

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 1:58 PM, Peter Dalgaard wrote:


David Winsemius wrote:

On Dec 13, 2009, at 1:00 PM, Sean Zhang wrote:

Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash  
with double

backward slash in a string?

i.e.,  from  "a/b" to "a\\b"

> sub("/", "","a/b")
#the backslashes need to be doubled because they are the escape  
character.

[1] "a\\b"


Bzzzt. Wrong answer.

> nchar(sub("/", "","a/b") )
[1] 3
> cat(sub("/", "","a/b"),"\n")
a\b

> nchar(sub("/", "","a/b") )
[1] 4
> sub("/", "","a/b")
[1] "ab"
> cat(sub("/", "","a/b"),"\n")
a\\b

You are not the first... ;-)


Thanks. I'm probably not the last, but seeing as this is not my first  
effort at this either, let me make an effort toward preventing myself  
(and Zhang) from getting it wrong (again).
-- The console display is a potentially misleading representation of  
the string object in the sense that it displays any "\" characters as  
"\\"?
-- When used in a regular expression, one needs to use FOUR "\"'s to  
get one 'internal' "\", the first two "\\" create one escape-char  
within the parser then which then applies to the second escape-char  
created by the second two "\\"?


(I think I have seen both those facts in print before, but perhaps  
typing them will make it stick this time.)





--
  O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
 c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45)  
35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45)  
35327907


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread Uwe Ligges



Hamid wrote:

Hi Uwe,
yes you are right, but  I just wanted to show the date format I use. The
whole data is very huge (about 2 rows).

Nevertheless I like first to find the missing dates/Times. Then put 0. I
know they are some different approach to impute missing data, but for me is
important to find a way to identify the missing gaps and then put the values
(I think then it is not complicated to put other values instead of zero).
Do you have any idea to find it out and put the values in ?




Well, the problem is that I cannot imagine how your "gaps" look like, 
hence I asked for the example. Please provide an example (just a few 
rows) of the data how it looks like and then how you want it to be 
afterwards.


That would be very helpful to allow readers of the list to respond.

Uwe Ligges




Thanks in advance
Hamid

Uwe Ligges-3 wrote:



Hamid wrote:

Dear all,
here my problem my be somone can help to solve this.

I have tow timeseries from different stock market with different length
(diff ca. 4000 )
Now I would to add the missing times of the one of this series with
proper
time (they are minute data) and set the value to 0 since I need to have
the
same length for my calculation. 


I tried to use the seq in R and merge but without success because of
format
of the date.
My data of one vector i like to complete and extend to the length of the
other vectors looks like:
Well, this seems to be very complete, hence no idea what you want to 
add, please specify a reproducible example.


Uwe Ligges




Date;open;hight;low;close;Volume
02.04.2008 09:00;6.749,24;6.755,55;6.746,89;6.754,11;0
02.04.2008 09:01;6.754,70;6.754,70;6.748,13;6.749,55;0
02.04.2008 09:02;6.749,36;6.757,00;6.745,50;6.749,38;0
02.04.2008 09:03;6.748,08;6.753,84;6.748,08;6.753,84;0
02.04.2008 09:04;6.753,79;6.755,59;6.752,18;6.752,41;0
02.04.2008 09:05;6.753,23;6.753,23;6.748,17;6.748,47;0
02.04.2008 09:06;6.749,43;6.750,62;6.748,22;6.748,26;0
02.04.2008 09:07;6.748,26;6.748,89;6.745,54;6.745,54;0
02.04.2008 09:08;6.745,49;6.746,58;6.744,82;6.745,58;0
02.04.2008 09:09;6.745,62;6.745,98;6.741,47;6.741,55;0
02.04.2008 09:10;6.741,58;6.741,73;6.737,21;6.739,85;0
02.04.2008 09:11;6.739,10;6.742,81;6.738,24;6.742,53;0
02.04.2008 09:12;6.742,32;6.742,80;6.740,42;6.741,81;0
02.04.2008 09:13;6.741,84;6.744,78;6.741,84;6.744,60;0
02.04.2008 09:14;6.744,60;6.744,60;6.740,54;6.740,54;0
02.04.2008 09:15;6.740,45;6.740,67;6.736,32;6.737,68;0
02.04.2008 09:16;6.737,72;6.740,68;6.737,45;6.740,11;0
02.04.2008 09:17;6.740,04;6.746,34;6.740,04;6.746,34;0
02.04.2008 09:18;6.746,21;6.750,64;6.746,21;6.749,99;0
02.04.2008 09:19;6.750,61;6.752,95;6.749,07;6.750,69;0
02.04.2008 09:20;6.750,82;6.751,01;6.748,20;6.750,74;0
02.04.2008 09:21;6.750,57;6.752,98;6.748,62;6.752,98;0
02.04.2008 09:22;6.752,74;6.756,24;6.752,74;6.753,84;0
02.04.2008 09:23;6.753,90;6.755,51;6.752,70;6.753,05;0

Thanks in advance for any help!
H.

__
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 provide commented, minimal, self-contained, reproducible code.






__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single forward slash with a double backward slash in a string?

2009-12-13 Thread Peter Dalgaard

Peter Dalgaard wrote:

David Winsemius wrote:


On Dec 13, 2009, at 1:00 PM, Sean Zhang wrote:


Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash with 
double

backward slash in a string?

i.e.,  from  "a/b" to "a\\b"


 > sub("/", "","a/b")
 #the backslashes need to be doubled because they are the escape 
character.

[1] "a\\b"


Bzzzt. Wrong answer.


... unless of course, Sean really intended to replace a single slash 
with a SINGLE backslash.




 > nchar(sub("/", "","a/b") )
[1] 3
 > cat(sub("/", "","a/b"),"\n")
a\b

 > nchar(sub("/", "","a/b") )
[1] 4
 > sub("/", "","a/b")
[1] "ab"
 > cat(sub("/", "","a/b"),"\n")
a\\b

You are not the first... ;-)




--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread Hamid

Hi Uwe,
yes you are right, but  I just wanted to show the date format I use. The
whole data is very huge (about 2 rows).

Nevertheless I like first to find the missing dates/Times. Then put 0. I
know they are some different approach to impute missing data, but for me is
important to find a way to identify the missing gaps and then put the values
(I think then it is not complicated to put other values instead of zero).
Do you have any idea to find it out and put the values in ?

Thanks in advance
Hamid

Uwe Ligges-3 wrote:
> 
> 
> 
> Hamid wrote:
>> Dear all,
>> here my problem my be somone can help to solve this.
>> 
>> I have tow timeseries from different stock market with different length
>> (diff ca. 4000 )
>> Now I would to add the missing times of the one of this series with
>> proper
>> time (they are minute data) and set the value to 0 since I need to have
>> the
>> same length for my calculation. 
>> 
>> I tried to use the seq in R and merge but without success because of
>> format
>> of the date.
>> My data of one vector i like to complete and extend to the length of the
>> other vectors looks like:
> 
> Well, this seems to be very complete, hence no idea what you want to 
> add, please specify a reproducible example.
> 
> Uwe Ligges
> 
> 
> 
>> Date;open;hight;low;close;Volume
>> 02.04.2008 09:00;6.749,24;6.755,55;6.746,89;6.754,11;0
>> 02.04.2008 09:01;6.754,70;6.754,70;6.748,13;6.749,55;0
>> 02.04.2008 09:02;6.749,36;6.757,00;6.745,50;6.749,38;0
>> 02.04.2008 09:03;6.748,08;6.753,84;6.748,08;6.753,84;0
>> 02.04.2008 09:04;6.753,79;6.755,59;6.752,18;6.752,41;0
>> 02.04.2008 09:05;6.753,23;6.753,23;6.748,17;6.748,47;0
>> 02.04.2008 09:06;6.749,43;6.750,62;6.748,22;6.748,26;0
>> 02.04.2008 09:07;6.748,26;6.748,89;6.745,54;6.745,54;0
>> 02.04.2008 09:08;6.745,49;6.746,58;6.744,82;6.745,58;0
>> 02.04.2008 09:09;6.745,62;6.745,98;6.741,47;6.741,55;0
>> 02.04.2008 09:10;6.741,58;6.741,73;6.737,21;6.739,85;0
>> 02.04.2008 09:11;6.739,10;6.742,81;6.738,24;6.742,53;0
>> 02.04.2008 09:12;6.742,32;6.742,80;6.740,42;6.741,81;0
>> 02.04.2008 09:13;6.741,84;6.744,78;6.741,84;6.744,60;0
>> 02.04.2008 09:14;6.744,60;6.744,60;6.740,54;6.740,54;0
>> 02.04.2008 09:15;6.740,45;6.740,67;6.736,32;6.737,68;0
>> 02.04.2008 09:16;6.737,72;6.740,68;6.737,45;6.740,11;0
>> 02.04.2008 09:17;6.740,04;6.746,34;6.740,04;6.746,34;0
>> 02.04.2008 09:18;6.746,21;6.750,64;6.746,21;6.749,99;0
>> 02.04.2008 09:19;6.750,61;6.752,95;6.749,07;6.750,69;0
>> 02.04.2008 09:20;6.750,82;6.751,01;6.748,20;6.750,74;0
>> 02.04.2008 09:21;6.750,57;6.752,98;6.748,62;6.752,98;0
>> 02.04.2008 09:22;6.752,74;6.756,24;6.752,74;6.753,84;0
>> 02.04.2008 09:23;6.753,90;6.755,51;6.752,70;6.753,05;0
>> 
>> Thanks in advance for any help!
>> H.
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://n4.nabble.com/Need-help-to-complete-missing-value-Date-and-Time-in-Sp500-Data-tp962671p963080.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single forward slash with a double backward slash in a string?

2009-12-13 Thread Peter Dalgaard

David Winsemius wrote:


On Dec 13, 2009, at 1:00 PM, Sean Zhang wrote:


Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash with 
double

backward slash in a string?

i.e.,  from  "a/b" to "a\\b"


 > sub("/", "","a/b")
 #the backslashes need to be doubled because they are the escape character.
[1] "a\\b"


Bzzzt. Wrong answer.

> nchar(sub("/", "","a/b") )
[1] 3
> cat(sub("/", "","a/b"),"\n")
a\b

> nchar(sub("/", "","a/b") )
[1] 4
> sub("/", "","a/b")
[1] "ab"
> cat(sub("/", "","a/b"),"\n")
a\\b

You are not the first... ;-)

--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] do while loop

2009-12-13 Thread annie Zhang
Thanks, Uwe. It's very useful.
Annie

2009/12/13 Uwe Ligges 

>
>
> annie Zhang wrote:
>
>> Hi, All,
>>
>> Is there a 'do while' loop in R for which I can check conditions after?  I
>> checked and it seems there is only the 'while' function.
>>
>
>
> Right, but you can use repeat{} and check conditions whereever using if()
> and exit the loop with the "break" control word.
>
> Uwe Ligges
>
>
> Thanks,
>>
>> Annie
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> 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 provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] How to resolve include Rcpp.h problems?

2009-12-13 Thread Romain Francois

Hi,

The file lives in the lib directory of the installed package Rcpp.

Rscript -e "cat(system.file( 'lib', 'Rcpp.h', package = 'Rcpp' ))"

The maintainer of Rcpp (cc'ed, just in case) will tell you more tricks. 
Note that Rcpp has its own mailing list. 
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel 
where questions like this might be more appropriate.


Romain

On 12/13/2009 09:56 AM, Amine Jallouli wrote:


Hi,
I am Linux Ubuntu 9.04 user. I'm using R-2.6.

Actually, I am developing R package for reading/writing 3D images. I needed
to use  the R package Rcpp in order to make profit of available C/C++ codes.
My problem is that my C code is not able to include the Rcpp.h

In fact, when I run this command R CMD build rply, I got the following error
message in the file /home/amine/R/r-eclipse/rply.Rcheck/00install.out:
* Installing *source* package 'rply' ...
** libs
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c Call_interface.c
-o Call_interface.o
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c C_interface.c -o
C_interface.o
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c fifrt.c -o
fifrt.o
g++ -I/usr/share/R/include  -fpic  -g -O2 -c RCPP_test.cpp -o
RCPP_test.o
RCPP_test.cpp:1:18: erreur: Rcpp.h : No such file or directory
RCPP_test.cpp: In function ‘SEXPREC* readRIntVec(SEXPREC*)’:
RCPP_test.cpp:14: erreur: ‘RcppVector’ was not declared in this scope
RCPP_test.cpp:14: erreur: expected primary-expression before ‘int’
RCPP_test.cpp:14: erreur: expected `;' before ‘int’
make: *** [RCPP_test.o] Erreur 1
ERROR: compilation failed for package 'rply'
** Removing '/home/amine/R/r-eclipse/rply.Rcheck/rply'

It is evident that I will this error since the file Rcpp.h is not in this
directory /usr/share/R/include .

I tried to solve this include problem by copying the Rcpp.h to
/usr/share/R/include. But, it was not successful and I the following error
message.

Error in dyn.load(file, DLLpath = DLLpath, ...) :
   Unable to load shared library
'/home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so':
   /home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so: undefined symbol:
_ZN10RcppVectorIiEC1EP7SEXPREC
Error in library(rply) : .First.lib has failed for 'rply'
Execution stopped

It looks like this package has a loading problem: see the messages for
details.


Resulting this last error seems to be also logical. In fact, I think the
file libRcpp.so is need for the compilation of my code.

Please notice that the package Rcpp is installed in the following directory:
/usr/lib/R/site-library/Rcpp

Thank you for giving an idea for solving this problem.



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] do while loop

2009-12-13 Thread Uwe Ligges



annie Zhang wrote:

Hi, All,

Is there a 'do while' loop in R for which I can check conditions after?  I
checked and it seems there is only the 'while' function.



Right, but you can use repeat{} and check conditions whereever using 
if() and exit the loop with the "break" control word.


Uwe Ligges



Thanks,

Annie

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Array of legend text with math symbols from predefined variables

2009-12-13 Thread Uwe Ligges

See

Ligges, U. (2002): R Help Desk: Automation of Mathematical Annotation in 
Plots. R News 2 (3), 32-34.

http://www.r-project.org/doc/Rnews/Rnews_2002-3.pdf

Uwe Ligges

Koen wrote:

Hello,

I am trying to include legend text with math symbols from a predefined
character variable that is read in from a file.
 
If there is only one line of text in the legend, the following, although

cumbersome, works for me:

  > LegendText = " 'U' [infinity], '=10 m/s' "   # (read in from a file)
  > LegendName = paste("bquote(paste(",LegendText, "))")
  > plot( c(1,2,3), c(1,2,3) )
  > legend(‘topleft’,1, eval(parse(text=LegendName)) ) 


 If I now have more than one line in a plot and hence want to include more
than one line of legendtext, I run into problems because

  > legend(‘topleft’,1, c(
 eval(parse(text=LegendName1)),eval(parse(text=LegendName2))  ) 


will not result in evaluation of the character string but just a paste of
the string and

  > legend(‘topleft’,1, eval(parse(text=c(LegendName1, LegendName2)))  ) 


will only evaluate the first element of the array.

Am I trying to do the impossible or is my approach totally wrong? Any help
would be greatly appreciated!

Koen

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


[R] do while loop

2009-12-13 Thread annie Zhang
Hi, All,

Is there a 'do while' loop in R for which I can check conditions after?  I
checked and it seems there is only the 'while' function.

Thanks,

Annie

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] code for [[.data.frame

2009-12-13 Thread Romain Francois

On 12/13/2009 02:42 PM, Guillaume Yziquel wrote:

baptiste auguie a écrit :

`[[.data.frame`


Note that this will only be the source code if you have options 
"keep.source" and "keep.source.pkgs" set to TRUE, and the environment 
variable "R_KEEP_PKG_SOURCE" equal to yes.


Otherwise you see the code parsed and deparsed, which loses comments and 
formatting.


> `[[.data.frame`
function(x, ..., exact=TRUE)
{
## use in-line functions to refer to the 1st and 2nd ... arguments
## explicitly. Also will check for wrong number or empty args
na <- nargs() - !missing(exact)
if(!all(names(sys.call()) %in% c("", "exact")))
warning("named arguments other than 'exact' are discouraged")

if(na < 3L)
(function(x, i, exact)
  if(is.matrix(i)) as.matrix(x)[[i]]
  else .subset2(x, i, exact=exact))(x, ..., exact=exact)
else {
col <- .subset2(x, ..2, exact=exact)
i <- if(is.character(..1))
pmatch(..1, row.names(x), duplicates.ok = TRUE)
else ..1
.subset2(col, i, exact=exact)
}
}



> writeLines( deparse( `[[.data.frame` ) )
function (x, ..., exact = TRUE)
{
na <- nargs() - (!missing(exact))
if (!all(names(sys.call()) %in% c("", "exact")))
warning("named arguments other than 'exact' are discouraged")
if (na < 3L)
(function(x, i, exact) if (is.matrix(i))
as.matrix(x)[[i]]
else .subset2(x, i, exact = exact))(x, ..., exact = exact)
else {
col <- .subset2(x, ..2, exact = exact)
i <- if (is.character(..1))
pmatch(..1, row.names(x), duplicates.ok = TRUE)
else ..1
.subset2(col, i, exact = exact)
}
}

Romain


and more generally see Rnews Volume 6/4, October 2006 "Accessing the
Sources".


HTH,

baptiste


Thank you so much.

Indeed, I've been able to look at the source code of the function from
the source code of R. But I was quite keen on knowing how to do this
from the toploop. Thanks a lot.




--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/HlX9 : new package : bibtex
|- http://tr.im/Gq7i : ohloh
`- http://tr.im/FtUu : new package : highlight

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Viju Moses
Thanks again to all for the persuasive expert statements. 

@ Duncan, I tried Rterm.exe as advised by you in the other post, hoping for
my desired (soft wrapping) behavior. I didn't find it there either. 

Shouldn't be difficult to get used to breaking lines manually, I guess.

Regards,

Viju

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com] 
Sent: Sunday, December 13, 2009 23:48
To: Viju Moses
Cc: Jorge Ivan Velez; r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

Many applications have what is known as "soft wrapping", where the
text wraps visually without inserting a new line. I don't use Windows,
so I don't know if the R gui can do this or not, but I still maintain
that the proper solution is to break your long input lines manually at
places that both make syntactic sense and make the code easier to
read.

-Ista

-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Sent: Sunday, December 13, 2009 23:51
To: Viju Moses
Cc: r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

On 13/12/2009 12:43 PM, Viju Moses wrote:
> Thanks for responding. 
> 
> Problem: When I am typing a command, it does not wrap like it does in this
> email while typing. As I reach the right border, a horizontal scroll bar
> appears, and as I keep typing further, the initial part of the line starts
> disappearing below the left border of the console. So, I am unable to see
a
> long line completely without moving the scroll bar right and left. R
output,
> eg >1:120 (as discussed earlier), is wrapped fine. 
> 
> I find this difficult because I had been using R in Linux (terminal), now
it
> is necessary for me to use it both in Windows and Linux. My first question
> was short because it is exactly the same as in the link I'd pasted. The
> purpose of this question is simply to ask how this can be changed. I
> understand it's a feature, not a bug. 
> 
> A screenshot of the R console is attached. Notice the $ on the left and
the
> scrollbar below. 
> 
> Hope that's explanation enough. Looking forward to your reply. 

This is by design.  Carriage returns have syntactic meaning in R, so the 
editor shouldn't display phantom ones.  In Linux there's no choice 
because R doesn't control how text is displayed, but the Windows GUI 
gets it right.

Word wrapping in an email is different, because emails generally contain 
  text, not programs.  It becomes problematic when you see things like

  alongvariableanme <- anotherlongvariablename
+ 1

and you don't know how R would interpret it, because it might be either 
one or two statements.

Perhaps a smart wrapping algorithm could introduce line breaks only 
where they don't affect the meaning of the line, but then there would 
have to be statements that were unbreakable.

So my advice is simply to put your own line breaks into your code. 
Don't use an editor that wraps long lines unless it puts hard breaks 
between them.

Duncan Murdoch

__
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 provide commented, minimal, self-contained, reproducible code.


[R] cross validation/GAM/package Daim

2009-12-13 Thread Kim Vanselow
Dear r-helpers,
I estimated a generalized additive model (GAM) using Hastie's package GAM.

Example:
gam1 <- gam(vegetation ~ s(slope), family = binomial, data=aufnahmen_0708, 
trace=TRUE)
pred <- predict(gam1, type = "response")

vegetation is a categorial, slope a numerical variable.

Now I want to assess the accurancy of the model using k-fold cross validation.

I found the package Daim with function Daim for estimation of prediction error 
based on cross-validation (CV) or various bootstrap techniques.

But I am not able to run it properly. I tried the following 3 versions:

1.
accurancy <- Daim (vegetation ~ s(slope), model=gam1, data=aufnahmen_0708, 
labpos="alpine mats") --> error: could not find function "model"

2.
accurancy <- Daim (vegetation ~ s(slope), model=gam, data=aufnahmen_0708, 
labpos="alpine mats") --> error in model(formula, train, test) : `family' not 
recognized

3. accurancy <- Daim (vegetation ~ s(slope), model=gam(family=binomial), 
data=aufnahmen_0708, labpos="alpine mats") --> error in environment(formula) : 
Element 1 is empty; Der Teil der Argumentliste '.Internal' der berechnet wurde 
war:  (fun)

Can anybody help me? Any advice is greatly appreciated!

Thanks
Kim




-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Duncan Murdoch

On 13/12/2009 12:43 PM, Viju Moses wrote:
Thanks for responding. 


Problem: When I am typing a command, it does not wrap like it does in this
email while typing. As I reach the right border, a horizontal scroll bar
appears, and as I keep typing further, the initial part of the line starts
disappearing below the left border of the console. So, I am unable to see a
long line completely without moving the scroll bar right and left. R output,
eg >1:120 (as discussed earlier), is wrapped fine. 


I find this difficult because I had been using R in Linux (terminal), now it
is necessary for me to use it both in Windows and Linux. My first question
was short because it is exactly the same as in the link I'd pasted. The
purpose of this question is simply to ask how this can be changed. I
understand it's a feature, not a bug. 


A screenshot of the R console is attached. Notice the $ on the left and the
scrollbar below. 

Hope that's explanation enough. Looking forward to your reply. 


This is by design.  Carriage returns have syntactic meaning in R, so the 
editor shouldn't display phantom ones.  In Linux there's no choice 
because R doesn't control how text is displayed, but the Windows GUI 
gets it right.


Word wrapping in an email is different, because emails generally contain 
 text, not programs.  It becomes problematic when you see things like


 alongvariableanme <- anotherlongvariablename
+ 1

and you don't know how R would interpret it, because it might be either 
one or two statements.


Perhaps a smart wrapping algorithm could introduce line breaks only 
where they don't affect the meaning of the line, but then there would 
have to be statements that were unbreakable.


So my advice is simply to put your own line breaks into your code. 
Don't use an editor that wraps long lines unless it puts hard breaks 
between them.


Duncan Murdoch




-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Sent: Sunday, December 13, 2009 16:35

To: Viju Moses
Cc: r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

On 12/12/2009 10:34 PM, Viju Moses wrote:

I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have

not

changed Windows settings or R GUI settings much except to change from MDI

to
SDI. 

Someone else reported this problem a few months ago: 
https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
but it wasn't followed up. 


Yes it was, I replied to that message:

Which version are you talking about?  I don't recall Rgui ever wrapping 
input.  The config settings affect output.  Maybe you're thinking of

Rterm?

You also don't answer my question.  If you are claiming something has 
changed, you need to tell us how to see the change.





__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Ista Zahn
Many applications have what is known as "soft wrapping", where the
text wraps visually without inserting a new line. I don't use Windows,
so I don't know if the R gui can do this or not, but I still maintain
that the proper solution is to break your long input lines manually at
places that both make syntactic sense and make the code easier to
read.

-Ista

On Sun, Dec 13, 2009 at 12:47 PM, Viju Moses  wrote:
> Thanks for answering. But this is the default behavior when using R (or
> anything else) in any linux terminal.
>
> -Original Message-
> From: Ista Zahn [mailto:istaz...@gmail.com]
> Sent: Sunday, December 13, 2009 19:01
> To: Viju Moses
> Cc: Jorge Ivan Velez; r-help@r-project.org
> Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
> long line in R GUI
>
> H Viju,
> Automatically breaking _input_ lines  is dangerous, because line
> breaks have meaning in R. It sounds to me like you need to use the
> Return key to insert line breaks at the appropriate places.
>
> -Ista
>
> On Sat, Dec 12, 2009 at 11:29 PM, Viju Moses  wrote:
>> Dear Jorge, Thanks.
>>
>> But.
>>
>> (My R console width is set by default at 91, which is fine.
>>
>> Output for  R>1:120  wraps correctly already. )
>>
>>
>>
>> The problem is that when I am typing a command, it does not wrap like it
>> does in this email while typing. As I am reach the right border, a
>> horizontal scroll bar appears, and as I keep typing further, the initial
>> part of the line starts disappearing below the left border of the console.
>> So, I am unable to see a long line completely without moving the scroll
> bar
>> right and left.
>>
>>
>>
>> From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com]
>> Sent: Sunday, December 13, 2009 9:09
>> To: Viju Moses
>> Cc: r-help@r-project.org
>> Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
>> long line in R GUI
>>
>>
>>
>> Hi Viju,
>>
>>
>>
>> Here is a suggestion:
>>
>>
>>
>> R> options(width = 80)
>>
>> R> 1:120
>>
>>
>>
>> HTH,
>>
>> Jorge
>>
>>
>>
>> On Sat, Dec 12, 2009 at 10:34 PM, Viju Moses <> wrote:
>>
>> I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have
> not
>> changed Windows settings or R GUI settings much except to change from MDI
> to
>> SDI.
>>
>> Someone else reported this problem a few months ago:
>> https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
>> but it wasn't followed up.
>>
>> I'd change the settings on Preferences, but there's no help explaining the
>> various options. (That's another problem, by the way... Is there a link
> you
>> know?)
>>
>> I guess fixing this would be straightforward. Hope someone who did will
>> reply. Thanks.
>>
>> __
>> 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 provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>>
>>        [[alternative HTML version deleted]]
>>
>> __
>> 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 provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Ista Zahn
> Graduate student
> University of Rochester
> Department of Clinical and Social Psychology
> http://yourpsyche.org
>
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] how to replace a single forward slash with a double backward slash in a string?

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 1:00 PM, Sean Zhang wrote:


Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash  
with double

backward slash in a string?

i.e.,  from  "a/b" to "a\\b"


> sub("/", "","a/b")
 #the backslashes need to be doubled because they are the escape  
character.

[1] "a\\b"



Many thanks in advance.

-Sean

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


[R] how to replace a single forward slash with a double backward slash in a string?

2009-12-13 Thread Sean Zhang
Dear R-helpers.

Can someone kindly tell me how to replace a single forward slash with double
backward slash in a string?

i.e.,  from  "a/b" to "a\\b"

Many thanks in advance.

-Sean

[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Viju Moses
Thanks for answering. But this is the default behavior when using R (or
anything else) in any linux terminal. 

-Original Message-
From: Ista Zahn [mailto:istaz...@gmail.com] 
Sent: Sunday, December 13, 2009 19:01
To: Viju Moses
Cc: Jorge Ivan Velez; r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

H Viju,
Automatically breaking _input_ lines  is dangerous, because line
breaks have meaning in R. It sounds to me like you need to use the
Return key to insert line breaks at the appropriate places.

-Ista

On Sat, Dec 12, 2009 at 11:29 PM, Viju Moses  wrote:
> Dear Jorge, Thanks.
>
> But.
>
> (My R console width is set by default at 91, which is fine.
>
> Output for  R>1:120  wraps correctly already. )
>
>
>
> The problem is that when I am typing a command, it does not wrap like it
> does in this email while typing. As I am reach the right border, a
> horizontal scroll bar appears, and as I keep typing further, the initial
> part of the line starts disappearing below the left border of the console.
> So, I am unable to see a long line completely without moving the scroll
bar
> right and left.
>
>
>
> From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com]
> Sent: Sunday, December 13, 2009 9:09
> To: Viju Moses
> Cc: r-help@r-project.org
> Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
> long line in R GUI
>
>
>
> Hi Viju,
>
>
>
> Here is a suggestion:
>
>
>
> R> options(width = 80)
>
> R> 1:120
>
>
>
> HTH,
>
> Jorge
>
>
>
> On Sat, Dec 12, 2009 at 10:34 PM, Viju Moses <> wrote:
>
> I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have
not
> changed Windows settings or R GUI settings much except to change from MDI
to
> SDI.
>
> Someone else reported this problem a few months ago:
> https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
> but it wasn't followed up.
>
> I'd change the settings on Preferences, but there's no help explaining the
> various options. (That's another problem, by the way... Is there a link
you
> know?)
>
> I guess fixing this would be straightforward. Hope someone who did will
> reply. Thanks.
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>        [[alternative HTML version deleted]]
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] How to control the skewness of a heteroscedastic variable?- The solution

2009-12-13 Thread Karl-Oskar Lindgren
Just to make sure that you don't spend your valuable time on the 
problem that I posted earlier today, I want to let you know that I 
have found my mistake. I simply forgot to take account of the higher 
order dependence bw my independent variable and the squared error 
term.

Regards
Karl-Oskar

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Viju Moses
Thanks for responding. 

Problem: When I am typing a command, it does not wrap like it does in this
email while typing. As I reach the right border, a horizontal scroll bar
appears, and as I keep typing further, the initial part of the line starts
disappearing below the left border of the console. So, I am unable to see a
long line completely without moving the scroll bar right and left. R output,
eg >1:120 (as discussed earlier), is wrapped fine. 

I find this difficult because I had been using R in Linux (terminal), now it
is necessary for me to use it both in Windows and Linux. My first question
was short because it is exactly the same as in the link I'd pasted. The
purpose of this question is simply to ask how this can be changed. I
understand it's a feature, not a bug. 

A screenshot of the R console is attached. Notice the $ on the left and the
scrollbar below. 

Hope that's explanation enough. Looking forward to your reply. 


-Original Message-
From: Duncan Murdoch [mailto:murd...@stats.uwo.ca] 
Sent: Sunday, December 13, 2009 16:35
To: Viju Moses
Cc: r-help@r-project.org
Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
long line in R GUI

On 12/12/2009 10:34 PM, Viju Moses wrote:
> I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have
not
> changed Windows settings or R GUI settings much except to change from MDI
to
> SDI. 
> 
> Someone else reported this problem a few months ago: 
> https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
> but it wasn't followed up. 

Yes it was, I replied to that message:

>> Which version are you talking about?  I don't recall Rgui ever wrapping 
>> input.  The config settings affect output.  Maybe you're thinking of
Rterm?

You also don't answer my question.  If you are claiming something has 
changed, you need to tell us how to see the change.




Screenshot.pdf
Description: Adobe PDF document
__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Repeated Measures Analysis - GLM

2009-12-13 Thread John Fox
Dear Ingo,

One approach would be to use the Anova() function in the car package. See
?Anova and in particular the O'Brien and Kaiser example, which is for a more
complicated repeated-measures design. If you want to get "type-III" tests
(as opposed to the default "type-II" tests), be careful with the contrast
coding for the between-subjects factors.

I hope this helps,
 John


John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of protonringe
> Sent: December-13-09 11:29 AM
> To: r-help@r-project.org
> Subject: [R] Repeated Measures Analysis - GLM
> 
> 
> Hello to the R world...
> 
> I have some problems regarding a GLM - repeated measures analysis.
> 
> I want to test overall differences between AgeClass and Treatment (between
> subject) with OpenR1+OpenR2+OpenR3 (repeated measures, within subject).
The
> table looks kind like this:
> 
> AgeClass  Treatment   OpenR1  OpenR2  OpenR3
> 1 1   0   0   12.63
> 1 1   12.67   3.8345.67
> 1 1   38.46   65.38   75.21
> 1 1   14.46   0   17.96
> 1 2   27.83   47.33   66.38
> 1 2   15.75   0   10.21
> 1 2   43.96   41.04   51.88
> 1 2   52.96   55.54   41.58
> 1 3   43.13   71.25   82.71
> 1 3   0.2518.46   27.04
> 1 3   0.7921.75   68.38
> 2 1   0   0   0
> 2 1   0   0   0
> 2 1   1.1718.75   45.67
> 2 1   0   0   0
> 2 1   0   0   49.42
> 2 2   2.130   26.63
> 2 2   0   8.1323.88
> 2 2   2.250   0
> 2 2   30.96   25.71   10.92
> 2 3   33.33   30.71   16.63
> 2 3   0   20.04   14.88
> 2 3   24.96   0   3.88
> .
> .
> .
> 
> I tried several things, for example this:
>
aov(?~(OpenR1*OpenR2*OpenR3*AgeClass*Treatment)+Error(??/(OpenR1*Ope
n
> R2*OpenR3))+(AgeClass*Treatment))
> 
> I don't really know what response-variable to use, or what the
> subject-variable is
> 
> There is no problem to create the model with SPSS, but for my
Diploma-Thesis
> in biology i want to do all the statistics with R...
> 
> Regards and many thanks in advance
> 
> Ingo
> 
> 
> --
> View this message in context: http://n4.nabble.com/Repeated-Measures-
> Analysis-GLM-tp963016p963016.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> 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 provide commented, minimal, self-contained, reproducible code.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help to complete missing value (Date and Time) in Sp500 Data

2009-12-13 Thread Uwe Ligges



Hamid wrote:

Dear all,
here my problem my be somone can help to solve this.

I have tow timeseries from different stock market with different length
(diff ca. 4000 )
Now I would to add the missing times of the one of this series with proper
time (they are minute data) and set the value to 0 since I need to have the
same length for my calculation. 


I tried to use the seq in R and merge but without success because of format
of the date.
My data of one vector i like to complete and extend to the length of the
other vectors looks like:


Well, this seems to be very complete, hence no idea what you want to 
add, please specify a reproducible example.


Uwe Ligges




Date;open;hight;low;close;Volume
02.04.2008 09:00;6.749,24;6.755,55;6.746,89;6.754,11;0
02.04.2008 09:01;6.754,70;6.754,70;6.748,13;6.749,55;0
02.04.2008 09:02;6.749,36;6.757,00;6.745,50;6.749,38;0
02.04.2008 09:03;6.748,08;6.753,84;6.748,08;6.753,84;0
02.04.2008 09:04;6.753,79;6.755,59;6.752,18;6.752,41;0
02.04.2008 09:05;6.753,23;6.753,23;6.748,17;6.748,47;0
02.04.2008 09:06;6.749,43;6.750,62;6.748,22;6.748,26;0
02.04.2008 09:07;6.748,26;6.748,89;6.745,54;6.745,54;0
02.04.2008 09:08;6.745,49;6.746,58;6.744,82;6.745,58;0
02.04.2008 09:09;6.745,62;6.745,98;6.741,47;6.741,55;0
02.04.2008 09:10;6.741,58;6.741,73;6.737,21;6.739,85;0
02.04.2008 09:11;6.739,10;6.742,81;6.738,24;6.742,53;0
02.04.2008 09:12;6.742,32;6.742,80;6.740,42;6.741,81;0
02.04.2008 09:13;6.741,84;6.744,78;6.741,84;6.744,60;0
02.04.2008 09:14;6.744,60;6.744,60;6.740,54;6.740,54;0
02.04.2008 09:15;6.740,45;6.740,67;6.736,32;6.737,68;0
02.04.2008 09:16;6.737,72;6.740,68;6.737,45;6.740,11;0
02.04.2008 09:17;6.740,04;6.746,34;6.740,04;6.746,34;0
02.04.2008 09:18;6.746,21;6.750,64;6.746,21;6.749,99;0
02.04.2008 09:19;6.750,61;6.752,95;6.749,07;6.750,69;0
02.04.2008 09:20;6.750,82;6.751,01;6.748,20;6.750,74;0
02.04.2008 09:21;6.750,57;6.752,98;6.748,62;6.752,98;0
02.04.2008 09:22;6.752,74;6.756,24;6.752,74;6.753,84;0
02.04.2008 09:23;6.753,90;6.755,51;6.752,70;6.753,05;0

Thanks in advance for any help!
H.


__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] simple ts.plot question

2009-12-13 Thread Uwe Ligges



arka sinha wrote:

*Respected Sir,

I have a simple question regarding plots of time series in R.

I have to plot "conc" against "time" **for each individual and display in
the same panel for the in-built dataset "Indometh" in R.
*
*I have six time series, say subject1.ts, subject2.ts, .,
subject6.ts.

The observations are taken at an interval of 0.25 hr.
All of the series ranges from 0.25hr to 8.00 hr.
How can I plot all the six time series in the same panel**?*

*I am eagerly waiting for your reply. Thanks in advance.*



See ?ts.plot 

Uwe Ligges



[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] too large dimension problem

2009-12-13 Thread David Winsemius


On Dec 12, 2009, at 11:35 PM, David Winsemius wrote:



On Dec 12, 2009, at 8:31 PM, Moohwan Kim wrote:


Dear R family

When I run the command below, the error message came up. It seems  
like

the problem is about computer capacity.
It would be appreciated if anyone could give me a solution.


You would want __ store such an object, but also to  
 the answer
   ^not just to^
^manipulate it, so^

must be: buy a computer with 500GB of RAM.


Besides the errors in English syntax, for which I have no excuses, I  
also forgot to mention that there are SparseMatrix classes that are  
part of the recommended Matrix package. They may offer a solution in  
more limited memory, depending on the application you have in mind.






###

N <- 415884
tau <- diag(1, N)[c(N, 1:(N - 1)),]

Error in array(0, c(n, p)) : 'dim' specifies too large an array

Best
Moohwan



--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


[R] Repeated Measures Analysis - GLM

2009-12-13 Thread protonringe

Hello to the R world...

I have some problems regarding a GLM - repeated measures analysis. 

I want to test overall differences between AgeClass and Treatment (between
subject) with OpenR1+OpenR2+OpenR3 (repeated measures, within subject).  The
table looks kind like this: 

AgeClassTreatment   OpenR1  OpenR2  OpenR3
1   1   0   0   12.63
1   1   12.67   3.8345.67
1   1   38.46   65.38   75.21
1   1   14.46   0   17.96
1   2   27.83   47.33   66.38
1   2   15.75   0   10.21
1   2   43.96   41.04   51.88
1   2   52.96   55.54   41.58
1   3   43.13   71.25   82.71
1   3   0.2518.46   27.04
1   3   0.7921.75   68.38
2   1   0   0   0
2   1   0   0   0
2   1   1.1718.75   45.67
2   1   0   0   0
2   1   0   0   49.42
2   2   2.130   26.63
2   2   0   8.1323.88
2   2   2.250   0
2   2   30.96   25.71   10.92
2   3   33.33   30.71   16.63
2   3   0   20.04   14.88
2   3   24.96   0   3.88
.
.
.

I tried several things, for example this:
aov(?~(OpenR1*OpenR2*OpenR3*AgeClass*Treatment)+Error(??/(OpenR1*OpenR2*OpenR3))+(AgeClass*Treatment))

I don't really know what response-variable to use, or what the
subject-variable is

There is no problem to create the model with SPSS, but for my Diploma-Thesis
in biology i want to do all the statistics with R... 

Regards and many thanks in advance

Ingo


-- 
View this message in context: 
http://n4.nabble.com/Repeated-Measures-Analysis-GLM-tp963016p963016.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Thomas Mang

HI,

Thanks for your input; see below

On 12/13/2009 4:41 PM, Robert A LaBudde wrote:

I think what you are finding is that calling a grouping variable a
"random effect" is not the same thing as it actually being a random effect.

An effect is really only random when it is chosen randomly. Just because
you don't want to deal with it as a fixed effect (e.g., too many levels)
doesn't mean it qualifies as a random effect. This sloppiness in common
in mixed modeling.


Well to some degree the species were chosen randomly, so there isn't a 
big selection bias in there. I also argue they wouldn't qualify as fixed 
effect (they might as stand-alone fixed effect factor, but definitely 
not as interaction with other predictors - there is no reason to believe 
the impact of predictors is totally independent across species).
Sample size isn't the problem; I truly wouldn't want to include them as 
fixed effect based on expert knowledge.




In your example of student scores, you mentioned the schools were a
random effect, because they were a grouping variable. This is not true.
Schools have a strong fixed effect. They are also not chosen randomly in
your student.

How to resolve your problem? Two methods: 1) Stop modeling the grouping
variable as a random effect, when it's not: Model it as a fixed effect;
2) Do the experiment right: a) List the schools in their population. b)
Chose the schools to be used by random sampling from that population.
Then you will find schools really is a random effect.


1) does not seem to be the right solution.
2) is more interesting in terms of understanding:
Are you saying that it's just the random choice of why something was 
included in the sample is what makes it qualify as random effect ? I 
thought the fact that it is the realization of a random variable (drawn 
from a N(0, sigma) distribution). These are two different things.


Suppose I list all the schools in the population and randomly pick 15. 
IIUC, you would argue now it qualifies as random effect. However, once I 
have chosen my schools I could still investigate the estimated random 
effects coefficients, a posteriori investigate the schools and try to 
find out what discriminates those with students above average from those 
below average. Odds are, if I had the resources to make a thorough 
investigation, I would find something - or in other words, because there 
is something deterministic behind it, I would have said they are not the 
random realization from a normal distribution - which was my 
understanding of properties of random effects so far, but which might be 
wrong and hence the problem (although due to the complexity of this 
deterministic process, they might practically appear as random 
realizations). If I would pick a 16. school and then apply my knowledge 
from the investigations, I could probably say if it will be above or 
below average - this is what, in my understanding of random effects, 
actually would not qualify it as random effect, whereas according to you 
it would, if the school was chosen randomly. Is that correct ?


Suppose I have chosen randomly: Does it make sense to investigate a 
posteriori why the estimates for the random effects are the way the are 
and find insights on the system, or would it not make sense as they are 
assumed complete random realization of a random variable and can be 
anything because they are random variable ?


To some degree I think the issue can also be seen the following way:
Conditional on my extensive knowledge of the school properties, the 
schools are probably not distributed iid. I could have this knowledge 
enter as fixed effect. But since this knowledge is usually not available 
the unconditional distribution might well make them iid N(0, sigma), and 
hence makes the schools qualify as grouping variable for random effects 
(where of course it is assumed that now sampling was done randomly from 
the population).
But what shall I do if I have a bit of the extensive knowledge available 
-> maybe too much to sticking to the complete unconditional iid 
assumption, but also not enough for a sensible conditional distribution 
to allow the specification of a fixed effect ?


thanks
Thomas







What you have discovered is called "selection bias". It is common in
unrandomized studies.


At 09:12 AM 12/13/2009, Thomas Mang wrote:

HI,

Thanks for your response; yes you are right it's not fully on topic,
but I chose this list not only because I am using R for all my stats
and so read it anyway, but also because here many statisticians read too.
Do you know another list where my question is more appropriate ?
For what it's worth, haven't found a local statistician yet to really
answer the question, but I'll continue searching ...

thanks,
Thomas

On 12/13/2009 11:07 AM, Daniel Malter wrote:

Hi, you are unlikely to (or lucky if you) get a response to your
question
from the list. This is a question that you should ask your local
statistician with knowledge in stats

Re: [R] Subtitle & conova post hoc

2009-12-13 Thread Simon . Gingins
Hi, 

first of all thanks a lot for answering (that was very
quick)! 

Sorry but I actually made a spelling mistake, the post hoc
test I want to do (post hoc to a friedman test) is "Conover"
and not "conova". My bad!

Simon


- Original Message -
Expéditeur: David Winsemius 
à: simon.ging...@unil.ch
Cc: r-help@r-project.org
Sujet: Re: [R] Subtitle & conova post hoc
Date: Sun, 13 Dec 2009 09:29:22 -0500

> On Dec 13, 2009, at 8:54 AM, simon.ging...@unil.ch wrote:
> 
> > Hello,
> >
> > I just have two questions I cannot figure out.
> >
> > 1) I would like to have a subtitle just below the main
> > title on my graphs and I cannot figure out how to do
> > this, is it possible? or is it only possible to have it
> at the bottom?
> 
> I generally put a ":" at the end of my title line and then
> "\n" which   forces a linefeed.
> 
> eg:
> plot(1,1)
> title(main="Main Title:\nSub-title;\nsub-sub-title")
> 
> You can often get three lines in the default graphics
> setting, but   some plots may require fiddling with the
> margins.
> 
> >
> > 2) I need to run Conova post hoc test, do you know if it
> > is coded in R? any package I would find this test in?
> 
> Would it have some documentation on the web? Could not
> find any R   documentation with that spelling with
> RSiteSearch("conova").
> 
> 
> >
> > Thank you very much for all the help
> >
> > Have a nice sunday
> >
> > Simon
> >
> 
> David Winsemius, MD
> Heritage Laboratories
> West Hartford, CT
>

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Subtitle & conova post hoc

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 9:53 AM, David Winsemius wrote:



On Dec 13, 2009, at 9:33 AM, Gabor Grothendieck wrote:


Google for
r-help title problem
and read the entire thread for a number of approaches.


This is a minor modification of Gabor's code in that thread that  
shows it is possible to have varying font sizes within the main  
arguments. Unfortunately it also demonstrates that I don't know how  
to create repeating strings properly, but I can live with that  
limitation in my knowledge for now.


I got an offlist question asking if I knew why my code produced 4  
lines in the title. I do and I was expressing annoyance at my  
inability to figure out how to make rep() stop forcing it to be so.  
It's because paste returns a vector of lines when given a 2 element  
vector argument by rep("sub", i-1) when i==2.


 Less perplexing code, and hopefully more pleasant to look at graph,  
might be:


opar <- par(oma = 4 * c(1, 1, 1, 1), no.readonly = TRUE); par(mfrow =  
1:2)

plot(1:3, 9:7)
plot(1:3, 7:9)
for(i in 1:3) title(main = paste(c("", "sub-", "sub-sub-")[i],  #skip  
rep()

   "Title", sep=""),
line = 1-i, outer = TRUE, cex.main=2.5/i )
par(opar)

--
David.


opar <- par(oma = 4 * c(1, 1, 1, 1), no.readonly = TRUE); par(mfrow  
= 1:2)

plot(1:3, 9:7)
plot(1:3, 7:9)
for(i in 1:3) title(main = paste(rep("sub",i-1),"Title", sep="-"),  
line = 3-i, outer = TRUE, cex.main=3/i); par(opar)


--
David.




On Sun, Dec 13, 2009 at 8:54 AM,   wrote:

Hello,

I just have two questions I cannot figure out.

1) I would like to have a subtitle just below the main title
on my graphs and I cannot figure out how to do this, is it
possible? or is it only possible to have it at the bottom?

2) I need to run Conova post hoc test, do you know if it is
coded in R? any package I would find this test in?

Thank you very much for all the help

Have a nice sunday

Simon

__
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 provide commented, minimal, self-contained, reproducible code.



__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Robert A LaBudde
I think what you are finding is that calling a grouping variable a 
"random effect" is not the same thing as it actually being a random effect.


An effect is really only random when it is chosen randomly. Just 
because you don't want to deal with it as a fixed effect (e.g., too 
many levels) doesn't mean it qualifies as a random effect. This 
sloppiness in common in mixed modeling.


In your example of student scores, you mentioned the schools were a 
random effect, because they were a grouping variable. This is not 
true. Schools have a strong fixed effect. They are also not chosen 
randomly in your student.


How to resolve your problem? Two methods: 1) Stop modeling the 
grouping variable as a random effect, when it's not: Model it as a 
fixed effect; 2) Do the experiment right: a) List the schools in 
their population. b) Chose the schools to be used by random sampling 
from that population. Then you will find schools really is a random effect.


What you have discovered is called "selection bias". It is common in 
unrandomized studies.



At 09:12 AM 12/13/2009, Thomas Mang wrote:

HI,

Thanks for your response; yes you are right it's not fully on topic, 
but I chose this list not only because I am using R for all my stats 
and so read it anyway, but also because here many statisticians read too.

Do you know another list where my question is more appropriate ?
For what it's worth, haven't found a local statistician yet to 
really answer the question, but I'll continue searching ...


thanks,
Thomas

On 12/13/2009 11:07 AM, Daniel Malter wrote:

Hi, you are unlikely to (or lucky if you) get a response to your question
from the list. This is a question that you should ask your local
statistician with knowledge in stats and, optimally, your area of inquiry.
The list is (mostly) concerned with solving R rather than statistical
problems.

Best of luck,
Daniel

-
cuncta stricte discussurus
-
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Thomas Mang
Sent: Friday, December 11, 2009 6:19 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] random effects in mixed model not that 'random'

Hi,

I have the following conceptual / interpretative question regarding
random effects:

A mixed effects model was fit on biological data, with observations
coming from different species. There is a clear overall effect of
certain predictors (entering the model as fixed effect), but as
different species react slightly differently, the predictor also enters
the model as random effect and with species as grouping variable. The
resulting model is very fine.

Now comes the tricky part however: I can inspect not only the variance
parameter estimate for the random effect, but also the 'coefficients'
for each species. If I do this, suppose I find out that they make
biologically sense, and maybe actually more sense then they should:
For each species vast biological knowledge is available, regarding
traits etc. So I can link the random effect coefficients to that
knowledge, see the deviation from the generic predictor impact (the
fixed effect) and relate it to the traits of my species.
However I see the following problem with that approach: If I have no
knowledge of the species traits, or the species names are anonymous to
me, it makes sense to treat the species-specific deviations as
realizations of a random variable (principle of exchangeability). Once I
know however the species used in the study and have the biological
knowledge at hand, it does not make so much sense any more; I can
predict whether for that particular species the generic predictor impact
will be amplified, or not. That is, I can predict if more likely the
draw from the assumed normal distribution of the random effects will be
  >  0, or<  0 - which is of course complete contradictory and nonsense if
I assume I have a random draw from a N(0, sigma) distribution.
Integrating the biological knowledge as fixed effect however might be
tremendously difficult, as species traits can sometimes not readily be
quantified in a numeric way.
I could defer issue to the species traits and say, once the species
evolved their traits were drawn randomly from a population. This however
causes problems with ideas of evolution and phylogenetic relationships
among the species.

Maybe my question can be rephrased the following way:
Does it ever make sense to _interpret_ the coefficients of the random
effects for each group and link it to properties of the grouping
variable? The assumption of a realization of a random variable seems to
render that quite problematic. However, this means that the more
ignorant I am , and the less knowledge I have, the more the random
realization seems to become realistic - which is at odds with scientific
investigations.
Suppose the mixed model is one of the famous social sciences studies
analysing pupil results on tests at different schools, with sc

Re: [R] How to control the skewness of a heteroscedastic variable? - A Correction

2009-12-13 Thread Karl-Oskar Lindgren
When going through my earlier post I find a mistake in the example 
that I provided. The correct version is provided below. I also start 
to suspect that my problem is that although the cumulant of a sum of 
independent variable is the sum of the cumulants, the moments of a 
sum is not the sum of the moments. But that might not be the only 
flaw in my application.

Regards,
Karl-Oskar 

#An example:

library(moments)
set.seed(1234)

#create two uncorrelated gamma variates
z1<-rgamma(10,5,scale=sqrt(1/5))
z1<-z1-5*sqrt(1/5)
x1<-rgamma(10,10,scale=sqrt(1/10))
x1<-x1-10*sqrt(1/10)

#create two correlated gamma variates
R<-matrix(c(1,.5,.5,1),2,2)
Y<-cbind(x1,z1)%*%chol(R)
x2<-Y[,1]
z2<-Y[,2]

#create gamma error term
e<-rgamma(10,2,scale=sqrt(1/2))
e<-e-2*sqrt(1/2)

#create the heteroscedasticity functions
h1<-sqrt(.5+.5*x1^2)
h2<-sqrt(.5+.5*x2^2)

#create the heteroscedastic dependent variables
y1<-.5*z1+h1*e
y2<-.5*z2+h2*e

#The 3rd moments of y1 and y2 differ
moment(y1,3,central=T)
moment(y2,3,central=T)

#The moments seem to differ for the two z's
moment(.5*z1,3,central=T)
moment(.5*z2,3,central=T)
moment(h1*e,3,central=T)
moment(h2*e,3,central=T)


#The corr bw z and the het. error terms
#seems to be the same in the two cases
var(h1*e,.5*z1)
var(h2*e,.5*z2)

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Subtitle & conova post hoc

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 9:33 AM, Gabor Grothendieck wrote:


Google for
 r-help title problem
and read the entire thread for a number of approaches.


This is a minor modification of Gabor's code in that thread that shows  
it is possible to have varying font sizes within the main arguments.  
Unfortunately it also demonstrates that I don't know how to create  
repeating strings properly, but I can live with that limitation in my  
knowledge for now.


 opar <- par(oma = 4 * c(1, 1, 1, 1), no.readonly = TRUE); par(mfrow  
= 1:2)

plot(1:3, 9:7)
plot(1:3, 7:9)
for(i in 1:3) title(main = paste(rep("sub",i-1),"Title", sep="-"),  
line = 3-i, outer = TRUE, cex.main=3/i); par(opar)


--
David.




On Sun, Dec 13, 2009 at 8:54 AM,   wrote:

Hello,

I just have two questions I cannot figure out.

1) I would like to have a subtitle just below the main title
on my graphs and I cannot figure out how to do this, is it
possible? or is it only possible to have it at the bottom?

2) I need to run Conova post hoc test, do you know if it is
coded in R? any package I would find this test in?

Thank you very much for all the help

Have a nice sunday

Simon

__
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 provide commented, minimal, self-contained, reproducible code.



__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Subtitle & conova post hoc

2009-12-13 Thread Gabor Grothendieck
Google for
  r-help title problem
and read the entire thread for a number of approaches.

On Sun, Dec 13, 2009 at 8:54 AM,   wrote:
> Hello,
>
> I just have two questions I cannot figure out.
>
> 1) I would like to have a subtitle just below the main title
> on my graphs and I cannot figure out how to do this, is it
> possible? or is it only possible to have it at the bottom?
>
> 2) I need to run Conova post hoc test, do you know if it is
> coded in R? any package I would find this test in?
>
> Thank you very much for all the help
>
> Have a nice sunday
>
> Simon
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Subtitle & conova post hoc

2009-12-13 Thread David Winsemius


On Dec 13, 2009, at 8:54 AM, simon.ging...@unil.ch wrote:


Hello,

I just have two questions I cannot figure out.

1) I would like to have a subtitle just below the main title
on my graphs and I cannot figure out how to do this, is it
possible? or is it only possible to have it at the bottom?


I generally put a ":" at the end of my title line and then "\n" which  
forces a linefeed.


eg:
plot(1,1)
title(main="Main Title:\nSub-title;\nsub-sub-title")

You can often get three lines in the default graphics setting, but  
some plots may require fiddling with the margins.




2) I need to run Conova post hoc test, do you know if it is
coded in R? any package I would find this test in?


Would it have some documentation on the web? Could not find any R  
documentation with that spelling with RSiteSearch("conova").





Thank you very much for all the help

Have a nice sunday

Simon



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


[R] Subtitle & conova post hoc

2009-12-13 Thread Simon . Gingins
Hello,

I just have two questions I cannot figure out.

1) I would like to have a subtitle just below the main title
on my graphs and I cannot figure out how to do this, is it
possible? or is it only possible to have it at the bottom?

2) I need to run Conova post hoc test, do you know if it is
coded in R? any package I would find this test in?

Thank you very much for all the help

Have a nice sunday

Simon

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] code for [[.data.frame

2009-12-13 Thread Guillaume Yziquel

baptiste auguie a écrit :

`[[.data.frame`

and more generally see Rnews Volume 6/4, October 2006 "Accessing the Sources".


HTH,

baptiste


Thank you so much.

Indeed, I've been able to look at the source code of the function from 
the source code of R. But I was quite keen on knowing how to do this 
from the toploop. Thanks a lot.


--
 Guillaume Yziquel
http://yziquel.homelinux.org/

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Thomas Mang

HI,

Thanks for your response; yes you are right it's not fully on topic, but 
I chose this list not only because I am using R for all my stats and so 
read it anyway, but also because here many statisticians read too.

Do you know another list where my question is more appropriate ?
For what it's worth, haven't found a local statistician yet to really 
answer the question, but I'll continue searching ...


thanks,
Thomas

On 12/13/2009 11:07 AM, Daniel Malter wrote:

Hi, you are unlikely to (or lucky if you) get a response to your question
from the list. This is a question that you should ask your local
statistician with knowledge in stats and, optimally, your area of inquiry.
The list is (mostly) concerned with solving R rather than statistical
problems.

Best of luck,
Daniel

-
cuncta stricte discussurus
-
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Thomas Mang
Sent: Friday, December 11, 2009 6:19 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] random effects in mixed model not that 'random'

Hi,

I have the following conceptual / interpretative question regarding
random effects:

A mixed effects model was fit on biological data, with observations
coming from different species. There is a clear overall effect of
certain predictors (entering the model as fixed effect), but as
different species react slightly differently, the predictor also enters
the model as random effect and with species as grouping variable. The
resulting model is very fine.

Now comes the tricky part however: I can inspect not only the variance
parameter estimate for the random effect, but also the 'coefficients'
for each species. If I do this, suppose I find out that they make
biologically sense, and maybe actually more sense then they should:
For each species vast biological knowledge is available, regarding
traits etc. So I can link the random effect coefficients to that
knowledge, see the deviation from the generic predictor impact (the
fixed effect) and relate it to the traits of my species.
However I see the following problem with that approach: If I have no
knowledge of the species traits, or the species names are anonymous to
me, it makes sense to treat the species-specific deviations as
realizations of a random variable (principle of exchangeability). Once I
know however the species used in the study and have the biological
knowledge at hand, it does not make so much sense any more; I can
predict whether for that particular species the generic predictor impact
will be amplified, or not. That is, I can predict if more likely the
draw from the assumed normal distribution of the random effects will be
  >  0, or<  0 - which is of course complete contradictory and nonsense if
I assume I have a random draw from a N(0, sigma) distribution.
Integrating the biological knowledge as fixed effect however might be
tremendously difficult, as species traits can sometimes not readily be
quantified in a numeric way.
I could defer issue to the species traits and say, once the species
evolved their traits were drawn randomly from a population. This however
causes problems with ideas of evolution and phylogenetic relationships
among the species.

Maybe my question can be rephrased the following way:
Does it ever make sense to _interpret_ the coefficients of the random
effects for each group and link it to properties of the grouping
variable? The assumption of a realization of a random variable seems to
render that quite problematic. However, this means that the more
ignorant I am , and the less knowledge I have, the more the random
realization seems to become realistic - which is at odds with scientific
investigations.
Suppose the mixed model is one of the famous social sciences studies
analysing pupil results on tests at different schools, with schools
acting as grouping variable for a random effect intercept. If I have no
knowledge about the schools, the random effect assumption makes sense.
If I however investigate the schools in detail (either a priori or a
posterior), say teaching quality of the teachers, socio-economic status
of the school area etc, it will probably make sense to predict which
ones will have pupils performing above average, and which below average.
However then probably these factors leading me to the predictions should
enter the model as fixed effects, and maybe I don't need and school
random effect any more at all. But this means actually the school
deviation from the global mean is not the realization of a random
variable, but instead the result of something quite deterministic, but
which is usually just unknown, or can only be measured with extreme,
impractical efforts.  So the process might not be random, just because
so little is known about the process, the results appear as if they
would be randomly drawn (from a larger population distribution). Again,
is ignorance / lack of deeper knowledge the key 

Re: [R] help with graphing -- Points in my graph are not apparent, always displayed in steps

2009-12-13 Thread David Winsemius


On Dec 12, 2009, at 7:32 PM, philip robinson wrote:



http://n4.nabble.com/file/n962784/egraph_rules_list_2.png The red  
X's that
are listed above represent data points that have been completely  
ignored in
production of my graph. I know that in a specified sentence length  
there are

variations in number of Conjunctions


You provide no data. This is a guess, therefore. You have used a hist  
call that has a ratio as the argument and were expecting it to be  
interpreted as a formula.



--
View this message in context: 
http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p962784.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Ista Zahn
H Viju,
Automatically breaking _input_ lines  is dangerous, because line
breaks have meaning in R. It sounds to me like you need to use the
Return key to insert line breaks at the appropriate places.

-Ista

On Sat, Dec 12, 2009 at 11:29 PM, Viju Moses  wrote:
> Dear Jorge, Thanks.
>
> But.
>
> (My R console width is set by default at 91, which is fine.
>
> Output for  R>1:120  wraps correctly already. )
>
>
>
> The problem is that when I am typing a command, it does not wrap like it
> does in this email while typing. As I am reach the right border, a
> horizontal scroll bar appears, and as I keep typing further, the initial
> part of the line starts disappearing below the left border of the console.
> So, I am unable to see a long line completely without moving the scroll bar
> right and left.
>
>
>
> From: Jorge Ivan Velez [mailto:jorgeivanve...@gmail.com]
> Sent: Sunday, December 13, 2009 9:09
> To: Viju Moses
> Cc: r-help@r-project.org
> Subject: Re: [R] lines don't wrap. must scroll horizontally to see/edit a
> long line in R GUI
>
>
>
> Hi Viju,
>
>
>
> Here is a suggestion:
>
>
>
> R> options(width = 80)
>
> R> 1:120
>
>
>
> HTH,
>
> Jorge
>
>
>
> On Sat, Dec 12, 2009 at 10:34 PM, Viju Moses <> wrote:
>
> I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have not
> changed Windows settings or R GUI settings much except to change from MDI to
> SDI.
>
> Someone else reported this problem a few months ago:
> https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
> but it wasn't followed up.
>
> I'd change the settings on Preferences, but there's no help explaining the
> various options. (That's another problem, by the way... Is there a link you
> know?)
>
> I guess fixing this would be straightforward. Hope someone who did will
> reply. Thanks.
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>        [[alternative HTML version deleted]]
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] debug an error that incapacitates R?

2009-12-13 Thread Liviu Andronic
Hello
And thank you for the quick answer.

On 12/13/09, Duncan Murdoch  wrote:
>  I think you need to go back to old-fashioned debugging methods. Identify
> the line the triggers the error, by using debug() and single stepping
> through sosInit(), or by adding print() or cat() statements to it (or
> setting tracepoints with trace()), and seeing how many succeed before things
> go bad.
>
Experimenting with browser() and subsequently with the step-through
debug() I managed to identify the first line that triggers the
"invalid connection" error:
doItAndPrint(paste("## Launching RSiteSearch, please be patient.."))



>  Once you see the bad line, it may be obvious what's wrong with it, or you
> may need to ask for help, by putting together a minimal example that
> triggers it.
>
Unfortunately, there is nothing obviously wrong with the call, nor
with the environment. Omitting the line makes the function work in all
my test cases. I will contact John Fox on this.

Thank you
Liviu

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice - 2 graphs per panel with 2 differents colours

2009-12-13 Thread S Devriese
On 12/11/2009 02:03 PM, PtitBleu wrote:
> Hello,
>
> I would like to get a lattice plot of 8 panels (unique(df$fact)=8) with 2
> graphs (df$y1 and df$y2 as a function of df$x) and 1 red point at (500,
> ymax) per panel.
>
> The script below is quite ok but I'm not able to define two different colors
> for the two graphs.
> If you have an idea how to use the "col" function in order to attribute the
> colors, it will be very kind of you to share it with a newbie.
>
> Have a nice week-end,
> Ptit Bleu.
>
>
> x11(15,12)
> xyplot(df$y1 + df$y1/df$coeff ~ df$x | df$fact,
> panel = function(x, y) {
> panel.grid(h=-1, v=-1, col="gray")
> panel.xyplot(x, y, type="p", pch=20)
> panel.points(500, ymax[panel.number()], col="red", pch=20,
> cex=1.6)
> },
>  xlab="X", ylab="Y")
>
>   
If you add '...' to your panel function, it will allow the panel
function to use the info you did not provide explicitly:

panel = function(x, y, ...) {
panel.grid(h=-1, v=-1, col="gray")
panel.xyplot(x, y, type="p", pch=20, ...)
panel.points(500, ymax[panel.number()], col="red", pch=20,
cex=1.6)
},

I tested with:
library(lattice)
tmp <- data.frame(y1=11:20,coeff=1:10,x1=21:30)
xyplot(y1 + y1/coeff ~ x1, data=tmp,
   panel=function(x,y,...) {
 panel.xyplot(x, y, type="p", pch=20, ...)
   }

)

Stephan

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Regularized gamma function/ incomplete gamma function

2009-12-13 Thread Stefan Evert

  Indeed, it seems that the author of zipfR has neither been aware
  that the (scaled / aka regularized) incomplete gamma (and beta,
  for that matter!) functions have been part of R all along.
  ...
  ... well , inspecting his code reveals he did know it.
  But why then on earth provide all the new gamma()
  functions, all trivially defined via pgamma(), qgamma() and
  gamma() ??


Simply so I could write down the original formulas in terms of  
incomplete upper/lower gamma functions, rather than having to wrap my  
head around how they relate to pgamma() each time.  Perhaps overkill  
to export all these functions and document them, I must agree.



I'm a bit shocked by the lack of basic calculus knowledge both
in your question and even more in the answers.


No, we haven't forgotten our basic calculus, or at least not that  
part.   I'm afraid you didn't read the OP's question carefully  
enough.  Amy needs the derivative of the regularised Gamma function  
with respect to the shape parameter (given there as "k"), rather than  
with respect to x.


Wish there was such an easy solution, because that would allow us to  
calculate gradients for faster parameter estimation in zipfR.


Best wishes,
Stefan

__
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 provide commented, minimal, self-contained, reproducible code.


[R] How to control the skewness of a heteroscedastic variable?

2009-12-13 Thread Karl-Oskar Lindgren
Dear listusers,

I don't know whether my problem is statistical or computational, but 
I hope I could recieve some help in either case. 

I'm currently working on a MC-simulation in which I would like to 
control the skewness of a heteroscedastic dependent variable defined 
as:

y=d*z+sqrt(.5+.5*x^2)*e (eq.1)

where d is a parameter and, z, x, and e are gamma r.vs. The variables 
x (the one creating the heteroscedasticity) and z are assumed to be 
positively correlated. 

I thought that since the two terms on the rhs of eq.1 are 
uncorrelated the 3rd central moment of y should equal the sum of the 
3rd central moments of the two terms on the rhs. This seems to be 
correct as long as x and z in eq1 are uncorrelated. But if I make x 
and z correlated the 3rd moment of y exceeds the sum of the 3rd 
moments of the terms on the rhs. 

My problem is that I cannot understand why this is the case (there 
seems to be no linear correlation between z and the multiplicative 
error term). Is it my statistical understanding or my computational 
set-up that is flawed? Basically what I want to do is to control the 
skew of y in eq.1 in my simulations by varying the skew of e. Is that 
possible to do, and if so, how would that best be implemented in R?

The code below provides an illustration of my problem in case my 
verbal explanation was difficult to follow.

Regards,
Karl-Oskar Lindgren
Researcher 
Department of Government
Uppsala University
 
#An example:

library(moments)
set.seed(1234)

#create two uncorrelated gamma variates
z1<-rgamma(10,5,scale=sqrt(1/5))
z1<-z-5*sqrt(1/5)
x1<-rgamma(10,10,scale=sqrt(1/10))
x1<-x1-10*sqrt(1/10)

#create two correlated gamma variates
R<-matrix(c(1,.5,.5,1),2,2)
Y<-cbind(x1,z1)%*%chol(R)
x2<-Y[,1]
z2<-Y[,2]

#create a gamma dist. error term
e<-rgamma(10,2,scale=sqrt(1/2))
e<-e-2*sqrt(1/2)

#create the heteroscedasticity functions
h1<-sqrt(.5+.5*x1^2)
h2<-sqrt(.5+.5*x2^2)

#create the heteroscedastic dependent variables
y1<-.5*z1+h1*e
y2<-.5*z2+h2*e

#The 3rd moments of y1 and y2 differ
moment(y1,3,central=T)
moment(y2,3,central=T)

#But the moments of terms on rhs seem to be the same
moment(.5*z1,3,central=T)
moment(.5*z2,3,central=T)
moment(h1*e,3,central=T)
moment(h2*e,3,central=T)

#The corr bw z and the het. error terms
#seems to be the same in the two cases
var(h1*e,.5*z1)
var(h2*e,.5*z2)

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] debug an error that incapacitates R?

2009-12-13 Thread Duncan Murdoch

On 13/12/2009 5:31 AM, Liviu Andronic wrote:

Dear all
How should I attempt debugging this error?

sosInit()

Error: invalid connection

When this happens R refuses to run anything:

2+2

Error: invalid connection

sessionInfo ()

Error in stdout() : invalid connection


Debugging it seems impossible.

options(error=recover)
sosInit()

Error: invalid connection
Error during wrapup: invalid connection


The error also "crashes" browser().
Browse[1]> n
debug at 
/home/liviu/Devel/Rcmdr-dev/Rcmdr.sos/RcmdrPlugin.sos-0.1-0/R/sosInit.R#51:
doItAndPrint(paste("## Launching RSiteSearch, please be patient.."))
Browse[2]>
Error in function ()  : invalid connection
Error: invalid connection

To reproduce the example, you would need to source the following file [1]. Then
require(Rcmdr)
require(sos)
sosInit()

and in the box enter a string similar to "asdf ; HTMLgrid". If you
enter simple strings such as "asdf", the function will perform as
expected and R will not become non-responsive.
[1] http://s000.tinyupload.com/index.php?file_id=15379960405416742593

Please let me know of any ideas that would help tackle this one. Thank you


I think you need to go back to old-fashioned debugging methods. 
Identify the line the triggers the error, by using debug() and single 
stepping through sosInit(), or by adding print() or cat() statements to 
it (or setting tracepoints with trace()), and seeing how many succeed 
before things go bad.


Once you see the bad line, it may be obvious what's wrong with it, or 
you may need to ask for help, by putting together a minimal example that 
triggers it.


Duncan Murdoch

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] Easily switch between R GUI and R term on Windows?

2009-12-13 Thread Duncan Murdoch

On 12/12/2009 11:16 PM, Viju Moses wrote:

Is there an easy way to switch between R GUI and R terminal? I'm currently
using R GUI 2.10.0 on Windows Vista and would like to see something like the
R terminal found in Linux. But I may also want to switch back to GUI. I
don't remember seeing the terminal option at the R download site, or during
installation. I've set the pager style to SDI, and that has helped partly.
Thanks.



Just run Rterm.exe instead of Rgui.exe.

Duncan Murdoch

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] lines don't wrap. must scroll horizontally to see/edit a long line in R GUI

2009-12-13 Thread Duncan Murdoch

On 12/12/2009 10:34 PM, Viju Moses wrote:

I'm facing this problem on R GUI version 2.10.0 on Windows Vista. I have not
changed Windows settings or R GUI settings much except to change from MDI to
SDI. 

Someone else reported this problem a few months ago: 
https://stat.ethz.ch/pipermail/r-help/2009-April/195714.html
but it wasn't followed up. 


Yes it was, I replied to that message:

Which version are you talking about?  I don't recall Rgui ever wrapping 
input.  The config settings affect output.  Maybe you're thinking of Rterm?


You also don't answer my question.  If you are claiming something has 
changed, you need to tell us how to see the change.


Duncan Murdoch



I'd change the settings on Preferences, but there's no help explaining the
various options. (That's another problem, by the way... Is there a link you
know?)

I guess fixing this would be straightforward. Hope someone who did will
reply. Thanks.

__
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 provide commented, minimal, self-contained, reproducible code.


__
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 provide commented, minimal, self-contained, reproducible code.


[R] debug an error that incapacitates R?

2009-12-13 Thread Liviu Andronic
Dear all
How should I attempt debugging this error?
> sosInit()
Error: invalid connection

When this happens R refuses to run anything:
> 2+2
Error: invalid connection
> sessionInfo ()
Error in stdout() : invalid connection


Debugging it seems impossible.
> options(error=recover)
> sosInit()
Error: invalid connection
Error during wrapup: invalid connection


The error also "crashes" browser().
Browse[1]> n
debug at 
/home/liviu/Devel/Rcmdr-dev/Rcmdr.sos/RcmdrPlugin.sos-0.1-0/R/sosInit.R#51:
doItAndPrint(paste("## Launching RSiteSearch, please be patient.."))
Browse[2]>
Error in function ()  : invalid connection
Error: invalid connection
>

To reproduce the example, you would need to source the following file [1]. Then
require(Rcmdr)
require(sos)
sosInit()

and in the box enter a string similar to "asdf ; HTMLgrid". If you
enter simple strings such as "asdf", the function will perform as
expected and R will not become non-responsive.
[1] http://s000.tinyupload.com/index.php?file_id=15379960405416742593

Please let me know of any ideas that would help tackle this one. Thank you
Liviu


This is a sessionInfo() prior to running the crash-function.
> sessionInfo()
R version 2.10.0 (2009-10-26)
x86_64-pc-linux-gnu

locale:
 [1] LC_CTYPE=en_GB.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.UTF-8LC_COLLATE=en_GB.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_GB.UTF-8
 [7] LC_PAPER=en_GB.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
 [1] datasets  grid  splines   graphics  stats utils grDevices
 [8] tcltk methods   base

other attached packages:
 [1] fortunes_1.3-6   RcmdrPlugin.HH_1.1-25HH_2.1-32
 [4] leaps_2.9multcomp_1.1-2   mvtnorm_0.9-8
 [7] lattice_0.17-26  RcmdrPlugin.sos_0.1-0RcmdrPlugin.Export_0.3-0
[10] Hmisc_3.7-0  survival_2.35-7  xtable_1.5-6
[13] Rcmdr_1.5-4  car_1.2-16   relimp_1.0-1
[16] sos_1.1-7brew_1.0-3   hints_1.0.1-1

loaded via a namespace (and not attached):
[1] cluster_1.12.1

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] random effects in mixed model not that 'random'

2009-12-13 Thread Daniel Malter
Hi, you are unlikely to (or lucky if you) get a response to your question
from the list. This is a question that you should ask your local
statistician with knowledge in stats and, optimally, your area of inquiry.
The list is (mostly) concerned with solving R rather than statistical
problems.

Best of luck,
Daniel

-
cuncta stricte discussurus
-
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Thomas Mang
Sent: Friday, December 11, 2009 6:19 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] random effects in mixed model not that 'random'

Hi,

I have the following conceptual / interpretative question regarding 
random effects:

A mixed effects model was fit on biological data, with observations 
coming from different species. There is a clear overall effect of 
certain predictors (entering the model as fixed effect), but as 
different species react slightly differently, the predictor also enters 
the model as random effect and with species as grouping variable. The 
resulting model is very fine.

Now comes the tricky part however: I can inspect not only the variance 
parameter estimate for the random effect, but also the 'coefficients' 
for each species. If I do this, suppose I find out that they make 
biologically sense, and maybe actually more sense then they should:
For each species vast biological knowledge is available, regarding 
traits etc. So I can link the random effect coefficients to that 
knowledge, see the deviation from the generic predictor impact (the 
fixed effect) and relate it to the traits of my species.
However I see the following problem with that approach: If I have no 
knowledge of the species traits, or the species names are anonymous to 
me, it makes sense to treat the species-specific deviations as 
realizations of a random variable (principle of exchangeability). Once I 
know however the species used in the study and have the biological 
knowledge at hand, it does not make so much sense any more; I can 
predict whether for that particular species the generic predictor impact 
will be amplified, or not. That is, I can predict if more likely the 
draw from the assumed normal distribution of the random effects will be 
 > 0, or < 0 - which is of course complete contradictory and nonsense if 
I assume I have a random draw from a N(0, sigma) distribution. 
Integrating the biological knowledge as fixed effect however might be 
tremendously difficult, as species traits can sometimes not readily be 
quantified in a numeric way.
I could defer issue to the species traits and say, once the species 
evolved their traits were drawn randomly from a population. This however 
causes problems with ideas of evolution and phylogenetic relationships 
among the species.

Maybe my question can be rephrased the following way:
Does it ever make sense to _interpret_ the coefficients of the random 
effects for each group and link it to properties of the grouping 
variable? The assumption of a realization of a random variable seems to 
render that quite problematic. However, this means that the more 
ignorant I am , and the less knowledge I have, the more the random 
realization seems to become realistic - which is at odds with scientific 
investigations.
Suppose the mixed model is one of the famous social sciences studies 
analysing pupil results on tests at different schools, with schools 
acting as grouping variable for a random effect intercept. If I have no 
knowledge about the schools, the random effect assumption makes sense. 
If I however investigate the schools in detail (either a priori or a 
posterior), say teaching quality of the teachers, socio-economic status 
of the school area etc, it will probably make sense to predict which 
ones will have pupils performing above average, and which below average. 
However then probably these factors leading me to the predictions should 
enter the model as fixed effects, and maybe I don't need and school 
random effect any more at all. But this means actually the school 
deviation from the global mean is not the realization of a random 
variable, but instead the result of something quite deterministic, but 
which is usually just unknown, or can only be measured with extreme, 
impractical efforts.  So the process might not be random, just because 
so little is known about the process, the results appear as if they 
would be randomly drawn (from a larger population distribution). Again, 
is ignorance / lack of deeper knowledge the key to using random effects 
- and the more knowledge I have, the less ?

many thanks,
Thomas

__
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 provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project

Re: [R] code for [[.data.frame

2009-12-13 Thread baptiste auguie
`[[.data.frame`

and more generally see Rnews Volume 6/4, October 2006 "Accessing the Sources".


HTH,

baptiste


2009/12/13 Guillaume Yziquel :
> Hello.
>
> I'm currently trying to wrap up data frames into OCaml via OCaml-R, and I'm
> having trouble with data frame subsetting:
>
>> # x#column 1;;
>> Erreur dans (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]]
>> else .subset2(x,  :  l'élément 1 est vide ;
>>  la partie de la liste d'arguments de 'is.matrix' en cours d'évaluation
>> était :
>>  (i)
>
> So I'd like to know what is the code of [[.data.frame. I know how to show
> the code of functions in R (just typing the name of the function), but I'm
> having trouble with [[.data.frame, as it has a special syntacting handling.
>
> Could someone kindly show me how to display the code of [[.data.frame in the
> R toploop?
>
> All the best,
>
> --
>     Guillaume Yziquel
> http://yziquel.homelinux.org/
>
> __
> 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 provide commented, minimal, self-contained, reproducible code.
>

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] A random number from any distribution??

2009-12-13 Thread Peter Dalgaard

ivan popivanov wrote:

Hello,
 
I have some data, and I want to generate random numbers following the distribution of this data (in other words, to generate a synthetic data set sharing the same stats as a given data set). Reading an old thread I found the following text:
 
If you can compute the quantile function of the distribution (i.e., the 
inverse of the integral of the pdf), then you can use the probability 
integral transform: If U is a U(0,1) random variable and Q is the quantile 
function of the distribution F, then Q(U) is a random variable distributed 
as F. 
 
That sounds good, but is there a quick way to do this in R? Let's say my data is contained in "ee", I can get the quantiles using:
 
qq = quantile(ee, probs=(0,1,0.25))
   0%   25%   50%   75%  100% 
-0.2573385519 -0.0041451053  0.0004538924  0.0049276991  0.1037823292
 
Then I "know" how to use the above method to generate Q(U) (by looking up U in the first row, and then mapping it to a number using the second row), but is there an R function that does that? Otherwise I need to write my own to lookup the table.
 
Thanks in advance,

Ivan


Q <- approxfun(x,sort(ee)) with x=(0:(n-1))/(n-1) is your friend, I think.

Beware the details of the interpolation, though, in some variants you 
end up reinventing the bootstrap. Also the fact that your generated 
variables tend to be constrained to the range of ee should at least be 
noted.


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] confint for glm (general linear model)

2009-12-13 Thread Peter Dalgaard

David Winsemius wrote:


On Dec 12, 2009, at 8:19 PM, casperyc wrote:



for an example,


counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9); treatment <- gl(3,3)
glm.D93 <- glm(counts ~ outcome + treatment, family=poisson())
confint(glm.D93)
confint.default(glm.D93)  # based on asymptotic normality

to verify the confidence interval (confint.default(glm.D93))  for 
outcome2


-4.542553e-01 + c(-1,1) * 0.2021708 * qt(0.975,df=4)
-1.0155714  0.1070608

does not give me
outcome2-0.8505027 -0.05800787
as in confint.default(glm.D93)


But this does (up to rounding anyway):

 > coef(summary(glm.D93))[2,1] + c(-1,1) * 
coef(summary(glm.D93))[2,2]*qnorm(0.975)

[1] -0.85050267 -0.05800787

I can understand thinking that the CI's might be t-distributed but the 
usual formulation is that they are normally distributed.






Right, and 4 DF is just plain wrong. There is no "estimated variance" 
for the Poisson distribution like there is in the Gaussian models. E.g., 
it makes sense to calculate a CI for the true log-mean based on a single 
Poisson outcome:


> x <- 50
> confint(glm(x~1, family=poisson))
Waiting for profiling to be done...
   2.5 %   97.5 %
3.621423 4.176967


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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 provide commented, minimal, self-contained, reproducible code.


[R] need a solution to an R-problem: consultant available?

2009-12-13 Thread Andre Zimmermann
I am trying to get confidence bands for a non-linear power function
(y=mx^b).   I thought I should be able to figure it out, but can't.  Are
there any R consultant?  I would be willing to pay some amount of money, but
not sure such consultants exist.  I fit power functions to lots of data, and
this would be very useful.  I would ideally like to have confidence bands
for the mean function and a single prediction.  

I have posted my current Rscript below, with the location of the error
noted, in addition, below the Rscript, is some example data. 

Let me know what you think.

Cheers,

Andre

###RSCIPT STARTS

 

require(graphics)

rm(list=ls()) # clears everything in working directory

data = read.delim("F:/R_code/exampledata.txt")

#head(data) # shows header

 

attach(data) #attaches data to current run

 

datasort=data[order(Stage), ] #sorts data so predicted values follow in
systematic order

 

#datasort # shows sorted data

 

starts = list(const =0.1, alpha = 20)

 

fm <- nls(Discharge ~ const*Stage ^alpha, start=starts) #runs a non linear
least squares regression model 

 

#predict(fm)  # fitted values at observed times

 

#summary(fm)

coef=coefficients(fm)

const_val=round(coef["const"],4) #makes a variable for the equation in the
plot and rounds it to 4 decimal places

exp_val=round(coef["alpha"],4)

plot(Discharge~Stage, 

#xlim=c(min(Stage),max(Stage)), #sets limits of x and y axis
based on max and min in data set

#ylim=c(min(Discharge),max(Discharge)),

xlab="Stage in East Creek", #label of X axis

ylab="Discharge in East Creek Plunge Pool",  # label of y
axis

#xaxs="i",  #fits axis to exact tick mark location, not
standard + 4 %

#yaxs="i", 

log = "xy",

pch=15

)

#adds a legend, exponent should really be up higher, but not sure how to do
this.

legend("bottomright",  ,bty="n", substitute(paste("Discharge", " = ",
const_val, , "Stage^",exp_val),

 list(const_val = const_val, exp_val=exp_val)))

 

tt <- seq(min(Stage),max(Stage), length = 101)

 

points(Stage,fitted.values(fm),type="l")

 

se.fit <- sqrt(apply(attr(predict(fm,list(Stage = tt)),"gradient"),1, 

  function(x) sum(vcov(fm)*outer(x,x

###Above is where the error arrives. dim(X) must have a positive length.
"gradient' data does not get created with the predict function, which is
likely the source of the problem 

matplot(tt, predict(fm,list(Stage = tt))+

   outer(se.fit,qnorm(c(.5, .025,.975))),type="l")  

###example data below


Discharge

Stage


0.069

1.9


0.099

1.93


0.001

1.74


0.001

1.76


0.005

1.71


1.558

2.77


0.44

2.26


0.467

2.25


0.086

1.84


0.012

1.86


0.045

1.93


0.043

1.93


0.05

1.91


0.016

1.84


0.142

2.07


0.656

2.37


0.576

2.33


0.329

2.22


0.321

2.21


0.378

2.24


0.375

2.24


0.132

2.07


0.125

2.07


0.465

2.27

 

 


[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] A random number from any distribution?‏

2009-12-13 Thread ivan popivanov

Hello,
 
I have some data, and I want to generate random numbers following the 
distribution of this data (in other words, to generate a synthetic data set 
sharing the same stats as a given data set). Reading an old thread I found the 
following text:
 
>If you can compute the quantile function of the distribution (i.e., the 
>inverse of the integral of the pdf), then you can use the probability 
>integral transform: If U is a U(0,1) random variable and Q is the quantile 
>function of the distribution F, then Q(U) is a random variable distributed 
>as F. 
 
That sounds good, but is there a quick way to do this in R? Let's say my data 
is contained in "ee", I can get the quantiles using:
 
qq = quantile(ee, probs=(0,1,0.25))
   0%   25%   50%   75%  100% 
-0.2573385519 -0.0041451053  0.0004538924  0.0049276991  0.1037823292
 
Then I "know" how to use the above method to generate Q(U) (by looking up U in 
the first row, and then mapping it to a number using the second row), but is 
there an R function that does that? Otherwise I need to write my own to lookup 
the table.
 
Thanks in advance,
Ivan
  
_


[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


Re: [R] help with graphing -- Points in my graph are not apparent, always displayed in steps

2009-12-13 Thread philip robinson

http://n4.nabble.com/file/n962784/egraph_rules_list_2.png The red X's that
are listed above represent data points that have been completely ignored in
production of my graph. I know that in a specified sentence length there are
variations in number of Conjunctions
-- 
View this message in context: 
http://n4.nabble.com/help-with-graphing-Points-in-my-graph-are-not-apparent-always-displayed-in-steps-tp961629p962784.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


[R] code for [[.data.frame

2009-12-13 Thread Guillaume Yziquel

Hello.

I'm currently trying to wrap up data frames into OCaml via OCaml-R, and 
I'm having trouble with data frame subsetting:



# x#column 1;;
Erreur dans (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else .subset2(x,  : 
  l'élément 1 est vide ;

  la partie de la liste d'arguments de 'is.matrix' en cours d'évaluation était :
  (i)


So I'd like to know what is the code of [[.data.frame. I know how to 
show the code of functions in R (just typing the name of the function), 
but I'm having trouble with [[.data.frame, as it has a special 
syntacting handling.


Could someone kindly show me how to display the code of [[.data.frame in 
the R toploop?


All the best,

--
 Guillaume Yziquel
http://yziquel.homelinux.org/

__
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 provide commented, minimal, self-contained, reproducible code.


[R] A random number from any distribution?

2009-12-13 Thread ivan popivanov

Hello,

 

I have some data, and I want to generate random numbers following the 
distribution of this data (in other words, to generate a synthetic data sets 
having the stats of a give data set). Reading an old thread I found the 
following text:

 

>If you can compute the quantile function of the distribution (i.e., the 
>inverse of the integral of the pdf), then you can use the probability 
>integral transform: If U is a U(0,1) random variable and Q is the quantile 
>function of the distribution F, then Q(U) is a random variable distributed 
>as F. 

 

That sounds good, but is there a quick way to do this in R? Let's say my data 
is contained in "ee", I can get the quantiles using:

 

qq = quantile(ee, probs=(0,1,0.25))

   0%   25%   50%   75%  100% 
-0.2573385519 -0.0041451053  0.0004538924  0.0049276991  0.1037823292

 

Then I "know" how to use the above method to generate Q(U) (by looking up U in 
the first row, and then mapping it to a number using the second row), but is 
there an R function that does that? Otherwise I need to write my own to lookup 
the table.

 

Thanks in advance,

Ivan

 

 

 

 

 

 
  
_



[[alternative HTML version deleted]]

__
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 provide commented, minimal, self-contained, reproducible code.


[R] How to resolve include Rcpp.h problems?

2009-12-13 Thread Amine Jallouli

Hi,
I am Linux Ubuntu 9.04 user. I'm using R-2.6.

Actually, I am developing R package for reading/writing 3D images. I needed
to use  the R package Rcpp in order to make profit of available C/C++ codes.
My problem is that my C code is not able to include the Rcpp.h

In fact, when I run this command R CMD build rply, I got the following error
message in the file /home/amine/R/r-eclipse/rply.Rcheck/00install.out:
* Installing *source* package 'rply' ...
** libs
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c Call_interface.c
-o Call_interface.o
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c C_interface.c -o
C_interface.o
gcc -std=gnu99 -I/usr/share/R/include  -fpic  -g -O2 -c fifrt.c -o
fifrt.o
g++ -I/usr/share/R/include  -fpic  -g -O2 -c RCPP_test.cpp -o
RCPP_test.o
RCPP_test.cpp:1:18: erreur: Rcpp.h : No such file or directory
RCPP_test.cpp: In function ‘SEXPREC* readRIntVec(SEXPREC*)’:
RCPP_test.cpp:14: erreur: ‘RcppVector’ was not declared in this scope
RCPP_test.cpp:14: erreur: expected primary-expression before ‘int’
RCPP_test.cpp:14: erreur: expected `;' before ‘int’
make: *** [RCPP_test.o] Erreur 1
ERROR: compilation failed for package 'rply'
** Removing '/home/amine/R/r-eclipse/rply.Rcheck/rply'

It is evident that I will this error since the file Rcpp.h is not in this
directory /usr/share/R/include .

I tried to solve this include problem by copying the Rcpp.h to
/usr/share/R/include. But, it was not successful and I the following error
message.

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  Unable to load shared library
'/home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so':
  /home/amine/R/r-eclipse/rply.Rcheck/rply/libs/rply.so: undefined symbol:
_ZN10RcppVectorIiEC1EP7SEXPREC
Error in library(rply) : .First.lib has failed for 'rply'
Execution stopped

It looks like this package has a loading problem: see the messages for
details.


Resulting this last error seems to be also logical. In fact, I think the
file libRcpp.so is need for the compilation of my code.

Please notice that the package Rcpp is installed in the following directory:
/usr/lib/R/site-library/Rcpp

Thank you for giving an idea for solving this problem.
-- 
View this message in context: 
http://n4.nabble.com/How-to-resolve-include-Rcpp-h-problems-tp962875p962875.html
Sent from the R help mailing list archive at Nabble.com.

__
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 provide commented, minimal, self-contained, reproducible code.


  1   2   >