[R] geepack installation problem?

2010-05-31 Thread Denis B

Hello R Forum members.

I have installed for my statistician user, apparently without error, both
the concord and geepack packages.   The target system is R 2.10.1 on a
64-bit RedHat Enterprise Linux platform.

However when she attempts to invoke a function in geepack, for example...

geeglm((abuse_total ~ case),id=mother, family=poisson)

the resultant error is

Error: could not find function geeglm

Neither she as a user, nor myself as administrator, can get even help to
work for geepack.  It is almost as though the package is not installed,
regardless that the installation process appeared to complete without error.

I would be grateful of some guidance for her.   I have tried this (R +
geepack) on another Linux-based system (SuSE Enterprise Linux, also 64-bit)
with identical results and I do not see any references to similar issues in
amongst R Forum articles.

Kind regards,
Denis

-- 
View this message in context: 
http://r.789695.n4.nabble.com/geepack-installation-problem-tp2236893p2236893.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] Creating dropout time from longitudinal data with missing data

2010-05-31 Thread john james
Dear R users,
 
Please assist me with the following problem. I have a dataset that looks like 
the following:
 
dat-data.frame(
  'id'=rep(c(1,2,3),each=3),
  'time'=rep(c(1,2,3),3),
  'y'= c(2,2,NA,2,NA,NA,2,5,7)
) 

 
I wish to create a variable for dropout time in dataframe 'dat' such that the 
dropout time is the time to drop out by the subject as follows:
 
 
dat-data.frame(
  'id'=rep(c(1,2,3),each=3),
  'time'=rep(c(1,2,3),3),
  'y'= c(2,2,NA,2,NA,NA,2,5,7),
  'dropout time'=c(2,2,2,1,1,1,3,3,3)
) 

Any help will be appreciated. Many thanks in advance.
 
james


  
[[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] Kalman Filter

2010-05-31 Thread Johann Hibschman
Greigiano Jose Alves alves...@gmail.com writes:

 I am working on an article forecasting, which use the dynamic linear model,
 a model state space. I am wondering all the commands in R, to represent the
 linear dynamic model and Kalman filter.
 I am available for any questions.

There are a few libraries out there, available on CRAN:

  - dlm
  - dse
  - sspir

I tend to use dlm, myself.

Best of luck,
Johann

__
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 on Windows OS

2010-05-31 Thread M.Ribeiro

I received by email an R package (file.tar.gz) that was created in Linux.
The package was already installed in another computer in linux using
install.packages and it worked

I am not familiar with installing packages but I would like to install it on
Windows

I downloaded the Rtools29.exe and tryed to install using

install.packages(foo.tar.gz, repos=NULL, type=source)
but the message was

Warning in install.packages(GR_1.0.tar.gz, repos = NULL, type = source)
:
  argument 'lib' is missing: using 'C:\Documents and Settings\mr\My
Documents/R/win-library/2.9'
'sh' is not recognized as an internal or external command,
operable program or batch file.
Warning message:
In install.packages(GR_1.0.tar.gz, repos = NULL, type = source) :
  installation of package 'GR_1.0.tar.gz' had non-zero exit status

my questios are:

Where shall I save the .tar.gz file??
Do I need to do anything else with the Rtools besides installing
(C:/Rtools)??
Is the problem with the way I did or with the package??

Thanks a lot
Cheers 
-- 
View this message in context: 
http://r.789695.n4.nabble.com/error-on-Windows-OS-tp2236758p2236758.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 run the R script in windows in background mode or script mode?

2010-05-31 Thread jim holtman
It depends on what you C shell scripts are doing.  If they are simply
invoking R, then you can install R, and the required packages, on the
Windows PC and then use batch files under Windows to call your
scripts.  Running R in the background on Windows is not a problem.

On Sat, May 29, 2010 at 9:22 AM, Jie TANG totang...@gmail.com wrote:
 Hello,everyone .
  Now I write some R scripts to calculate some variables and I run them in  C
 shell script command in linux..
 Now my some new R scripts had to be moved in someother's  computer with
 windows system.
 How to run these R scripts easily without installing many soft package?


 --
 TANG Jie
 Email: totang...@gmail.com
 Tel: 0086-2154896104
 Shanghai Typhoon Institute,China

        [[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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] Res: How to use the function glht of multcomp package to test interaction?

2010-05-31 Thread Ivan Allaman

Hi Richard,

First thank you for your attention. Actually
the way it approached the examples of statements do not like a lot,
because the calculations are done separately for each factor of
interest to the interaction. Why will not it pleases me so much? Tukey's tests 
as for example using the mean square error (MSE) for the calculation of minimum 
significant differences (MSD). When
the analysis is done separately, the contrasts are made with the new
model, rather than the original model which contained the interactions. Thus 
the contrasts are different, since they use different MSE. What is your opinion?

 
M.Sc Ivan Bezerra Allaman 
Zootecnista
Doutorando em Produção Animal/Aquicultura - UFLA 
email e msn - ivanala...@yahoo.com.br 
Tel: (35)3826-6608/9925-6428





De: Richard M. Heiberger [via R] ml-node+2236373-99253941-109...@n4.nabble.com

Enviadas: Domingo, 30 de Maio de 2010 13:09:37
Assunto: Re: How to use the function glht of multcomp package to test 
interaction?

Usually you will want to look at simple effects of the factors when there is 
interaction.  Please look at the WoodEnergy demos in the HH package. 
These examples use glht. 

install.packages(HH)  ## if you don't currently have HH 
library(HH) 
demo(MMC.WoodEnergy-aov) 
demo(MMC.WoodEnergy) 

Rich 

[[alternative HTML version deleted]] 

__ 
[hidden email] 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 message @ 
http://r.789695.n4.nabble.com/How-to-use-the-function-glht-of-multcomp-package-to-test-interaction-tp2236315p2236373.html
 
To unsubscribe from How to use the function glht of multcomp package to test 
interaction?, click here. 




-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-use-the-function-glht-of-multcomp-package-to-test-interaction-tp2236315p2236706.html
Sent from the R help mailing list archive at Nabble.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] miss.loc function in MCMC Geneland: can't make it work

2010-05-31 Thread Dzive

I am trying to use the function 'filter.NA=TRUE' in Geneland. The function 
appears to be set on TRUE by default, as it appears as TRUE in the 
'parameter.txt'  file output and hence I do not need to enter the function 
per se (as it is an 'Unused argument otherwise') . Hence all my missing 
data (individuals that I have not yet scored at that specific loci) are 
scored as double null  alleles, this even though I use the default setting 
NA in my 'score matrix'.  I am therefore trying to enter a matrix of  103 
x 9 (103 individual x 9loci) with 0 for real alleles (null or not) and 1 
for non scored alleles called upon using the miss.loc function in MCMC, in 
addition to the 'genotype' and 'coordinate' matrices.  However when 
starting the MCMC, after initialisation of all functions I get this 
message:


list (object) can not be coerced into integer


And the MCMC is stopped. I only get this message when entering the 'null 
allele' matrix and using the miss.loc function in the MCMC.

Any idea what this is about? Here is the command I enter:


library(Geneland)
coord-read.table(path.txt)
geno-read.table(path.txt)
nullal-read.table(path.txt)
dim(nullal)
dim(coord)
dim(geno)
plot(coord,xlab=east,ylab=north,asp=1)


MCMC(coordinates=coord,geno.dip.codom=geno,miss.loc=nullal,delta.coord=0,varnpop=TRUE,npopmax=40,spatial=TRUE,freq.model=Uncorrelated,nit=10,thinning=10,path.mcmc=path_whichever
 
it is/)



Olivier BAGGIANO
PhD Candidate
Australian Rivers Institute
Griffith School of Environment
Griffith University, Nathan Qld 4111
Work: (07) 3735 5359 


-- 
View this message in context: 
http://r.789695.n4.nabble.com/miss-loc-function-in-MCMC-Geneland-can-t-make-it-work-tp2236836p2236836.html
Sent from the R help mailing list archive at Nabble.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] Removing columns from data frame referenced by column index

2010-05-31 Thread suman dhara
Can you suggest me any way to remove a column of a data frame by the column
number,not by the column name.

Thanks,
Suman Dhara

[[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] getting the column name of a data frame

2010-05-31 Thread suman dhara
Sir,
 I want to store the column name of a data frame as a vector and use the
vector to remove a column of the data frame ,if required.


Thanks,
Suman Dhara

[[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] error on Windows OS [SEC=UNCLASSIFIED]

2010-05-31 Thread Augusto.Sanabria

Hi M. Ribeiro,

For Windows you need to download the correct
package (*.zip) not the Linux package. Once the windows
package has been downloaded into a directory,
you can install it directly from the R shell, see
Packages  install packages from local zip files.
Once the package has been installed you can
load it into your session using
Packages  load package
Or library(package_name)

Hope it helps,

Augusto


Augusto Sanabria. MSc, PhD.
Mathematical Modeller
Risk  Impact Analysis Group
Geospatial  Earth Monitoring Division
Geoscience Australia (www.ga.gov.au)
Cnr. Jerrabomberra Av.  Hindmarsh Dr.
Symonston ACT 2601
Ph. (02) 6249-9155






-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of M.Ribeiro
Sent: Monday, 31 May 2010 11:47
To: r-help@r-project.org
Subject: [R] error on Windows OS



I received by email an R package (file.tar.gz) that was created in Linux. The 
package was already installed in another computer in linux using 
install.packages and it worked

I am not familiar with installing packages but I would like to install it on 
Windows

I downloaded the Rtools29.exe and tryed to install using

install.packages(foo.tar.gz, repos=NULL, type=source)
but the message was

Warning in install.packages(GR_1.0.tar.gz, repos = NULL, type = source)
:
  argument 'lib' is missing: using 'C:\Documents and Settings\mr\My 
Documents/R/win-library/2.9' 'sh' is not recognized as an internal or external 
command, operable program or batch file. Warning message: In 
install.packages(GR_1.0.tar.gz, repos = NULL, type = source) :
  installation of package 'GR_1.0.tar.gz' had non-zero exit status

my questios are:

Where shall I save the .tar.gz file??
Do I need to do anything else with the Rtools besides installing (C:/Rtools)?? 
Is the problem with the way I did or with the package??

Thanks a lot
Cheers
--
View this message in context: 
http://r.789695.n4.nabble.com/error-on-Windows-OS-tp2236758p2236758.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.


[R] Post-hoc tests for repeated measures in balanced experimental design

2010-05-31 Thread Thomas Meigen
Hi,

I am performing experiments in the field of visual perception where  
we often apply balanced designs. Within a group of normal subjects,  
we vary different stimulus conditions (like contrast, luminance,  
temporal frequency of stimulation) and derive some psychophysical or  
electrophysiological results from our subjects. Often, the main  
question is to test the effect of these parameters on the recorded  
results.

When switching from Statview (old software on Mac computers, no  
longer supported) to R I learned that the problem is translated  to   
a repeated measures ANOVA via

ano - aov(d$Result~ d$Condition1*d$Condition2 + Error(d$Subject/(d 
$Condition1*d$Condition2), data=d))

However, there are problems in performing post-hoc tests due to the  
intraindividual correlation of the repeated measures data.
So I started intense online searches for a good solution in R, found  
snippets of R-code here and there. One problem was that many  
contributions offered help for the first step to replace the aov  
procedure with a call to lme in the nlme package, but did not  
perform post-hoc tests. Other contributions showed examples with only  
one within-subjects factors. Finally, Achim Zeileis (thanks again!)  
helped me with the following approach.

1.  Use the nlme-Package and calculate a model with both within- 
subjects effects Condition1 and Condition2

library(nlme)
d.lme - lme(Result~ Condition1*Condition2,data=d,random= ~1 | Subject)

2. Finally, the multcomp-Package can be used to perform post-hoc  
tests for  Condition1 and Condition2

library(multcomp)
print(summary(glht(d.lme, linfct=mcp(Condition1=Tukey
print(summary(glht(d.lme, linfct=mcp(Condition2=Tukey

My problems and questions are

1) When applying this solution to my collection of data I found  
several cases where the standard repeated-measures ANOVA showed a  
highly significant effect for both factors, e. g.

ano - aov(d$wPatternPulseSNR~ d$Bedingung*d$Felder + Error(d$VPerson/ 
(d$Bedingung*d$Felder), data=d))

Error: d$VPerson
   Df Sum Sq Mean Sq F value Pr(F)
Residuals 11 458.22   41.66

Error: d$VPerson:d$Bedingung
 Df Sum Sq Mean Sq F valuePr(F)
d$Bedingung  4 364.58   91.14  7.4429 0.0001140 ***
Residuals   44 538.81   12.25

Error: d$VPerson:d$Felder
   Df Sum Sq Mean Sq F valuePr(F)
d$Felder   5 464.17   92.83  8.3957 5.953e-06 ***
Residuals 55 608.16   11.06

but the multcomp-results indicated no significant post-hoc  
differences between any pair of values for both factors (here the  
values for the factor Felder as example)

Fit: lme.formula(fixed = wPatternPulseSNR ~ Bedingung * Felder, data  
= d,
 random = ~1 | VPerson)

Linear Hypotheses:
Estimate Std. Error z value Pr(|z|)
Feld2 - Feld1 == 0  1.897480.84245   2.2520.214
Feld3 - Feld1 == 0  1.413830.84245   1.6780.546
Feld4 - Feld1 == 0  1.489450.84245   1.7680.487
Feld5 - Feld1 == 0 -0.111330.84245  -0.1321.000
Feld6 - Feld1 == 0  0.024720.84245   0.0291.000
Feld3 - Feld2 == 0 -0.483660.84245  -0.5740.993
Feld4 - Feld2 == 0 -0.408030.84245  -0.4840.997
Feld5 - Feld2 == 0 -2.008820.84245  -2.3850.162
Feld6 - Feld2 == 0 -1.872770.84245  -2.2230.227
Feld4 - Feld3 == 0  0.075620.84245   0.0901.000
Feld5 - Feld3 == 0 -1.525160.84245  -1.8100.459
Feld6 - Feld3 == 0 -1.389110.84245  -1.6490.566
Feld5 - Feld4 == 0 -1.600780.84245  -1.9000.402
Feld6 - Feld4 == 0 -1.464730.84245  -1.7390.506
Feld6 - Feld5 == 0  0.136050.84245   0.1611.000
(Adjusted p values reported -- single-step method)


2) So my main question is whether I really applied the correct data  
analysis to the data? Perhaps the discrepancy between the aov-results  
and the lme-results indicate the need to perform the post-hoc tests  
correctly. On the other hand, the difference between a p-value of  
5.953e-06 (aov) and p0.1 (for all pairwise comparisons) simply  
indicates, that I did something wrong...


Best wishes
Thomas


[[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] getting the column name of a data frame

2010-05-31 Thread Albert-Jan Roskam
 df - data.frame(x = runif(10), y = runif(10), z = runif(10))
 colnames - names(df)
 df2 - df[!colnames %in% c(x, y)]
 df2

Cheers!!
Albert-Jan

~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have 
the Romans ever done for us?
~~

--- On Mon, 5/31/10, suman dhara suman.dhar...@gmail.com wrote:


From: suman dhara suman.dhar...@gmail.com
Subject: [R] getting the column name of a data frame
To: r-h...@stat.math.ethz.ch
Date: Monday, May 31, 2010, 7:33 AM


Sir,
I want to store the column name of a data frame as a vector and use the
vector to remove a column of the data frame ,if required.


Thanks,
Suman Dhara

    [[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] Creating dropout time from longitudinal data with missing data

2010-05-31 Thread Dennis Murphy
Hi:

Here are a few ways:

(1) ave():
transform(dat, dropout.time = ave(y, id, FUN = function(x) sum(!is.na(x

(2) same as (1) without the transform() statement:
dat$dropout.time - ave(y, id, FUN = function(x) sum(!is.na(x)))
dat

(3) ddply() in the plyr package:

library(plyr)
snisna - function(x) sum(!is.na(x))
ddply(dat, .(id), transform, dropout.time = snisna(y))

HTH,
Dennis

On Sun, May 30, 2010 at 7:25 PM, john james dnt...@yahoo.com wrote:

 Dear R users,

 Please assist me with the following problem. I have a dataset that looks
 like the following:

 dat-data.frame(
   'id'=rep(c(1,2,3),each=3),
   'time'=rep(c(1,2,3),3),
   'y'= c(2,2,NA,2,NA,NA,2,5,7)
 )


 I wish to create a variable for dropout time in dataframe 'dat' such that
 the dropout time is the time to drop out by the subject as follows:


 dat-data.frame(
   'id'=rep(c(1,2,3),each=3),
   'time'=rep(c(1,2,3),3),
   'y'= c(2,2,NA,2,NA,NA,2,5,7),
   'dropout time'=c(2,2,2,1,1,1,3,3,3)
 )

 Any help will be appreciated. Many thanks in advance.

 james



[[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.


[R] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Kang Min
Hi,

I have a list of 100 data frames, each data frame has 50 obs of 377
variables.

I would like to replace all the NAs with 0 in all the dataframes.
Should I have a for loop for every data frame?

Below is an extract of how the data looks like.

List of 100
$ :'data.frame':50 obs. of  377 variables:
  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTEEX: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTIML: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ADENMA: int [1:50] NA NA NA 2 NA NA NA NA NA NA ...

$ :'data.frame':50 obs. of  377 variables:
  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ...
  ..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ...
  ..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA ...

Thanks.
Kang Min

__
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] running admb from R using system()

2010-05-31 Thread Benedikt Gehr

Hi

I'm trying to run an admb model from R by using the system () command. 
The admb model runs fine when running it from the admb command line or 
when using emacs. However when I try it with system() then R crashes 
every time.
And I tried using the R command line and RGui and in both it crashes. I 
also tried it from different computers.


What I do is I first set the directory where I keep the admb template 
file with the corresponding admb data file and then invoke the system 
command either step by step or directly. I can build the model but when 
executing the model.exe file R crashes.


##
setting the working directory
setwd(Documents and Settings\\Beni User\\Desktop\\Transfer\\Model 
Fournier\\admb models\\simulated data\\stochastic\\pooled age classes)


building the model - this works fine
system('makeadm stocpool')

running the model - makes R crash
system('stoc.exe')
###
or directly lie this:
setwd(Documents and Settings\\Beni User\\Desktop\\Transfer\\Model 
Fournier\\admb models\\simulated data\\stochastic\\pooled age classes)

system(./stocpool) - makes R crash right away

Does anyone know why this happens and how I can make this work?

Thanks a lot for the help!!

cheers

Beni

__
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] store and repeat data based on row names (loop, if statement)

2010-05-31 Thread RCulloch

Hello fellow R users,

I have an issue that has me a little confused - sorry if the subject makes
little sense, I wasn't sure how to refer to this problem. I have a data set
I've extracted from ArcInfo (a section is shown below). It is spatial data,
showing the distance from one ID to another. I want to get the actual 'TO'
ID from the data set (there is no easy way to do this in Arc so I thought I
would try in R). The way to do this is to find the dist = 0 row for an ID
then that is that IDs unique 'TO' code, so if you look down the second
column the highest no. is 4, and A1 = 2, A1.1 = 1, A2 = 4, A2.1 = 3. So I
need to get that data and then put it in a new column that will basically
read A1.1, A1, A2.1, A2, A1.1, A1, A2.1, A2, A1.1, A1, A2.1, A2, A1.1, A1,
A2.1, A2.

If anyone has any hints or tips or places to look I would be most grateful!

Cheers,

Ross


TO  DISTID
1   2.63981 'A1'
2   0  'A1'
3   6.95836 'A1'
4   8.63809 'A1'
1   0  'A1.1'
2   2.63981 'A1.1'
3   8.03071 'A1.1'
4   8.90896 'A1.1'
1   8.90896 'A2'
2   8.63809 'A2'
3   2.85602 'A2'
4   0  'A2'
1   8.03071 'A2.1'
2   6.95836 'A2.1'
3   0  'A2.1'
4   2.85602 A2.1'
-- 
View this message in context: 
http://r.789695.n4.nabble.com/store-and-repeat-data-based-on-row-names-loop-if-statement-tp2236928p2236928.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] about heatmap

2010-05-31 Thread 孟欣
Hi all:
As to the heatmap function, the default style is red and yellow,and red 
refers to low level and yellow refers to high level.
How can I change the style to the contrary: red refers to high level and yellow 
refers to low level?

Thanks a lot!
My best
[[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] Peak Over Threshold values

2010-05-31 Thread Tonja Krueger
Thanks a lot for your help. That’s the time period I was looking for. 

I’ve got one more question: for further analyses I need the respective maximum 
values
within these time periods (between the green and red lines). Preferably in 
combination
with the date the maximum event happened. 

Thank you
in advance, 

Tonja



-Ursprüngliche Nachricht-
Von: William Dunlap wdun...@tibco.com
Gesendet: 27.05.2010 22:13:21
An: Hutchinson,David [PYR] david.hutchin...@ec.gc.ca,Tonja Krueger 
tonja.krue...@web.de
Betreff: RE: [R] Peak Over Threshold values

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap
 Sent: Thursday, May 27, 2010 12:24 PM
 To: Hutchinson,David [PYR]; Tonja Krueger
 Cc: r-help@r-project.org
 Subject: Re: [R] Peak Over Threshold values
 
 Here is another version, loopless, but still
 a bit clumsy (can the call to which be removed?):

Note that avoiding loops is mostly for
the aesthetic effect.  On my aging laptop
the following loopy and vector-growing version
takes 3 seconds on a million-long vector
while the non-loopy one takes 0.22 seconds
(timings done with plot=FALSE).  That is
a nice ratio but not much of a difference.

f0 - function (x = walevel,
startThreshhold = 5.45,
stopThreshhold = 5.3, 
plot = TRUE) 
{
stopifnot(startThreshhold  stopThreshhold)
inRun - FALSE
start - integer()
stop - integer()
for (i in seq_along(x)) {
if (inRun) {
if (x[i]  stopThreshhold) {
stop[length(stop) + 1] - i - 1
inRun - FALSE
}
}
else {
if (x[i]  startThreshhold) {
start[length(start) + 1] - i
inRun - TRUE
}
}
}
if (inRun) 
stop[length(stop) + 1] - length(x)
if (length(stop)  length(start)) 
stop - stop[-1]
if (plot) {
plot(x, cex = 0.5)
abline(h = c(startThreshhold, stopThreshhold))
abline(v = start, col = green)
abline(v = stop, col = red)
}
data.frame(start = start, stop = stop)
}

 
 f - function (x = walevel,
startThreshhold = 5.45,
stopThreshhold = 5.3, 
plot = TRUE) 
 {
 stopifnot(startThreshhold  stopThreshhold)
 isFirstInRun - function(x) c(TRUE, x[-1] != x[-length(x)])
 isLastInRun - function(x) c(x[-1] != x[-length(x)], TRUE)
 isOverStart - x = startThreshhold
 isOverStop - x = stopThreshhold
 possibleStartPt - which(isFirstInRun(isOverStart)  isOverStart)
 possibleStopPt - which(isLastInRun(isOverStop)  isOverStop)
 pts - c(possibleStartPt, possibleStopPt)
 names(pts) - rep(c(start, stop),
 c(length(possibleStartPt), length(possibleStopPt)))
 pts - pts[order(pts)]
 tmp - isFirstInRun(names(pts))
 start - pts[tmp  names(pts) == start]
 stop - pts[tmp  names(pts) == stop]
 if (length(stop)  length(start)) { 
 # i.e., when first downcrossing happens before
 # first upcrossing
 stop - stop[-1]
 }
 if (plot) {
 plot(x, cex = 0.5)
 abline(h = c(startThreshhold, stopThreshhold))
 abline(v = start, col = green)
 abline(v = stop, col = red)
 }
 data.frame(start = start, stop = stop)
 }
 
 # define the data in the original message and call f().
 
 The isFirstInRun and isLastInRun functions do the
 first part of the calculation that rle does and
 avoid the cumsum(diff()) roundtrip that
 cumsum(rle()$lengths) involves and their names
 make it clearer what I'm trying to do.
 
 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 
  Hutchinson,David [PYR]
  Sent: Thursday, May 27, 2010 10:41 AM
  To: Tonja Krueger
  Cc: r-help@r-project.org
  Subject: Re: [R] Peak Over Threshold values
  
  Perhaps not elegant, but does the job
  
  threshold - 5.45
  meetThreshold - walevel = threshold
  
  d - rle(meetThreshold)
  startPos - c(1, 1 + cumsum(d$lengths[-length(d$lengths)]))
  
  abv - which(d$values == TRUE)
  p.o.t - data.frame()
  
  for (i in seq( along = abv ) ) {
a - startPos[abv[i]]
b - a + (d$lengths[abv[i]] - 1)
e - which.max(walevel[a:b])
p.o.t - rbind( p.o.t, data.frame(
 pos = a + e - 1,
 val = walevel[a:b][e]
 ) )
  }
  
  plot (
day,
walevel, type = 'l'
  )
  
  points(
p.o.t$pos,
p.o.t$val,
col = 'red'
  )
  
  abline(h = threshold, lty = 2, col = 'red')
  
  -Original Message-
  From: r-help-boun...@r-project.org 
  [mailto:r-help-boun...@r-project.org] On Behalf Of Tonja Krueger
  Sent: Thursday, May 27, 2010 1:47 AM
  To: Vito Muggeo (UniPa); Clint Bowman
  Cc: r-help@r-project.org
  Subject: [R] Peak Over Threshold values
  
  
 I'm  sorry, but that's not exactly 

Re: [R] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Tal Galili
I would consider trying the plyr package using the llply function.
With something like:

require(plyr)
func - function(xx)
{
xx[is.na(xx)] - 0
return(xx)
}
llply(your.df.list, func)

What I wondering is why you want to do this.


Best,
Tal




Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 31, 2010 at 11:21 AM, Kang Min ngokang...@gmail.com wrote:

 Hi,

 I have a list of 100 data frames, each data frame has 50 obs of 377
 variables.

 I would like to replace all the NAs with 0 in all the dataframes.
 Should I have a for loop for every data frame?

 Below is an extract of how the data looks like.

 List of 100
 $ :'data.frame':50 obs. of  377 variables:
  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTEEX: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTIML: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ADENMA: int [1:50] NA NA NA 2 NA NA NA NA NA NA ...

 $ :'data.frame':50 obs. of  377 variables:
  ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
  ..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ...
  ..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ...
  ..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA ...

 Thanks.
 Kang Min

 __
 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] Linear Discriminant Analysis in R

2010-05-31 Thread Joris Meys
I checked your data. Now I have to get some sense out of your code. You do :
G - vowel_features[15]

cvc_lda - lda(G~ vowel_features[15], data=mask_features,
na.action=na.omit, CV=TRUE)

Firstly, as I suspected, you need to select a column by using
vowel_features[,15] . Mind the comma! Essentially, your data frame is a list
and a matrix. You select by using [x,y] with x being the row number and y
being the column number.

Essentially, your code says :
cvc_lda=lda(vowel_features[,15]~vowel_features[,15]...)

You're modelling a variable on itself which gives an error. What do you want
to do in fact? If I take a look at your first code, it appears as if you
want to do this :

cvc_lda - lda(G~ ., data=mask_features,na.action=na.omit, CV=TRUE)

The dot indicates you want to model G in function of all variables in the
dataset mask_features. Ain't going to work, as the dimensions are completely
wrong.

 dim(mask_features)
[1] 671  52
 dim(vowel_features)
[1] 254  26


For lda, you need a dataset that has following structure :
mydata
groupV1   V2   V3   V4 ...
0   x1y1   z1   q1 ...
1   x2y2   z2   q2 ...
...

So you can do lda(group~V1+V2+V3+V4+..., data=mydata,...)

For example :

# make some random data
x - rep(c(0,1),50)
y1 - rnorm(100,x)
y2 - rnorm(100,1-x)

# combine it in a dataframe
mydata - data.frame(x,y1,y2)
str(mydata) # look at the structure, you should have something similar
head(mydata) # look the values, this shows you whether it all worked

# example of lda function
my.lda - lda(x~y1+y2,data=mydata,CV=T)
summary(my.lda)

Take a look at your data again, and first figure out which data you actually
want to use. Basically, for every observation in G you need a set of linked
observations in some variables. But as it is now, it's impossible to link
one dataframe with the other.

Cheers
Joris

On Sun, May 30, 2010 at 7:00 AM, cobbler_squad la.f...@gmail.com wrote:


 Hi Janis,

 As you have suggested below is the output for the following:

 test.vowel - vowel_features[,1:10]
 test.mask - mask_features[,1:10]
 dput(test.vowel)
 dput(test.mask)

 --- NOTE: outputs are limited

 test_vowel   first 12 columns are all zero (total of 26 columns)
 V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
 10  0  0  0  0  0  0  0  0   0
 20  0  0  0  0  0  0  0  0   0
 30  0  0  0  0  0  0  0  0   0
 40  0  0  0  0  0  0  0  0   0
 50  0  0  0  0  0  0  0  0   0
 60  0  0  0  0  0  0  0  0   0
 70  0  0  0  0  0  0  0  0   0
 80  0  0  0  0  0  0  0  0   0
 90  0  0  0  0  0  0  0  0   0
 10   0  0  0  0  0  0  0  0  0   0

 test_mask (sample output for first 6 columns and 5 rows)

 V1  V2V3  V4
 V5  V6
 1   0.034495155 0.990218632 0.601464511 0.014837676 0.058299799 0.818202398
 2   0.683688879 0.541566798 0.898061753 0.008456439 0.800863858 0.381366477
 3   0.464978895 0.844494807 0.281241401 0.290183593 0.552412608 0.158107894
 4   0.200058599 0.270115497 0.179173377 0.341301213 0.672338934 0.322934948
 5   0.595020534 0.633111358 0.861024861 0.811241462 0.326562913 0.363330793


 dput(test.vowel)
 structure(list(V1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V2 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V5 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V6 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V7 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V8 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V9 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L), V10 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L)), .Names = c(V1, V2, V3, V4, V5,
 V6, V7, V8, V9, V10), class = data.frame, row.names = c(NA,
 -254L))

 dput(test.mask)
 structure(list(V1 = c(0.034495155, 0.683688879, 0.464978895,
 0.877838275, 0.943014871, 0.163438168), V2 = c(0.990218632, 0.541566798,
 0.025567579, 0.159811845, 0.13874224, 0.752357297, 0.669662897,
 0.854803677, 0.28129096, 0.858919573, 0.98992922, 0.980733255,
 0.452405459, 0.376828532, 0.901208552), V3 = c(0.601464511, 0.898061753,
 0.38395498, 0.923324665, 0.529832526, 0.182135661), V4 = c(0.014837676,
 0.166132726, 0.893089168, 0.45962114, 0.018438501, 0.667720635
 ), V5 = c(0.058299799, 0.800863858, 0.552412608, 0.672338934,
 0.185407787, 0.691367432), V6 = c(0.818202398, 0.381366477, 0.158107894,
 0.322934948, 0.363330793, 0.161321704, 

[R] R 2.11.1 is released

2010-05-31 Thread Peter Dalgaard
I've rolled up R-2.11.1.tar.gz a short while ago. This is an update release, 
which fixes a number of mostly minor issues. The most annoying one was probably 
the problem with format.POSIXlt causing C stack overflow on long date vectors. 
See the full list of changes below.

You can get it from

http://cran.r-project.org/src/base/R-2/R-2.11.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you.

Binaries for various platforms will appear in due course.

  For the R Core Team

  Peter Dalgaard

These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:

MD5 (AUTHORS) = ac9746b4845ae81f51cfc99262f5
MD5 (COPYING) = eb723b61539feef013de476e68b5c50a
MD5 (COPYING.LIB) = a6f89e2100d9b6cdffcea4f398e37343
MD5 (FAQ) = 15600c9a568cbfcb72ea074f2bc5bfb3
MD5 (INSTALL) = 70447ae7f2c35233d3065b004aa4f331
MD5 (NEWS) = 32e5abe211dc0a7d13758d576ba20c01
MD5 (ONEWS) = a8c985af5ad5e9c7e0a9f502d07baeb4
MD5 (OONEWS) = 4f004de59e24a52d0f500063b4603bcb
MD5 (R-latest.tar.gz) = 7421108ade3e9223263394b9bbe277ce
MD5 (README) = 433182754c05c2cf7a04ad0da474a1d0
MD5 (RESOURCES) = 020479f381d5f9038dcb18708997f5da
MD5 (THANKS) = f2ccf22f3e20ebaa86f8ee5cc6b0f655
MD5 (R-2/R-2.11.1.tar.gz) = 7421108ade3e9223263394b9bbe277ce


This is the relevant part of the NEWS file:

CHANGES IN R VERSION 2.11.1


NEW FEATURES

o   R CMD INSTALL checks if dependent packages are available early on
in the installation of source packages, thereby giving clearer
error messages.

o   R CMD INSTALL --build now names the file in the format used
for Mac OS X binary files on that platform.

o   BIC() in package stats4 now also works with multiple fitted models,
analogously to AIC().


DEPRECATED  DEFUNCT

o   Use of file extension .C for C++ code in packages is now
deprecated: it has caused problems for some 'make's on
case-insensitive file systems (although it currently works
with the recommended toolkits).


INSTALLATION

o   Command 'gnutar' is preferred to 'tar' when configure sets
TAR.  This is needed on Mac OS 10.6, where the default tar,
bsdtar 2.6.2, has been reported to produce archives with
illegal extensions to tar (according to the POSIX standard).


BUG FIXES

o   The C function mkCharLenCE now no longer reads past 'len' bytes
(unlikely to be a problem except in user code). (PR#14246)

o   On systems without any default LD_LIBRARY_PATH (not even
/usr/local/lib), [DY]LIB_LIBRARY_PATH is now set without a
trailing colon.  (PR#13637)

o   More efficient utf8ToInt() on long multi-byte strings with
many multi-byte characters.  (PR#14262)

o   aggregate.ts() gave platform-depedent results due to rounding
error for ndeltat != 1.

o   package.skeleton() sometimes failed to fix filenames for .R or
.Rd files to start with an alphanumeric.  (PR#14253)
It also failed when only an S4 class without any methods was
defined.  (PR#14280)

o   splinefun(*, method = monoH.FC)  was not quite monotone in rare
cases.  (PR#14215)

o   Rhttpd no longer crashes due to SIGPIPE when the client closes
the connection prematurely.  (PR#14266)

o   format.POSIXlt() could cause a stack overflow and crash when used on
very long vectors.  (PR#14267)

o   Rd2latex() incorrectly escaped special characters in \usage sections.

o   mcnemar.test() could alter the levels (dropping unused levels)
if passed 'x' and 'y' as factors (reported by Greg Snow).

o   Rd2pdf sometimes needed a further pdflatex pass to get
hyperlinked pages correct.

o   interaction() produced malformed results when levels were
duplicated, causing segfaults in split().

o   cut(d, breaks = n)  now also works for Date or POSIXt
argument d.  (PR#14288)

o   memDecompress() could decompress incompletely rare xz-compressed
input due to incorrect documentation of xz utils.  (Report
and patch from Olaf Mersmann.)

o   The S4 initialize() methods for matrix, array, and ts have
been fixed to call validObject(). (PR#14284)

o   R CMD INSTALL now behaves the same way with or without
--no-multiarch on platforms with only one installed
architecture.  (It used to clean the src directory without
--no-multiarch.)

o   [-.data.frame was not quite careful enough in assigning (and
potentially deleting) columns right-to-left. (PR#14263)

o   rbeta(n, a,b) no longer occasionally returns NaN for a  1  b.
(PR#14291)

o   pnorm(x, log.p = TRUE) could return NaN not -Inf for x near
(minus for lower.tail=TRUE) the largest representable number.

o   Compressed data files *.(txt|tab|csv).(gz|bz2|xz) were not
recognized for the list of data topics and hence for packages
using 

[R] What does LOESS stand for?

2010-05-31 Thread Peter Neuhaus

Dear R-community,

maybe someone can help me with this:

I've been using the loess() smoother for quite a while now, and for
the matter of documentation I'd like to resolve the acronym LOESS.
Unfortunately there's no explanation in the help file, and I didn't
get anything convincing from google either.

I know that the predecessor LOWESS stands for Locally Weighted
Scatterplot Smoothing. But what does LOESS stand for, specifically?
Locally Weighted Exponential Scatterplot Smoothing? As far as
I understand LOESS is still a local polynomial regression, so that
would probably make no sense.

Any help appreciated!

Thanks in advance,

Peter

__
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] Comparing multiple columns in matrix

2010-05-31 Thread Noah Silverman
We're running Monte Carlo repeated measures for several groups.

The goal is to determine the number of time each group has the highest
score.

A toy example:

  [,1] [,2] [,3]
   0.1  0.2  0.3
   0.1  0.2  0.3
   0.1  0.2  0.3
   0.1  0.3  0.2
   0.1  0.3  0.2
   0.2  0.3  0.1

For this example:  group 1 was the top 0 times, group 2 was the top 3
times., group 3 was the top 3 times

I can do this with some messy  statements or loops, but am looking for
an easier way.

Any suggestion?

-N

__
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] Comparing multiple columns in matrix

2010-05-31 Thread Dennis Murphy
Hi:

Here's one approach. Let x be your matrix; then
table(apply(x, 1, which.max))

2 3
3 3

If you prefer the result in data frame form, then
 as.data.frame(table(apply(x, 1, which.max)))
  Var1 Freq
123
233

HTH,
Dennis

On Mon, May 31, 2010 at 2:39 AM, Noah Silverman n...@smartmediacorp.comwrote:

 We're running Monte Carlo repeated measures for several groups.

 The goal is to determine the number of time each group has the highest
 score.

 A toy example:

  [,1] [,2] [,3]
   0.1  0.2  0.3
   0.1  0.2  0.3
   0.1  0.2  0.3
   0.1  0.3  0.2
   0.1  0.3  0.2
   0.2  0.3  0.1

 For this example:  group 1 was the top 0 times, group 2 was the top 3
 times., group 3 was the top 3 times

 I can do this with some messy  statements or loops, but am looking for
 an easier way.

 Any suggestion?

 -N

 __
 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] Removing columns from data frame referenced by column index

2010-05-31 Thread sayan dasgupta

data(airquality)
head(airquality)
Suppose you want to remove the 1st and the 3rd column this will do
 airquality[,-c(1,3)]



suman dhara wrote:
 
 Can you suggest me any way to remove a column of a data frame by the
 column
 number,not by the column name.
 
 Thanks,
 Suman Dhara
 
   [[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.
 
 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Removing-columns-from-data-frame-referenced-by-column-index-tp2236906p2237076.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] How to delete the previously saved workspace restored

2010-05-31 Thread Yanwei Tan

Dear all,

I am a new user of R, here I have a question about remove the previous 
restored workspace.  I saved the workspace last time, but R always 
automatically load the workspace when I open it.  I try to remove the 
object and then close R without saving. But next time when I open R, it 
always load the previous workspace. I want to delete the .RData in the 
directory, but I have no clue where is the .RData directory.


The message is Workspace restored from /Users/wei/.RData

How could I avoid from this directory? because there is a dot before, I 
do not know where I can find this file.


Also I already try this command : rm(list=ls())   But R still load the 
previous workspace.


With many thanks for any advice!!

Best,
Wei

__
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] geepack installation problem?

2010-05-31 Thread Peter Ehlers

On 2010-05-31 0:46, Denis B wrote:


Hello R Forum members.

I have installed for my statistician user, apparently without error, both
the concord and geepack packages.   The target system is R 2.10.1 on a
64-bit RedHat Enterprise Linux platform.

However when she attempts to invoke a function in geepack, for example...

geeglm((abuse_total ~ case),id=mother, family=poisson)

the resultant error is

Error: could not find function geeglm

Neither she as a user, nor myself as administrator, can get even help to
work for geepack.  It is almost as though the package is not installed,
regardless that the installation process appeared to complete without error.

I would be grateful of some guidance for her.   I have tried this (R +
geepack) on another Linux-based system (SuSE Enterprise Linux, also 64-bit)
with identical results and I do not see any references to similar issues in
amongst R Forum articles.


Has the package been attached to the search tree?
See Chapter 13 of 'An Introduction to R.

?library
library(geepack)

  -Peter Ehlers

__
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] Post-hoc tests for repeated measures in balanced experimental design

2010-05-31 Thread Thomas Meigen
Dear Dennis,

thank you for your fast response. Perhaps I should have described the  
experimental situation in more detail.

 This tells you that Subject is being treated as a random block  
 factor, and that
 Conditions 1 and 2 are combinations of treatments applied to each  
 subject. In
 other words, this describes a randomized block design, so ordering  
 in time is
 not represented in this model. Moreover, within-subject correlation  
 due to the
 supposed repeated measures is not represented, either.

In each subject we perform one recording for every possible  
combination of values of
both factors Condition1 and Condition2. Ordering in time is
not an issue here, because we do not want to study longitudinal  
changes in
time. On the other hand, as each combination of the 2 conditions was  
applied
in each subject within an experimental session, I thought this must  
be analysed
with a repeated-measures approach.

As an example, the following lines show the beginning of a typical  
result file for
the first 2 subjects A and B

Nr  Subject Condition1  Condition2  Result
1   A   C1a C2a 5.
2   A   C1a C2b 3.
3   A   C1b C2a 3.
4   A   C1b C2b 3.
5   A   C1c C2a 1.
6   A   C1c C2b 4.
7   B   C1a C2a 5.
8   B   C1a C2b 4.
9   B   C1b C2a 3.
10  B   C1b C2b 2.
11  B   C1c C2a 2.
12  B   C1c C2b 3.
...


If this is a randomized block design, which is the best way to  
analyse the effect of the
two factors Condition1 and Condition2 on Result? How to do post-hoc  
tests to see whether
there significant differences, e. g., between C1a and C1b for  
Condition1?

 ano - aov(d$wPatternPulseSNR~ d$Bedingung*d$Felder + Error(d$VPerson/
 (d$Bedingung*d$Felder), data=d))

 Something seems amiss here, too. Where is the time element  
 represented?
 Where is the correlation structure on the supposed repeated  
 measures? I also
 think that you should have Person/Bedingung:Felder as the within- 
 subject error
 term instead

As mentioned above, there is no specific time element, but the  
repeated measures
of the same type of result (here wPatternPulseSNR) under different  
experimental
conditions (here d$Bedingung*d$Felder) should contain the correlation  
structure.
As far as I understood the nomenclature, Bedingung:Felder means a  
different
situation (split-plot) from the situation described above.


 It's entirely possible that the 'significance' seen in the above  
 tests is due to
 an incorrect choice of error term. If Bedingung and Felder  are  
 both applied
 within-subject, then the appropriate error term should be the  
 average within-person
 variance.

 A repeated measures design is structured rather similarly to a  
 split-plot, except
 that in a RM design the within-subject observations are correlated  
 in time and
 therefore the correlation can vary as a function of time - e.g., AR 
 (1), where the
 correlation between observations decreases exponentially with the  
 time gap
 between them. (In contrast, observations at the split-plot level  
 are usually assumed
 to be equi-correlated due to randomization of levels of treatments  
 within subjects.)
 In your case, there is no 'whole-plot/between subject' treatment -  
 everything is at
 the within-subject level.

...


 I don't think you have the right model if this is indeed a repeated  
 measures
 design, but I'll let others weigh in on the subject. As alluded to  
 above, your
 model doesn't seem to represent the time element or the correlation  
 structure
 that one would expect in a repeated measures design. I'd worry about
 getting the model right before proceeding to the multiple comparisons.


Hm, being not an expert in statistics I thank you very much for  
advice and I agree that
the right model is essential. Perhaps my clarification of the data  
might help to
fix this aspect. Everything is at the within-subject level – this  
is exactly true.

Thanks again
Thomas



[[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] What does LOESS stand for?

2010-05-31 Thread Prof Brian Ripley

See http://en.wikipedia.org/wiki/Loess .  It is not an acronym:
the derivation is given in the reference given by ?loess, p.314.


On Mon, 31 May 2010, Peter Neuhaus wrote:


Dear R-community,

maybe someone can help me with this:

I've been using the loess() smoother for quite a while now, and for
the matter of documentation I'd like to resolve the acronym LOESS.
Unfortunately there's no explanation in the help file, and I didn't
get anything convincing from google either.

I know that the predecessor LOWESS stands for Locally Weighted
Scatterplot Smoothing. But what does LOESS stand for, specifically?
Locally Weighted Exponential Scatterplot Smoothing? As far as
I understand LOESS is still a local polynomial regression, so that
would probably make no sense.

Any help appreciated!

Thanks in advance,

Peter


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] error on Windows OS

2010-05-31 Thread Duncan Murdoch

M.Ribeiro wrote:

I received by email an R package (file.tar.gz) that was created in Linux.
The package was already installed in another computer in linux using
install.packages and it worked

I am not familiar with installing packages but I would like to install it on
Windows

I downloaded the Rtools29.exe and tryed to install using

install.packages(foo.tar.gz, repos=NULL, type=source)
but the message was

Warning in install.packages(GR_1.0.tar.gz, repos = NULL, type = source)
:
  argument 'lib' is missing: using 'C:\Documents and Settings\mr\My
Documents/R/win-library/2.9'
  


That's a funny name to use for the library for R 2.10.x, but it's not a 
serious error.

'sh' is not recognized as an internal or external command,
operable program or batch file.
  


That's the one that stopped the install.  Apparently the Rtools bin 
directory is not being found by Windows in your PATH.  The Rtools 
installer can put it there; maybe you should just reinstall Rtools and 
choose that option.

Warning message:
In install.packages(GR_1.0.tar.gz, repos = NULL, type = source) :
  installation of package 'GR_1.0.tar.gz' had non-zero exit status

my questios are:

Where shall I save the .tar.gz file??
  


That doesn't matter, as long as it's a readable directory.

Do I need to do anything else with the Rtools besides installing
(C:/Rtools)??
  


Set the Windows PATH variable.

Is the problem with the way I did or with the package??

  

So far it looks like the Rtools install.

Duncan Murdoch

Thanks a lot
Cheers 



__
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] Building a what list for scan to use

2010-05-31 Thread Alex van der Spek
Using read.table now on large files. Scan should be faster reading and 
parsing the files if a 'what' list is provided.


How would I generate a what list that repeats the the last 4 elements n 
(n=14 or 10 or 8) times?


whatlist=list(Tstamp=,Condition=0,A1=0,B1=0,C1=0,D1=0)

All are numeric, either decimal or hexadecimal.

Thanks in advance,
Alex van der Spek

__
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] missing values in autocorelation

2010-05-31 Thread nuncio m
Hi all,
 I am trying to find the autocorrelation of some time series.  I
have say 100 files, some files have only missing values(-99.99, say). I dont
want to exclude these files as they represent some points in a grid.  But
when the acf command is issued i get an error.
Error in plot.window(...) : need finite 'ylim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

Is this because of all the values in the time series is the same, if so How
can I specify a bad value when the acf command is issued.  Also is it
possible to return a flag(like, -999) of length the maximum lag for acf of
bad grid points so that I can keep the number of files same for input and
output

Thanks
nuncio

-- 
Nuncio.M
Research Scientist
National Center for Antarctic and Ocean research
Head land Sada
Vasco da Gamma
Goa-403804

[[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] accessing a data frame with row names

2010-05-31 Thread e-letter
Readers,

I have entered a file into r:

,column1,column2
row1,0.1,0.2
row2,0.3,0.4

using the command:

dataframe-read.table(/path/to/file.csv,header=T,row.names=1)

When I try the command:

dataframe[,2]

I receive the response:

NULL

I was expecting:

row1 0.2
row2 0.4

What is my error with the syntax please?

Yours,

r251
mandriva2009

__
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] Vegan fisher.alpha error

2010-05-31 Thread Kang Min
Hi,

I have an error with fisher.alpha from the vegan package.

 fisher.alpha(data[[1]])
Error in nlm(Dev.logseries, n.r = n.r, p = p, N = N, hessian =
TRUE, ...) :
  missing value in parameter

I am trying to find fisher alpha for a list of 100 data frames, and I
tried it on individual data frames in the list, which gave me the
error above.
I have every data frame in the same format as the example data BCI,
species as column names and quadrats as row names.

Can anyone explain what the error is about? Thanks a lot.

Kang Min

__
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] Replacing NAs with 0 for a list of data frames

2010-05-31 Thread Kang Min
Thanks, it works except that I had to add xx - as.data.frame(xx)
into func.

I am trying to calculate diversity indices using the vegan package,
and the functions require zeroes instead of NAs.

Thanks.
Kang Min

On May 31, 5:09 pm, Tal Galili tal.gal...@gmail.com wrote:
 I would consider trying the plyr package using the llply function.
 With something like:

 require(plyr)
 func - function(xx)
 {
 xx[is.na(xx)] - 0
 return(xx)}

 llply(your.df.list, func)

 What I wondering is why you want to do this.

 Best,
 Tal

 Contact
 Details:---
 Contact me: tal.gal...@gmail.com |  972-52-7275845
 Read me:www.talgalili.com(Hebrew) |www.biostatistics.co.il(Hebrew) 
 |www.r-statistics.com(English)
 --



 On Mon, May 31, 2010 at 11:21 AM, Kang Min ngokang...@gmail.com wrote:
  Hi,

  I have a list of 100 data frames, each data frame has 50 obs of 377
  variables.

  I would like to replace all the NAs with 0 in all the dataframes.
  Should I have a for loop for every data frame?

  Below is an extract of how the data looks like.

  List of 100
  $ :'data.frame':        50 obs. of  377 variables:
   ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
   ..$ ACTEEX: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
   ..$ ACTIML: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
   ..$ ADENMA: int [1:50] NA NA NA 2 NA NA NA NA NA NA ...

  $ :'data.frame':        50 obs. of  377 variables:
   ..$ ACHRPO: int [1:50] NA NA NA NA NA NA NA NA NA NA ...
   ..$ ACTEEX: int [1:50] NA NA NA NA 2 NA NA NA NA NA ...
   ..$ ACTIML: int [1:50] NA NA NA NA 1 NA NA NA NA NA ...
   ..$ ADENMA: int [1:50] NA NA NA NA NA NA NA NA NA NA ...

  Thanks.
  Kang Min

  __
  r-h...@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-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guidehttp://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] about heatmap

2010-05-31 Thread Joris Meys
Hi,

Take a look at the heatmap.2 function in the library gplots, and the
brewer.pal in the library RColorBrewer. With this combination you have a far
bigger flexibility on the colors and the output, plus you get a colorcoded
legend. There used to be a bug in that function distorting the legend when
breaks with unequal intervals were used, but I've adapted the function
myself to work also in that case. If you need it, feel free to contact me.

Cheers
Joris

On Mon, May 31, 2010 at 9:54 AM, 孟欣 lm_meng...@163.com wrote:

 Hi all:
 As to the heatmap function, the default style is red and yellow,and red
 refers to low level and yellow refers to high level.
 How can I change the style to the contrary: red refers to high level and
 yellow refers to low level?

 Thanks a lot!
 My best
[[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.




-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] error on Windows OS

2010-05-31 Thread Peter Dalgaard

On May 31, 2010, at 12:53 PM, Duncan Murdoch wrote:

 
 That's the one that stopped the install.  Apparently the Rtools bin directory 
 is not being found by Windows in your PATH.  The Rtools installer can put it 
 there; maybe you should just reinstall Rtools and choose that option.

Also notice that installers cannot the PATH settings of a running process. 
I.e., you need to (re)start R after installing Rtools before install.packages 
has a chance of finding the tools.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@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] accessing a data frame with row names

2010-05-31 Thread Gabor Grothendieck
Use read.csv or read.table(..., sep = ,).  Also note that if you
delete the first comma of the header (as in the second example below)
you won't have to specify row.names since it can figure it out from
the fact that there is one fewer column name than data fields.

 Lines - ,column1,column2
+ row1,0.1,0.2
+ row2,0.3,0.4

 read.csv(textConnection(Lines), row.names = 1)
 column1 column2
row1 0.1 0.2
row2 0.3 0.4


 Lines2 - column1,column2
+ row1,0.1,0.2
+ row2,0.3,0.4

 read.csv(textConnection(Lines2))
 column1 column2
row1 0.1 0.2
row2 0.3 0.4


On Mon, May 31, 2010 at 7:23 AM, e-letter inp...@gmail.com wrote:
 Readers,

 I have entered a file into r:

 ,column1,column2
 row1,0.1,0.2
 row2,0.3,0.4

 using the command:

 dataframe-read.table(/path/to/file.csv,header=T,row.names=1)

 When I try the command:

 dataframe[,2]

 I receive the response:

 NULL

 I was expecting:

 row1 0.2
 row2 0.4

 What is my error with the syntax please?

 Yours,

 r251
 mandriva2009

 __
 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] R 2.11.1 is released

2010-05-31 Thread Dr. David Kirkby

On 05/31/10 10:16 AM, Peter Dalgaard wrote:

I've rolled up R-2.11.1.tar.gz a short while ago. This is an update release, 
which fixes a number of mostly minor issues. The most annoying one was probably 
the problem with format.POSIXlt causing C stack overflow on long date vectors. 
See the full list of changes below.



 CHANGES IN R VERSION 2.11.1


INSTALLATION

 o   Command 'gnutar' is preferred to 'tar' when configure sets
 TAR.  This is needed on Mac OS 10.6, where the default tar,
 bsdtar 2.6.2, has been reported to produce archives with
 illegal extensions to tar (according to the POSIX standard).


Note 'gnutar' is not part of POSIX, so this might cause more problems than it 
solves.


On Solaris, /usr/sfw/bin/gtar is the GNU version of tar, though I don't know for 
sure if one can guarantee that will always be on all Solaris systems. It is 
certainly the case of a full-install on Solaris 10 on SPARC, and I find that 
file exists on my OpenSolaris 06/2009 x64 release running on my Sun Ultra 27, 
though whether it actually exists on a system which has not had it specifically 
installed I don't know.


I would have thought the best decision was to get people to put a working 
version of 'tar' in their path first - not use some non-standard name.


Dave

__
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] Building a what list for scan to use

2010-05-31 Thread Duncan Murdoch

On 31/05/2010 7:07 AM, Alex van der Spek wrote:
Using read.table now on large files. Scan should be faster reading and 
parsing the files if a 'what' list is provided.


How would I generate a what list that repeats the the last 4 elements n 
(n=14 or 10 or 8) times?


whatlist=list(Tstamp=,Condition=0,A1=0,B1=0,C1=0,D1=0)

All are numeric, either decimal or hexadecimal.

  


Do it like this:

n - 14
indices - c(1,2, rep(3:6, n))
biglist - whatlist[indices]


This repeats the names too; if you want new names for the repeated 
columns, you can reassign the names afterwards, e.g.


names(biglist) - paste(name, 1:(2+4*n))

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] accessing a data frame with row names

2010-05-31 Thread Ivan Calandra

Hi,

Let's create your data.frame:
 dataframe - structure(list(column1 = c(0.1, 0.3), column2 = c(0.2, 
0.4)), .Names = c(column1,

column2), row.names = c(row1, row2), class = data.frame)
 dataframe[,2]
[1] 0.2 0.4
 dataframe[,2, drop=FALSE]
 column2
row1 0.2
row2 0.4

So I don't know what's wrong with your data.
Maybe, providing the output from str(dataframe) would help us to help you!

HTH,
Ivan

Le 5/31/2010 13:23, e-letter a écrit :

Readers,

I have entered a file into r:

,column1,column2
row1,0.1,0.2
row2,0.3,0.4

using the command:

dataframe-read.table(/path/to/file.csv,header=T,row.names=1)

When I try the command:

dataframe[,2]

I receive the response:

NULL

I was expecting:

row1 0.2
row2 0.4

What is my error with the syntax please?

Yours,

r251
mandriva2009

__
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.

   


--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

__
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] What does LOESS stand for?

2010-05-31 Thread Joris Meys
This is the paper on which the loess algorithm is based in general:
http://www.econ.pdx.edu/faculty/KPL/readings/cleveland88.pdf

The explanation about the origin of the term LOESS is given on page 597.

Cheers
Joris

On Mon, May 31, 2010 at 11:33 AM, Peter Neuhaus pneuh...@pneuhaus.dewrote:

 Dear R-community,

 maybe someone can help me with this:

 I've been using the loess() smoother for quite a while now, and for
 the matter of documentation I'd like to resolve the acronym LOESS.
 Unfortunately there's no explanation in the help file, and I didn't
 get anything convincing from google either.

 I know that the predecessor LOWESS stands for Locally Weighted
 Scatterplot Smoothing. But what does LOESS stand for, specifically?
 Locally Weighted Exponential Scatterplot Smoothing? As far as
 I understand LOESS is still a local polynomial regression, so that
 would probably make no sense.

 Any help appreciated!

 Thanks in advance,

 Peter

 __
 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.




-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] R 2.11.1 is released

2010-05-31 Thread Peter Dalgaard

On May 31, 2010, at 1:38 PM, Dr. David Kirkby wrote:

 On 05/31/10 10:16 AM, Peter Dalgaard wrote:
 
 CHANGES IN R VERSION 2.11.1
 
 
 INSTALLATION
 
 o   Command 'gnutar' is preferred to 'tar' when configure sets
 TAR.  This is needed on Mac OS 10.6, where the default tar,
 bsdtar 2.6.2, has been reported to produce archives with
 illegal extensions to tar (according to the POSIX standard).
 
 Note 'gnutar' is not part of POSIX, so this might cause more problems than it 
 solves.
 
 On Solaris, /usr/sfw/bin/gtar is the GNU version of tar, though I don't know 
 for sure if one can guarantee that will always be on all Solaris systems. It 
 is certainly the case of a full-install on Solaris 10 on SPARC, and I find 
 that file exists on my OpenSolaris 06/2009 x64 release running on my Sun 
 Ultra 27, though whether it actually exists on a system which has not had it 
 specifically installed I don't know.
 
 I would have thought the best decision was to get people to put a working 
 version of 'tar' in their path first - not use some non-standard name.
 

(Please don't put my address on things that are meant to be discussed on 
r-help. I just wrap up the releases, it's not like I make decisions about $TAR 
personally.)

Anyways, if you had been in this game for as long as R Core has, you would know 
that the best decision is never to get people to do anything. They just 
don't. 

Notice that it says that gnutar is preferred, so all we are doing is to say 
that when it is there, we know what it is, warts and all, POSIX or not, and we 
will rather use it than whatever modified version the OS designers may have put 
in as the system tar.


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@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] missing values in autocorelation

2010-05-31 Thread Joris Meys
Could you specify the problem and give a minimal example that represents
your datastructure and reproduces the error? See also the posting guides :
http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html

Cheers
Joris

On Mon, May 31, 2010 at 1:12 PM, nuncio m nunci...@gmail.com wrote:

 Hi all,
 I am trying to find the autocorrelation of some time series.  I
 have say 100 files, some files have only missing values(-99.99, say). I
 dont
 want to exclude these files as they represent some points in a grid.  But
 when the acf command is issued i get an error.
 Error in plot.window(...) : need finite 'ylim' values
 In addition: Warning messages:
 1: In min(x) : no non-missing arguments to min; returning Inf
 2: In max(x) : no non-missing arguments to max; returning -Inf

 Is this because of all the values in the time series is the same, if so How
 can I specify a bad value when the acf command is issued.  Also is it
 possible to return a flag(like, -999) of length the maximum lag for acf of
 bad grid points so that I can keep the number of files same for input and
 output

 Thanks
 nuncio

 --
 Nuncio.M
 Research Scientist
 National Center for Antarctic and Ocean research
 Head land Sada
 Vasco da Gamma
 Goa-403804

[[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.




-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] after updating biomaRt cannot connect any more

2010-05-31 Thread mauede
I recently updated R  2.10.1 Patched (2010-02-20 r51163)
This morning I reinstalled biomaRt using biocLite.
Now I can no more connect to biomaRt and even the following instruction is 
hanging  for a while until
the same error message pops up.
 listMarts()
Error in value[[3L]](cond) : 
  Request to BioMart web service failed. Verify if you are still connected to 
the internet.  Alternatively the BioMart web service is temporarily down.

I checked my command syntax  and got the following message:
 library(help=biomaRt)
Warning messages:
1: package 'JavaGD' was built under R version 2.9.0 and help may not work 
correctly 
2: package 'Biobase' was built under R version 2.9.0 and help may not work 
correctly 
3: package 'Biostrings' was built under R version 2.9.0 and help may not work 
correctly 
4: package 'IRanges' was built under R version 2.9.0 and help may not work 
correctly 
5: package 'CORNA' was built under R version 2.9.0 and help may not work 
correctly 
6: package 'GEOquery' was built under R version 2.9.0 and help may not work 
correctly 
7: package 'microRNA' was built under R version 2.9.0 and help may not work 
correctly 
8: package 'Rlibstree' was built under R version 2.9.0 and help may not work 
correctly 
 
I am stuck.
Which packages am I supposed to install again ?  Maybe shall I get rid of R  
2.10.1 Patched 
and restart from scratch ?

Thank you in advance.
Maura







tutti i telefonini TIM!


[[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] about heatmap

2010-05-31 Thread Jorge Ivan Velez
Hi there,

Take a look at
http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/r/heatmap/

HTH,
Jorge


On Mon, May 31, 2010 at 3:54 AM, 孟欣  wrote:

 Hi all:
 As to the heatmap function, the default style is red and yellow,and red
 refers to low level and yellow refers to high level.
 How can I change the style to the contrary: red refers to high level and
 yellow refers to low level?

 Thanks a lot!
 My best
[[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 delete the previously saved workspace restored

2010-05-31 Thread David Winsemius


On May 31, 2010, at 5:10 AM, Yanwei Tan wrote:


Dear all,

I am a new user of R, here I have a question about remove the  
previous restored workspace.  I saved the workspace last time, but R  
always automatically load the workspace when I open it.  I try to  
remove the object and then close R without saving. But next time  
when I open R, it always load the previous workspace. I want to  
delete the .RData in the directory, but I have no clue where is  
the .RData directory.


The message is Workspace restored from /Users/wei/.RData


It tells you that it is in the /Users/wei/ directory.



How could I avoid from this directory? because there is a dot  
before, I do not know where I can find this file.


Also I already try this command : rm(list=ls())   But R still load  
the previous workspace.


What OS? MacOSX? You can turn on showing dotted files which are by  
default hidden. Or you could open a Terminal window and issue the  
command


 rm /Users/wei/.RData

You could alternatively exit and save after rm(list=ls()) which would  
create an empty workspace which should load very quickly.




With many thanks for any advice!!

Best,
Wei



--
David Winsemius, MD
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] read in data file into R

2010-05-31 Thread Benedikt Gehr

Hi
I'm trying to read a data file with output from another program (admb) 
into R for further analysis. However I'm not very successfull. The file 
extension for the data file is file.rep but it also doesn't help when I 
change it to file.txt


I have two problems/questions:

1.  The file is a single line of n values separated by a single space 
tab each. These values represent a time series of length n. How can I 
make a numeric vector with this data?
When I use the read.table command and read in the file R produces a 
list of as many objects as there are values (n). However what I need is 
a vector of length n in order to work with the data. When I try to 
coerce the list into a single vector using as.vector this doesn't work.
When I specify sep=\n then I get a list where all the n values are 
treated as one value and I cant extract single values.


2. And related to the issue above: When I have a data file which 
consists of two objects, one is a matrix and the other one is a vector. 
Can I read the file into R all at once as a list with 2 objects and then 
extract the matrix and the vector and work with them? Or is it necessary 
to first make two files, for each object one?


Below I have copied a subset of my data files for ilustration. This 
seems a very silly question but I just didn't manage to to it.

Thanks a lot for the help

cheers

beni

This is a subset of my data file for 1.:

Time series of reconstructed populations
3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53 1884.61 
1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47 2091.67 2091.54 
2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 1826.31 1654.25 1593.84 
1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 1570.15 1723.21 1755.3 
1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 2246.67 2101.16 2134.39 
2018.1 2174.04 


This is a subset of the data file for 2.:
Reconstructed population
203.026 200.005 205.206 217.36 279.415 750.965
495.041 91.3615 162.004 147.748 156.499 492.444
463.284 222.768 74.0028 116.643 106.379 303.677
468.042 208.478 180.442 53.282 83.9828 194.375
460.216 210.619 168.867 129.918 38.3631 135.857
461.88 207.097 170.601 121.584 93.5413 80.3142
474.857 207.846 167.749 122.833 87.5406 98.5
479.117 213.686 168.355 120.779 88.4396 101.233
480.269 215.603 173.085 121.216 86.961 102.94
483.206 216.121 174.638 124.622 87.2753 102.538
486.657 217.443 175.058 125.739 89.7275 102.608
490.516 218.996 176.128 126.042 90.5324 104.401
494.019 220.732 177.386 126.813 90.7501 105.676
497.345 222.308 178.793 127.718 91.305 106.327
500.797 223.805 180.07 128.731 91.9571 106.979
504.331 225.359 181.282 129.65 92.6863 107.701
507.892 226.949 182.54 130.523 93.3482 108.507
511.458 228.551 183.829 131.429 93.9768 109.296
515.039 230.156 185.127 132.357 94.629 110.054
518.65 231.767 186.426 133.291 95.2967 110.818
522.291 233.393 187.732 134.227 95.9696 111.595
525.957 235.031 189.048 135.167 96.6434 112.381
529.648 236.681 190.375 136.115 97.32 113.171
533.364 238.342 191.711 137.07 98.0025 113.964
537.106 240.014 193.057 138.032 98.6905 114.763
541.61 241.698 194.411 139.001 99.3832 115.569
545.435 243.725 195.775 139.976 100.081 116.38
549.312 245.446 197.417 140.958 100.783 117.197
553.294 247.19 198.811 142.14 101.49 118.019
557.349 248.982 200.224 143.144 102.341 118.847

time series of the reconstructed population
1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61 1180.07 
1188.4 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01 1249.76 1258.54 
1267.36 1276.25 1285.21 1294.23 1303.31 1312.45 1321.66 1331.67 1341.37 
1351.11 1360.94 1370.89


__
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] read in data file into R

2010-05-31 Thread jim holtman
Try using 'scan' to read in the data:

 x - scan(textConnection(3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 
 2083.72 1797.53 1884.61 1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 
 2325.47 2091.67 2091.54 2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 
 1826.31 1654.25 1593.84 1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 
 1570.15 1723.21 1755.3 1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 2246.67 
 2101.16 2134.39 2018.1 2174.04 ), what=0)
Read 47 items
 closeAllConnections()

 x
 [1] 3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53
1884.61 1946.59 2101.66 2220.03 2080.04 2097.07
[15] 2332.90 2325.47 2091.67 2091.54 2072.38 2025.31 1919.54 1781.95
1867.96 1685.12 1826.31 1654.25 1593.84 1430.96
[29] 1539.89 1587.35 1472.32 1737.02 1510.37 1570.15 1723.21 1755.30
1843.85 1829.20 1880.63 1916.79 1945.86 2096.64
[43] 2246.67 2101.16 2134.39 2018.10 2174.04



On Mon, May 31, 2010 at 9:47 AM, Benedikt Gehr benedikt.g...@ieu.uzh.ch wrote:
 Hi
 I'm trying to read a data file with output from another program (admb) into
 R for further analysis. However I'm not very successfull. The file extension
 for the data file is file.rep but it also doesn't help when I change it to
 file.txt

 I have two problems/questions:

 1.  The file is a single line of n values separated by a single space tab
 each. These values represent a time series of length n. How can I make a
 numeric vector with this data?
 When I use the read.table command and read in the file R produces a list
 of as many objects as there are values (n). However what I need is a vector
 of length n in order to work with the data. When I try to coerce the list
 into a single vector using as.vector this doesn't work.
 When I specify sep=\n then I get a list where all the n values are treated
 as one value and I cant extract single values.

 2. And related to the issue above: When I have a data file which consists of
 two objects, one is a matrix and the other one is a vector. Can I read the
 file into R all at once as a list with 2 objects and then extract the matrix
 and the vector and work with them? Or is it necessary to first make two
 files, for each object one?

 Below I have copied a subset of my data files for ilustration. This seems a
 very silly question but I just didn't manage to to it.
 Thanks a lot for the help

 cheers

 beni

 This is a subset of my data file for 1.:

 Time series of reconstructed populations
 3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53 1884.61
 1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47 2091.67 2091.54
 2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 1826.31 1654.25 1593.84
 1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 1570.15 1723.21 1755.3
 1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 2246.67 2101.16 2134.39
 2018.1 2174.04 

 This is a subset of the data file for 2.:
 Reconstructed population
 203.026 200.005 205.206 217.36 279.415 750.965
 495.041 91.3615 162.004 147.748 156.499 492.444
 463.284 222.768 74.0028 116.643 106.379 303.677
 468.042 208.478 180.442 53.282 83.9828 194.375
 460.216 210.619 168.867 129.918 38.3631 135.857
 461.88 207.097 170.601 121.584 93.5413 80.3142
 474.857 207.846 167.749 122.833 87.5406 98.5
 479.117 213.686 168.355 120.779 88.4396 101.233
 480.269 215.603 173.085 121.216 86.961 102.94
 483.206 216.121 174.638 124.622 87.2753 102.538
 486.657 217.443 175.058 125.739 89.7275 102.608
 490.516 218.996 176.128 126.042 90.5324 104.401
 494.019 220.732 177.386 126.813 90.7501 105.676
 497.345 222.308 178.793 127.718 91.305 106.327
 500.797 223.805 180.07 128.731 91.9571 106.979
 504.331 225.359 181.282 129.65 92.6863 107.701
 507.892 226.949 182.54 130.523 93.3482 108.507
 511.458 228.551 183.829 131.429 93.9768 109.296
 515.039 230.156 185.127 132.357 94.629 110.054
 518.65 231.767 186.426 133.291 95.2967 110.818
 522.291 233.393 187.732 134.227 95.9696 111.595
 525.957 235.031 189.048 135.167 96.6434 112.381
 529.648 236.681 190.375 136.115 97.32 113.171
 533.364 238.342 191.711 137.07 98.0025 113.964
 537.106 240.014 193.057 138.032 98.6905 114.763
 541.61 241.698 194.411 139.001 99.3832 115.569
 545.435 243.725 195.775 139.976 100.081 116.38
 549.312 245.446 197.417 140.958 100.783 117.197
 553.294 247.19 198.811 142.14 101.49 118.019
 557.349 248.982 200.224 143.144 102.341 118.847

 time series of the reconstructed population
 1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61 1180.07 1188.4
 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01 1249.76 1258.54 1267.36
 1276.25 1285.21 1294.23 1303.31 1312.45 1321.66 1331.67 1341.37 1351.11
 1360.94 1370.89

 __
 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to 

Re: [R] read in data file into R

2010-05-31 Thread Ivan Calandra

Hi,

For your first question, scan() might do what you want.
I have never used it, but if I understood it well, it should do what 
you're looking for. See ?scan

I would separate your 2nd file.

But someone else more competent probably knows a better way for both 
questions


HTH,
Ivan

Le 5/31/2010 15:47, Benedikt Gehr a écrit :

Hi
I'm trying to read a data file with output from another program (admb) 
into R for further analysis. However I'm not very successfull. The 
file extension for the data file is file.rep but it also doesn't help 
when I change it to file.txt


I have two problems/questions:

1.  The file is a single line of n values separated by a single space 
tab each. These values represent a time series of length n. How can I 
make a numeric vector with this data?
When I use the read.table command and read in the file R produces a 
list of as many objects as there are values (n). However what I need 
is a vector of length n in order to work with the data. When I try to 
coerce the list into a single vector using as.vector this doesn't work.
When I specify sep=\n then I get a list where all the n values are 
treated as one value and I cant extract single values.


2. And related to the issue above: When I have a data file which 
consists of two objects, one is a matrix and the other one is a 
vector. Can I read the file into R all at once as a list with 2 
objects and then extract the matrix and the vector and work with them? 
Or is it necessary to first make two files, for each object one?


Below I have copied a subset of my data files for ilustration. This 
seems a very silly question but I just didn't manage to to it.

Thanks a lot for the help

cheers

beni

This is a subset of my data file for 1.:

Time series of reconstructed populations
3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53 
1884.61 1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47 2091.67 
2091.54 2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 1826.31 
1654.25 1593.84 1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 
1570.15 1723.21 1755.3 1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 
2246.67 2101.16 2134.39 2018.1 2174.04 


This is a subset of the data file for 2.:
Reconstructed population
203.026 200.005 205.206 217.36 279.415 750.965
495.041 91.3615 162.004 147.748 156.499 492.444
463.284 222.768 74.0028 116.643 106.379 303.677
468.042 208.478 180.442 53.282 83.9828 194.375
460.216 210.619 168.867 129.918 38.3631 135.857
461.88 207.097 170.601 121.584 93.5413 80.3142
474.857 207.846 167.749 122.833 87.5406 98.5
479.117 213.686 168.355 120.779 88.4396 101.233
480.269 215.603 173.085 121.216 86.961 102.94
483.206 216.121 174.638 124.622 87.2753 102.538
486.657 217.443 175.058 125.739 89.7275 102.608
490.516 218.996 176.128 126.042 90.5324 104.401
494.019 220.732 177.386 126.813 90.7501 105.676
497.345 222.308 178.793 127.718 91.305 106.327
500.797 223.805 180.07 128.731 91.9571 106.979
504.331 225.359 181.282 129.65 92.6863 107.701
507.892 226.949 182.54 130.523 93.3482 108.507
511.458 228.551 183.829 131.429 93.9768 109.296
515.039 230.156 185.127 132.357 94.629 110.054
518.65 231.767 186.426 133.291 95.2967 110.818
522.291 233.393 187.732 134.227 95.9696 111.595
525.957 235.031 189.048 135.167 96.6434 112.381
529.648 236.681 190.375 136.115 97.32 113.171
533.364 238.342 191.711 137.07 98.0025 113.964
537.106 240.014 193.057 138.032 98.6905 114.763
541.61 241.698 194.411 139.001 99.3832 115.569
545.435 243.725 195.775 139.976 100.081 116.38
549.312 245.446 197.417 140.958 100.783 117.197
553.294 247.19 198.811 142.14 101.49 118.019
557.349 248.982 200.224 143.144 102.341 118.847

time series of the reconstructed population
1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61 1180.07 
1188.4 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01 1249.76 1258.54 
1267.36 1276.25 1285.21 1294.23 1303.31 1312.45 1321.66 1331.67 
1341.37 1351.11 1360.94 1370.89


__
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.



--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php

__
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] read in data file into R

2010-05-31 Thread Peter Ehlers

On 2010-05-31 7:47, Benedikt Gehr wrote:

Hi
I'm trying to read a data file with output from another program (admb)
into R for further analysis. However I'm not very successfull. The file
extension for the data file is file.rep but it also doesn't help when I
change it to file.txt

I have two problems/questions:

1. The file is a single line of n values separated by a single space tab
each. These values represent a time series of length n. How can I make a
numeric vector with this data?
When I use the read.table command and read in the file R produces a
list of as many objects as there are values (n). However what I need is
a vector of length n in order to work with the data. When I try to
coerce the list into a single vector using as.vector this doesn't work.
When I specify sep=\n then I get a list where all the n values are
treated as one value and I cant extract single values.


Use scan().



2. And related to the issue above: When I have a data file which
consists of two objects, one is a matrix and the other one is a vector.
Can I read the file into R all at once as a list with 2 objects and then
extract the matrix and the vector and work with them? Or is it necessary
to first make two files, for each object one?


I would go the two-files route.

  -Peter Ehlers



Below I have copied a subset of my data files for ilustration. This
seems a very silly question but I just didn't manage to to it.
Thanks a lot for the help

cheers

beni

This is a subset of my data file for 1.:

Time series of reconstructed populations
3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53 1884.61
1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47 2091.67 2091.54
2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 1826.31 1654.25 1593.84
1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 1570.15 1723.21 1755.3
1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 2246.67 2101.16 2134.39
2018.1 2174.04 

This is a subset of the data file for 2.:
Reconstructed population
203.026 200.005 205.206 217.36 279.415 750.965
495.041 91.3615 162.004 147.748 156.499 492.444
463.284 222.768 74.0028 116.643 106.379 303.677
468.042 208.478 180.442 53.282 83.9828 194.375
460.216 210.619 168.867 129.918 38.3631 135.857
461.88 207.097 170.601 121.584 93.5413 80.3142
474.857 207.846 167.749 122.833 87.5406 98.5
479.117 213.686 168.355 120.779 88.4396 101.233
480.269 215.603 173.085 121.216 86.961 102.94
483.206 216.121 174.638 124.622 87.2753 102.538
486.657 217.443 175.058 125.739 89.7275 102.608
490.516 218.996 176.128 126.042 90.5324 104.401
494.019 220.732 177.386 126.813 90.7501 105.676
497.345 222.308 178.793 127.718 91.305 106.327
500.797 223.805 180.07 128.731 91.9571 106.979
504.331 225.359 181.282 129.65 92.6863 107.701
507.892 226.949 182.54 130.523 93.3482 108.507
511.458 228.551 183.829 131.429 93.9768 109.296
515.039 230.156 185.127 132.357 94.629 110.054
518.65 231.767 186.426 133.291 95.2967 110.818
522.291 233.393 187.732 134.227 95.9696 111.595
525.957 235.031 189.048 135.167 96.6434 112.381
529.648 236.681 190.375 136.115 97.32 113.171
533.364 238.342 191.711 137.07 98.0025 113.964
537.106 240.014 193.057 138.032 98.6905 114.763
541.61 241.698 194.411 139.001 99.3832 115.569
545.435 243.725 195.775 139.976 100.081 116.38
549.312 245.446 197.417 140.958 100.783 117.197
553.294 247.19 198.811 142.14 101.49 118.019
557.349 248.982 200.224 143.144 102.341 118.847

time series of the reconstructed population
1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61 1180.07
1188.4 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01 1249.76 1258.54
1267.36 1276.25 1285.21 1294.23 1303.31 1312.45 1321.66 1331.67 1341.37
1351.11 1360.94 1370.89



__
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 delete the previously saved workspace restored

2010-05-31 Thread Joris Meys
If you start R, type :

unlink(.RData)

This deletes the workspace file.
Cheers
Joris

On Mon, May 31, 2010 at 11:10 AM, Yanwei Tan t...@nbio.uni-heidelberg.dewrote:

 Dear all,

 I am a new user of R, here I have a question about remove the previous
 restored workspace.  I saved the workspace last time, but R always
 automatically load the workspace when I open it.  I try to remove the object
 and then close R without saving. But next time when I open R, it always load
 the previous workspace. I want to delete the .RData in the directory, but I
 have no clue where is the .RData directory.

 The message is Workspace restored from /Users/wei/.RData

 How could I avoid from this directory? because there is a dot before, I do
 not know where I can find this file.

 Also I already try this command : rm(list=ls())   But R still load the
 previous workspace.

 With many thanks for any advice!!

 Best,
 Wei

 __
 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.




-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] read in data file into R

2010-05-31 Thread David Winsemius


On May 31, 2010, at 9:47 AM, Benedikt Gehr wrote:


Hi
I'm trying to read a data file with output from another program  
(admb) into R for further analysis. However I'm not very  
successfull. The file extension for the data file is file.rep but it  
also doesn't help when I change it to file.txt


I have two problems/questions:

1.  The file is a single line of n values separated by a single  
space tab each. These values represent a time series of length n.  
How can I make a numeric vector with this data?


?scan

You will also need to read about connections:

?connections

When I use the read.table command and read in the file R produces  
a list of as many objects as there are values (n). However what I  
need is a vector of length n in order to work with the data. When I  
try to coerce the list into a single vector using as.vector this  
doesn't work.
When I specify sep=\n then I get a list where all the n values are  
treated as one value and I cant extract single values.


2. And related to the issue above: When I have a data file which  
consists of two objects, one is a matrix and the other one is a  
vector. Can I read the file into R all at once as a list with 2  
objects and then extract the matrix and the vector and work with  
them? Or is it necessary to first make two files, for each object one?


It would be much simpler to adopt the second strategy.



Below I have copied a subset of my data files for ilustration. This  
seems a very silly question but I just didn't manage to to it.

Thanks a lot for the help

cheers

beni

This is a subset of my data file for 1.:

Time series of reconstructed populations
3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53  
1884.61 1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47  
2091.67 2091.54 2072.38 2025.31 1919.54 1781.95 1867.96 1685.12  
1826.31 1654.25 1593.84 1430.96 1539.89 1587.35 1472.32 1737.02  
1510.37 1570.15 1723.21 1755.3 1843.85 1829.2 1880.63 1916.79  
1945.86 2096.64 2246.67 2101.16 2134.39 2018.1 2174.04 


This is a subset of the data file for 2.:
Reconstructed population
203.026 200.005 205.206 217.36 279.415 750.965
495.041 91.3615 162.004 147.748 156.499 492.444
463.284 222.768 74.0028 116.643 106.379 303.677
468.042 208.478 180.442 53.282 83.9828 194.375
460.216 210.619 168.867 129.918 38.3631 135.857
461.88 207.097 170.601 121.584 93.5413 80.3142
474.857 207.846 167.749 122.833 87.5406 98.5
479.117 213.686 168.355 120.779 88.4396 101.233
480.269 215.603 173.085 121.216 86.961 102.94
483.206 216.121 174.638 124.622 87.2753 102.538
486.657 217.443 175.058 125.739 89.7275 102.608
490.516 218.996 176.128 126.042 90.5324 104.401
494.019 220.732 177.386 126.813 90.7501 105.676
497.345 222.308 178.793 127.718 91.305 106.327
500.797 223.805 180.07 128.731 91.9571 106.979
504.331 225.359 181.282 129.65 92.6863 107.701
507.892 226.949 182.54 130.523 93.3482 108.507
511.458 228.551 183.829 131.429 93.9768 109.296
515.039 230.156 185.127 132.357 94.629 110.054
518.65 231.767 186.426 133.291 95.2967 110.818
522.291 233.393 187.732 134.227 95.9696 111.595
525.957 235.031 189.048 135.167 96.6434 112.381
529.648 236.681 190.375 136.115 97.32 113.171
533.364 238.342 191.711 137.07 98.0025 113.964
537.106 240.014 193.057 138.032 98.6905 114.763
541.61 241.698 194.411 139.001 99.3832 115.569
545.435 243.725 195.775 139.976 100.081 116.38
549.312 245.446 197.417 140.958 100.783 117.197
553.294 247.19 198.811 142.14 101.49 118.019
557.349 248.982 200.224 143.144 102.341 118.847

time series of the reconstructed population
1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61  
1180.07 1188.4 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01  
1249.76 1258.54 1267.36 1276.25 1285.21 1294.23 1303.31 1312.45  
1321.66 1331.67 1341.37 1351.11 1360.94 1370.89


Pop1 - scan(textConnection(3709.17 2660.93 2045.36 2090.33 2096.93  
2205.65 2083.72 1797.53 1884.61 1946.59 2101.66 2220.03 2080.04  
2097.07 2332.9 2325.47 2091.67 2091.54 2072.38 2025.31 1919.54 1781.95  
1867.96 1685.12 1826.31 1654.25 1593.84 1430.96 1539.89 1587.35  
1472.32 1737.02 1510.37 1570.15 1723.21 1755.3 1843.85 1829.2 1880.63  
1916.79 1945.86 2096.64 2246.67 2101.16 2134.39 2018.1 2174.04 \n\n))

#Read 47 items

Pop.2 - scan(textConnection(203.026 200.005 205.206 217.36 279.415  
750.965

495.041 91.3615 162.004 147.748 156.499 492.444
463.284 222.768 74.0028 116.643 106.379 303.677
468.042 208.478 180.442 53.282 83.9828 194.375
460.216 210.619 168.867 129.918 38.3631 135.857
461.88 207.097 170.601 121.584 93.5413 80.3142
474.857 207.846 167.749 122.833 87.5406 98.5
479.117 213.686 168.355 120.779 88.4396 101.233
480.269 215.603 173.085 121.216 86.961 102.94
483.206 216.121 174.638 124.622 87.2753 102.538
486.657 217.443 175.058 125.739 89.7275 102.608
490.516 218.996 176.128 126.042 90.5324 104.401
494.019 220.732 177.386 126.813 90.7501 105.676
497.345 222.308 178.793 127.718 91.305 106.327
500.797 223.805 180.07 128.731 91.9571 106.979
504.331 

Re: [R] read in data file into R

2010-05-31 Thread jim holtman
Here is the answer to your second part.  You can use the one file and
look for some type of indicator between each section.  I used the
example you sent:

 input - readLines('/temp/tempxx.txt')
Warning message:
In readLines(/temp/tempxx.txt) :
  incomplete final line found on '/temp/tempxx.txt'
 matrix.start - grep(^Recon, input)
 vector.start - grep(^time, input)
 # now read in the matrix
 my.matrix - read.table(textConnection(input[(matrix.start + 1):(vector.start 
 - 1)]))
 my.matrix - as.matrix(my.matrix)
 str(my.matrix)
 num [1:30, 1:6] 203 495 463 468 460 ...
 - attr(*, dimnames)=List of 2
  ..$ : NULL
  ..$ : chr [1:6] V1 V2 V3 V4 ...
 # read in the vector
 my.vector - scan(textConnection(tail(input, -vector.start)), what=0)
Read 30 items
 str(my.vector)
 num [1:30] 1856 1545 1287 1189 1144 ...


On Mon, May 31, 2010 at 9:47 AM, Benedikt Gehr benedikt.g...@ieu.uzh.ch wrote:
 Hi
 I'm trying to read a data file with output from another program (admb) into
 R for further analysis. However I'm not very successfull. The file extension
 for the data file is file.rep but it also doesn't help when I change it to
 file.txt

 I have two problems/questions:

 1.  The file is a single line of n values separated by a single space tab
 each. These values represent a time series of length n. How can I make a
 numeric vector with this data?
 When I use the read.table command and read in the file R produces a list
 of as many objects as there are values (n). However what I need is a vector
 of length n in order to work with the data. When I try to coerce the list
 into a single vector using as.vector this doesn't work.
 When I specify sep=\n then I get a list where all the n values are treated
 as one value and I cant extract single values.

 2. And related to the issue above: When I have a data file which consists of
 two objects, one is a matrix and the other one is a vector. Can I read the
 file into R all at once as a list with 2 objects and then extract the matrix
 and the vector and work with them? Or is it necessary to first make two
 files, for each object one?

 Below I have copied a subset of my data files for ilustration. This seems a
 very silly question but I just didn't manage to to it.
 Thanks a lot for the help

 cheers

 beni

 This is a subset of my data file for 1.:

 Time series of reconstructed populations
 3709.17 2660.93 2045.36 2090.33 2096.93 2205.65 2083.72 1797.53 1884.61
 1946.59 2101.66 2220.03 2080.04 2097.07 2332.9 2325.47 2091.67 2091.54
 2072.38 2025.31 1919.54 1781.95 1867.96 1685.12 1826.31 1654.25 1593.84
 1430.96 1539.89 1587.35 1472.32 1737.02 1510.37 1570.15 1723.21 1755.3
 1843.85 1829.2 1880.63 1916.79 1945.86 2096.64 2246.67 2101.16 2134.39
 2018.1 2174.04 

 This is a subset of the data file for 2.:
 Reconstructed population
 203.026 200.005 205.206 217.36 279.415 750.965
 495.041 91.3615 162.004 147.748 156.499 492.444
 463.284 222.768 74.0028 116.643 106.379 303.677
 468.042 208.478 180.442 53.282 83.9828 194.375
 460.216 210.619 168.867 129.918 38.3631 135.857
 461.88 207.097 170.601 121.584 93.5413 80.3142
 474.857 207.846 167.749 122.833 87.5406 98.5
 479.117 213.686 168.355 120.779 88.4396 101.233
 480.269 215.603 173.085 121.216 86.961 102.94
 483.206 216.121 174.638 124.622 87.2753 102.538
 486.657 217.443 175.058 125.739 89.7275 102.608
 490.516 218.996 176.128 126.042 90.5324 104.401
 494.019 220.732 177.386 126.813 90.7501 105.676
 497.345 222.308 178.793 127.718 91.305 106.327
 500.797 223.805 180.07 128.731 91.9571 106.979
 504.331 225.359 181.282 129.65 92.6863 107.701
 507.892 226.949 182.54 130.523 93.3482 108.507
 511.458 228.551 183.829 131.429 93.9768 109.296
 515.039 230.156 185.127 132.357 94.629 110.054
 518.65 231.767 186.426 133.291 95.2967 110.818
 522.291 233.393 187.732 134.227 95.9696 111.595
 525.957 235.031 189.048 135.167 96.6434 112.381
 529.648 236.681 190.375 136.115 97.32 113.171
 533.364 238.342 191.711 137.07 98.0025 113.964
 537.106 240.014 193.057 138.032 98.6905 114.763
 541.61 241.698 194.411 139.001 99.3832 115.569
 545.435 243.725 195.775 139.976 100.081 116.38
 549.312 245.446 197.417 140.958 100.783 117.197
 553.294 247.19 198.811 142.14 101.49 118.019
 557.349 248.982 200.224 143.144 102.341 118.847

 time series of the reconstructed population
 1855.98 1545.1 1286.75 1188.6 1143.84 1135.02 1159.33 1171.61 1180.07 1188.4
 1197.23 1206.61 1215.38 1223.8 1232.34 1241.01 1249.76 1258.54 1267.36
 1276.25 1285.21 1294.23 1303.31 1312.45 1321.66 1331.67 1341.37 1351.11
 1360.94 1370.89

 __
 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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
R-help@r-project.org 

Re: [R] How to delete the previously saved workspace restored

2010-05-31 Thread jim holtman
The easiest way (I use WIndows) is to start each session without
loading the previous workspace.  I explicitly save what I need and
then explicitly restore it.  In most cases, I always reconstruct the
data I need.

I use the '--no-restore --no-save' options.

On Mon, May 31, 2010 at 10:04 AM, Joris Meys jorism...@gmail.com wrote:
 If you start R, type :

 unlink(.RData)

 This deletes the workspace file.
 Cheers
 Joris

 On Mon, May 31, 2010 at 11:10 AM, Yanwei Tan 
 t...@nbio.uni-heidelberg.dewrote:

 Dear all,

 I am a new user of R, here I have a question about remove the previous
 restored workspace.  I saved the workspace last time, but R always
 automatically load the workspace when I open it.  I try to remove the object
 and then close R without saving. But next time when I open R, it always load
 the previous workspace. I want to delete the .RData in the directory, but I
 have no clue where is the .RData directory.

 The message is Workspace restored from /Users/wei/.RData

 How could I avoid from this directory? because there is a dot before, I do
 not know where I can find this file.

 Also I already try this command : rm(list=ls())   But R still load the
 previous workspace.

 With many thanks for any advice!!

 Best,
 Wei

 __
 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.




 --
 Joris Meys
 Statistical Consultant

 Ghent University
 Faculty of Bioscience Engineering
 Department of Applied mathematics, biometrics and process control

 Coupure Links 653
 B-9000 Gent

 tel : +32 9 264 59 87
 joris.m...@ugent.be
 ---
 Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] store and repeat data based on row names (loop, if statement)

2010-05-31 Thread jim holtman
try this:

 x - read.table(textConnection(TO  DISTID
+ 1   2.63981 'A1'
+ 2   0  'A1'
+ 3   6.95836 'A1'
+ 4   8.63809 'A1'
+ 1   0  'A1.1'
+ 2   2.63981 'A1.1'
+ 3   8.03071 'A1.1'
+ 4   8.90896 'A1.1'
+ 1   8.90896 'A2'
+ 2   8.63809 'A2'
+ 3   2.85602 'A2'
+ 4   0  'A2'
+ 1   8.03071 'A2.1'
+ 2   6.95836 'A2.1'
+ 3   0  'A2.1'
+ 4   2.85602 'A2.1'), header=TRUE, as.is=TRUE)
 closeAllConnections()
 indx - subset(x, DIST == 0)
 x$newCol - indx$ID[match(x$TO, indx$TO)]


 x
   TODIST   ID newCol
1   1 2.63981   A1   A1.1
2   2 0.0   A1 A1
3   3 6.95836   A1   A2.1
4   4 8.63809   A1 A2
5   1 0.0 A1.1   A1.1
6   2 2.63981 A1.1 A1
7   3 8.03071 A1.1   A2.1
8   4 8.90896 A1.1 A2
9   1 8.90896   A2   A1.1
10  2 8.63809   A2 A1
11  3 2.85602   A2   A2.1
12  4 0.0   A2 A2
13  1 8.03071 A2.1   A1.1
14  2 6.95836 A2.1 A1
15  3 0.0 A2.1   A2.1
16  4 2.85602 A2.1 A2



On Mon, May 31, 2010 at 3:28 AM, RCulloch ross.cull...@dur.ac.uk wrote:

 Hello fellow R users,

 I have an issue that has me a little confused - sorry if the subject makes
 little sense, I wasn't sure how to refer to this problem. I have a data set
 I've extracted from ArcInfo (a section is shown below). It is spatial data,
 showing the distance from one ID to another. I want to get the actual 'TO'
 ID from the data set (there is no easy way to do this in Arc so I thought I
 would try in R). The way to do this is to find the dist = 0 row for an ID
 then that is that IDs unique 'TO' code, so if you look down the second
 column the highest no. is 4, and A1 = 2, A1.1 = 1, A2 = 4, A2.1 = 3. So I
 need to get that data and then put it in a new column that will basically
 read A1.1, A1, A2.1, A2, A1.1, A1, A2.1, A2, A1.1, A1, A2.1, A2, A1.1, A1,
 A2.1, A2.

 If anyone has any hints or tips or places to look I would be most grateful!

 Cheers,

 Ross


 TO      DIST    ID
 1       2.63981 'A1'
 2       0                  'A1'
 3       6.95836 'A1'
 4       8.63809 'A1'
 1       0                  'A1.1'
 2       2.63981 'A1.1'
 3       8.03071 'A1.1'
 4       8.90896 'A1.1'
 1       8.90896 'A2'
 2       8.63809 'A2'
 3       2.85602 'A2'
 4       0                  'A2'
 1       8.03071 'A2.1'
 2       6.95836 'A2.1'
 3       0                  'A2.1'
 4       2.85602 A2.1'
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/store-and-repeat-data-based-on-row-names-loop-if-statement-tp2236928p2236928.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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

__
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] two questions about PLOT

2010-05-31 Thread Jie TANG
here ,I want to plot two lines in one figure.But I have two problems
1) how to move one of the y-axis to be the right ? I tried to the
commandaxis(2),But I failed.
2) how to add the axis information correctly.Since I have use the cmommand
axis(1,at=1:6,labels=gradeinfo$gradenam)
   but it seems that the correct information that I want is superposition
with the old axis information.What can i do ?
the script and figure is shown as below .thanks .:)

outflnm-paste(Outdic,meansd.jpg,sep=/)
jpeg(file=outflnm, bg=transparent)
legend-c(average error,stand quare error)
lgcol-c(black,red1)
par(las=1)
yylab-c(forecast error)
xxlab-c(typhoon class)
llty-c(1,3)
llwd-c(4,4)
#par(bg='yellow')


plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab)
par(new=T)
plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4)
#axis(2, col = gold, lty = 2, lwd = 0.5)
legend(topright, legend,   lty=llty, lwd=llwd,col =lgcol)
axis(1,at=1:6,labels=gradeinfo$gradenam)
dev.off()

-- 
TANG Jie
Email: totang...@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China
__
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] Y-axis range in histograms

2010-05-31 Thread Aarne Hovi

Hi,

I'm trying to create a histogram with R. The problem is that the frequency
is high for a couple of x-axis categories (e.g. 1500) and low for most of
the x-axis categories (e.g. 50)  
http://r.789695.n4.nabble.com/file/n2237476/LK3_hist.jpg . When I create the
histogram, it is not very informative, because only the high frequencies can
be seen clearly. Is there any way I could cut the y-axis from the middle so
that the y-axis values ranged for example from 0 to 300, and then again from
900 to 1500?

-- 
View this message in context: 
http://r.789695.n4.nabble.com/Y-axis-range-in-histograms-tp2237476p2237476.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] two questions about PLOT

2010-05-31 Thread Ivan Calandra
Hi,

Not sure it is the best solution, but I would create the layout of the 
plot part by part:
plot(type=n) #does not plot
axis(1, at=1:6,...) #set the x-axis at the bottom
axis(4,...) #set the y-axis on the right. I'm not sure that's what you 
were looking for, didn't really understand it
lines(avegrp,...) #plot your data

And do not forget to provide sample data!

HTH
Ivan

Le 5/31/2010 16:44, Jie TANG a écrit :
 here ,I want to plot two lines in one figure.But I have two problems
 1) how to move one of the y-axis to be the right ? I tried to the
 commandaxis(2),But I failed.
 2) how to add the axis information correctly.Since I have use the cmommand
 axis(1,at=1:6,labels=gradeinfo$gradenam)
 but it seems that the correct information that I want is superposition
 with the old axis information.What can i do ?
 the script and figure is shown as below .thanks .:)

 outflnm-paste(Outdic,meansd.jpg,sep=/)
 jpeg(file=outflnm, bg=transparent)
 legend-c(average error,stand quare error)
 lgcol-c(black,red1)
 par(las=1)
 yylab-c(forecast error)
 xxlab-c(typhoon class)
 llty-c(1,3)
 llwd-c(4,4)
 #par(bg='yellow')


 plot(avegrp,type='l',lty=1,col='black',lwd=4,xlab=xxlab,ylab=yylab)
 par(new=T)
 plot(sdgrp,type='l',lty=3,col='red1',xlab=xxlab,ylab=yylab,lwd=4)
 #axis(2, col = gold, lty = 2, lwd = 0.5)
 legend(topright, legend,   lty=llty, lwd=llwd,col =lgcol)
 axis(1,at=1:6,labels=gradeinfo$gradenam)
 dev.off()




 __
 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.


-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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] Y-axis range in histograms

2010-05-31 Thread Andy Rominger
A few ideas:

Make a log-scale y-axis like:
hist(my.data,...,log=y)

argument yaxp can help make the ticks look pretty...see ?par.

Or use various functions from the package `plotirx': axis.break and
gap.barplot might be helpful.

For those functions, you'll probably need to get your frequencies from the
histogram, something like:

my.freq - hist(my.data,...,plot=FALSE)$counts

you may also need to play with the x-axis tick labels to actually denote the
correct bin for your frequencies.

Good luck, hope that helps--
Andy



On Mon, May 31, 2010 at 10:49 AM, Aarne Hovi aarne.h...@helsinki.fi wrote:


 Hi,

 I'm trying to create a histogram with R. The problem is that the frequency
 is high for a couple of x-axis categories (e.g. 1500) and low for most of
 the x-axis categories (e.g. 50)
 http://r.789695.n4.nabble.com/file/n2237476/LK3_hist.jpg . When I create
 the
 histogram, it is not very informative, because only the high frequencies
 can
 be seen clearly. Is there any way I could cut the y-axis from the middle so
 that the y-axis values ranged for example from 0 to 300, and then again
 from
 900 to 1500?

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Y-axis-range-in-histograms-tp2237476p2237476.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.


[[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] Y-axis range in histograms

2010-05-31 Thread Ted Harding
On 31-May-10 14:49:43, Aarne Hovi wrote:
 Hi,
 
 I'm trying to create a histogram with R. The problem is that the
 frequency is high for a couple of x-axis categories (e.g. 1500)
 and low for most of the x-axis categories (e.g. 50)  
 http://r.789695.n4.nabble.com/file/n2237476/LK3_hist.jpg .
 When I create the histogram, it is not very informative, because
 only the high frequencies can be seen clearly. Is there any way I
 could cut the y-axis from the middle so that the y-axis values
 ranged for example from 0 to 300, and then again from 900 to 1500?

There may be specific rpovision for this in one of the extra graphics
packages, but using plain hist() the only approach I can think of is
on the folllowing lines.

First create the histogram and name it:

  H - hist(whatever)

Then fake the high counts:

  ix - H$counts  400  ## which counts exceed 400 (say)
  H$counts[ix] - H$counts[ix] - 500 ## counts  900 - 400+

Now plot the histogram without y-axis annotations, and with
ylim=c(0,1100); then add annotations (0,100,200,300,900,1000,1100,...).
Finally (perhaps) plot filled white boxes over the histogram bars
with height range 330-370 (say) so that the break is obvious.

Just first thoughts!
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 31-May-10   Time: 16:40:29
-- XFMail --

__
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] What does LOESS stand for?

2010-05-31 Thread Peter Neuhaus

Thanks a lot...

... makes it a bit difficult to explain, though...

Peter

Quoting Joris Meys jorism...@gmail.com:


This is the paper on which the loess algorithm is based in general:
http://www.econ.pdx.edu/faculty/KPL/readings/cleveland88.pdf

The explanation about the origin of the term LOESS is given on page 597.

Cheers
Joris

On Mon, May 31, 2010 at 11:33 AM, Peter Neuhaus pneuh...@pneuhaus.dewrote:


Dear R-community,

maybe someone can help me with this:

I've been using the loess() smoother for quite a while now, and for
the matter of documentation I'd like to resolve the acronym LOESS.
Unfortunately there's no explanation in the help file, and I didn't
get anything convincing from google either.

I know that the predecessor LOWESS stands for Locally Weighted
Scatterplot Smoothing. But what does LOESS stand for, specifically?
Locally Weighted Exponential Scatterplot Smoothing? As far as
I understand LOESS is still a local polynomial regression, so that
would probably make no sense.

Any help appreciated!

Thanks in advance,

Peter

__
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.





--
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php



__
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] What does LOESS stand for?

2010-05-31 Thread David Winsemius


On May 31, 2010, at 11:44 AM, Peter Neuhaus wrote:


Thanks a lot...

... makes it a bit difficult to explain, though...


We drink no wine before its time. Somewhat like trying to explain  
splines to non-technical types:


http://www.duckworksmagazine.com/03/r/articles/splineducks/splineDucks.htm

--
David.



Peter

Quoting Joris Meys jorism...@gmail.com:


This is the paper on which the loess algorithm is based in general:
http://www.econ.pdx.edu/faculty/KPL/readings/cleveland88.pdf

The explanation about the origin of the term LOESS is given on page  
597.


Cheers
Joris

On Mon, May 31, 2010 at 11:33 AM, Peter Neuhaus  
pneuh...@pneuhaus.dewrote:



Dear R-community,

maybe someone can help me with this:

I've been using the loess() smoother for quite a while now, and for
the matter of documentation I'd like to resolve the acronym LOESS.
Unfortunately there's no explanation in the help file, and I didn't
get anything convincing from google either.

I know that the predecessor LOWESS stands for Locally Weighted
Scatterplot Smoothing. But what does LOESS stand for, specifically?
Locally Weighted Exponential Scatterplot Smoothing? As far as
I understand LOESS is still a local polynomial regression, so that
would probably make no sense.

Any help appreciated!

Thanks in advance,

Peter





David Winsemius, MD
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] after updating biomaRt cannot connect any more

2010-05-31 Thread Uwe Ligges



On 31.05.2010 14:03, mau...@alice.it wrote:

I recently updated R  2.10.1 Patched (2010-02-20 r51163)
This morning I reinstalled biomaRt using biocLite.
Now I can no more connect to biomaRt and even the following instruction is 
hanging  for a while until
the same error message pops up.

listMarts()

Error in value[[3L]](cond) :
   Request to BioMart web service failed. Verify if you are still connected to 
the internet.  Alternatively the BioMart web service is temporarily down.

I checked my command syntax  and got the following message:

library(help=biomaRt)

Warning messages:
1: package 'JavaGD' was built under R version 2.9.0 and help may not work 
correctly
2: package 'Biobase' was built under R version 2.9.0 and help may not work 
correctly
3: package 'Biostrings' was built under R version 2.9.0 and help may not work 
correctly
4: package 'IRanges' was built under R version 2.9.0 and help may not work 
correctly
5: package 'CORNA' was built under R version 2.9.0 and help may not work 
correctly
6: package 'GEOquery' was built under R version 2.9.0 and help may not work 
correctly
7: package 'microRNA' was built under R version 2.9.0 and help may not work 
correctly
8: package 'Rlibstree' was built under R version 2.9.0 and help may not work 
correctly



I am stuck.
Which packages am I supposed to install again ?  Maybe shall I get rid of R  
2.10.1 Patched
and restart from scratch ?



1. If you upgraded, why to R-2.10.1. given R-2.11.1 has been released 
today? Hence my recommedndation is to go ahead for R-2.11.1


2. After strating R say

update.packages(checkBuilt=TRUE)
and all your outdated packages will be updated for the current version of R.

Uwe Ligges




Thank you in advance.
Maura







tutti i telefonini TIM!


[[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] after updating biomaRt cannot connect any more

2010-05-31 Thread Uwe Ligges



On 31.05.2010 17:55, Uwe Ligges wrote:



On 31.05.2010 14:03, mau...@alice.it wrote:

I recently updated R 2.10.1 Patched (2010-02-20 r51163)
This morning I reinstalled biomaRt using biocLite.
Now I can no more connect to biomaRt and even the following
instruction is hanging for a while until
the same error message pops up.

listMarts()

Error in value[[3L]](cond) :
Request to BioMart web service failed. Verify if you are still
connected to the internet. Alternatively the BioMart web service is
temporarily down.

I checked my command syntax and got the following message:

library(help=biomaRt)

Warning messages:
1: package 'JavaGD' was built under R version 2.9.0 and help may not
work correctly
2: package 'Biobase' was built under R version 2.9.0 and help may not
work correctly
3: package 'Biostrings' was built under R version 2.9.0 and help may
not work correctly
4: package 'IRanges' was built under R version 2.9.0 and help may not
work correctly
5: package 'CORNA' was built under R version 2.9.0 and help may not
work correctly
6: package 'GEOquery' was built under R version 2.9.0 and help may not
work correctly
7: package 'microRNA' was built under R version 2.9.0 and help may not
work correctly
8: package 'Rlibstree' was built under R version 2.9.0 and help may
not work correctly



I am stuck.
Which packages am I supposed to install again ? Maybe shall I get rid
of R 2.10.1 Patched
and restart from scratch ?



1. If you upgraded, why to R-2.10.1. given R-2.11.1 has been released
today? Hence my recommedndation is to go ahead for R-2.11.1

2. After strating R say

update.packages(checkBuilt=TRUE)
and all your outdated packages will be updated for the current version
of R.




And DO NOT cross post (as I did while responding without paying 
attention to the list of CCs).


Uwe Ligges



Uwe Ligges




Thank you in advance.
Maura







tutti i telefonini TIM!


[[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] What does LOESS stand for?

2010-05-31 Thread Ted Harding
On 31-May-10 15:52:56, David Winsemius wrote:
 On May 31, 2010, at 11:44 AM, Peter Neuhaus wrote:
 
 Thanks a lot...

 ... makes it a bit difficult to explain, though...
 
 We drink no wine before its time. Somewhat like trying to explain  
 splines to non-technical types:
 
 http://www.duckworksmagazine.com/03/r/articles/splineducks/splineDucks.h
 tm
 -- 
 David.
 Peter

Spline-ducks are sophisticated technology compared with what some
of us used to do in the 1960s. The spline was a long narrow strip
of springy metal. On the drawing-board, lay down the paper and plot
the points. Then tap in fairly sturdy draper's pins at the points.
Then lay the spline (on its edge) between the pins. Then (carefully)
draw by hand a curve along the line of the spline.

Even today, this could constitute a very easily grasped explanation
of splines for non-technical types!

Ted.

 Quoting Joris Meys jorism...@gmail.com:

 This is the paper on which the loess algorithm is based in general:
 http://www.econ.pdx.edu/faculty/KPL/readings/cleveland88.pdf

 The explanation about the origin of the term LOESS is given on page  
 597.

 Cheers
 Joris

 On Mon, May 31, 2010 at 11:33 AM, Peter Neuhaus  
 pneuh...@pneuhaus.dewrote:

 Dear R-community,

 maybe someone can help me with this:

 I've been using the loess() smoother for quite a while now, and for
 the matter of documentation I'd like to resolve the acronym LOESS.
 Unfortunately there's no explanation in the help file, and I didn't
 get anything convincing from google either.

 I know that the predecessor LOWESS stands for Locally Weighted
 Scatterplot Smoothing. But what does LOESS stand for, specifically?
 Locally Weighted Exponential Scatterplot Smoothing? As far as
 I understand LOESS is still a local polynomial regression, so that
 would probably make no sense.

 Any help appreciated!

 Thanks in advance,

 Peter

 
 
 David Winsemius, MD
 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.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 31-May-10   Time: 17:08:25
-- XFMail --

__
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] Problems with apply

2010-05-31 Thread Luis Felipe Parra
Hello I am tryin to use the apply functions with two data frames I've got
and I am getting the following error message

Error en HistRio$SecSte : $ operator is invalid for atomic vectors

 I don't understand why. when I use the apply I am doing:

PromP - function(HistRio,AnaQuim){
xx - c(0,0,0)
if(length(which(AnaQuim$SecSte==HistRio$SecSte))0){ xx[1]-1 }
if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0){ xx[2]
- 1}
if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0){
xx[3]-1 }
if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0 
length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0 ){ xx[4]
- 2}
return(xx)
}
zz- apply(HistRio,1,PromP,AnaQuim)
and if I do exactly the same with a for

xx - matrix(0,nrow(HistRio),4)
for(i in 1:nrow(HistRio)){
if(length(which(AnaQuim$SecSte==HistRio$SecSte[i]))0){ xx[1]-1 }
if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0){
xx[2] - 1}
if(
length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0){
xx[3]-1 }
if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0 ){
xx[4] - 2}
}

I get no error message. Attached is the data I am using. Any idea of why
this is happening?

Thank you

Felipe Parra
__
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] error on Windows OS

2010-05-31 Thread M.Ribeiro

Ok, 
I re-installed the Rtools (now Rtools211 because I was in another computer
with R version 2.10) , and the message now when I tried to install the
package was

Warning: invalid package 'GWSR_1.0.tar.gz'
Erro: ERROR: no packages specified
Warning message:
In install.packages(GWSR_1.0.tar.gz, repos = NULL, type = source) :
  installation of package 'GWSR_1.0.tar.gz' had non-zero exit status


Any Clue?

Thanks a lot
Cheers
-- 
View this message in context: 
http://r.789695.n4.nabble.com/error-on-Windows-OS-tp2236758p2237341.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] [BioC] after updating biomaRt cannot connect any more

2010-05-31 Thread Heidi Dvinge


On 31 May 2010, at 13:03, mau...@alice.it mau...@alice.it wrote:


I recently updated R  2.10.1 Patched (2010-02-20 r51163)
This morning I reinstalled biomaRt using biocLite.
Now I can no more connect to biomaRt and even the following  
instruction is hanging  for a while until

the same error message pops up.

listMarts()

Error in value[[3L]](cond) :
  Request to BioMart web service failed. Verify if you are still  
connected to the internet.  Alternatively the BioMart web service  
is temporarily down.


Did you check this as suggested in the error message? Currently, when  
I try http://www.biomart.org/ it doesn't seem to work.


Regards
\Heidi


I checked my command syntax  and got the following message:

library(help=biomaRt)

Warning messages:
1: package 'JavaGD' was built under R version 2.9.0 and help may  
not work correctly
2: package 'Biobase' was built under R version 2.9.0 and help may  
not work correctly
3: package 'Biostrings' was built under R version 2.9.0 and help  
may not work correctly
4: package 'IRanges' was built under R version 2.9.0 and help may  
not work correctly
5: package 'CORNA' was built under R version 2.9.0 and help may not  
work correctly
6: package 'GEOquery' was built under R version 2.9.0 and help may  
not work correctly
7: package 'microRNA' was built under R version 2.9.0 and help may  
not work correctly
8: package 'Rlibstree' was built under R version 2.9.0 and help may  
not work correctly



I am stuck.
Which packages am I supposed to install again ?  Maybe shall I get  
rid of R  2.10.1 Patched

and restart from scratch ?

Thank you in advance.
Maura







tutti i telefonini TIM!


[[alternative HTML version deleted]]

___
Bioconductor mailing list
bioconduc...@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives: http://news.gmane.org/ 
gmane.science.biology.informatics.conductor


__
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] What does LOESS stand for?

2010-05-31 Thread Tal Galili
Hi Peter,

If this article is correct:
http://www.r-bloggers.com/abbreviations-of-r-commands-explained-250-r-abbreviations/
Loess stands for:
[LO]cally [E]stimated [S]catterplot [S]moothing


Best,
Tal


Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Mon, May 31, 2010 at 12:33 PM, Peter Neuhaus pneuh...@pneuhaus.dewrote:

 Dear R-community,

 maybe someone can help me with this:

 I've been using the loess() smoother for quite a while now, and for
 the matter of documentation I'd like to resolve the acronym LOESS.
 Unfortunately there's no explanation in the help file, and I didn't
 get anything convincing from google either.

 I know that the predecessor LOWESS stands for Locally Weighted
 Scatterplot Smoothing. But what does LOESS stand for, specifically?
 Locally Weighted Exponential Scatterplot Smoothing? As far as
 I understand LOESS is still a local polynomial regression, so that
 would probably make no sense.

 Any help appreciated!

 Thanks in advance,

 Peter


 __
 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] about heatmap

2010-05-31 Thread sheng zhao
Hi :

try this: col=rev(your color)

Regards,
Sh.Z

On Mon, May 31, 2010 at 2:16 PM, Jorge Ivan Velez
jorgeivanve...@gmail.comwrote:

 Hi there,

 Take a look at

 http://www2.warwick.ac.uk/fac/sci/moac/currentstudents/peter_cock/r/heatmap/

 HTH,
 Jorge


 On Mon, May 31, 2010 at 3:54 AM, 孟欣  wrote:

  Hi all:
  As to the heatmap function, the default style is red and yellow,and
 red
  refers to low level and yellow refers to high level.
  How can I change the style to the contrary: red refers to high level and
  yellow refers to low level?
 
  Thanks a lot!
  My best
 [[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.



[[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] error on Windows OS

2010-05-31 Thread M.Ribeiro

Thanks for all the help,

So let me undestand, 
The Rtools is currently installed in 

c:\Rtools\bin;
c:\Rtools\perl\bin;
c:\Rtools\MinGW\bin;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
C:\Program Files (x86)\QuickTime\QTSystem\;
C:\Program Files (x86)\SAS\Shared Files\Formats  (I don't know why in
here)

Should I re-install in a C:/Windows/Rtools directory ?

Thanks again
Cheers

-- 
View this message in context: 
http://r.789695.n4.nabble.com/error-on-Windows-OS-tp2236758p2237308.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 delete the previously saved workspace restored

2010-05-31 Thread Yanwei Tan

Thanks a lot David!

I use MacOSX and deleted the .RData file, then everything is fine.

Best wishes,
Wei


On 5/31/10 2:49 PM, David Winsemius wrote:


On May 31, 2010, at 5:10 AM, Yanwei Tan wrote:


Dear all,

I am a new user of R, here I have a question about remove the 
previous restored workspace.  I saved the workspace last time, but R 
always automatically load the workspace when I open it.  I try to 
remove the object and then close R without saving. But next time when 
I open R, it always load the previous workspace. I want to delete the 
.RData in the directory, but I have no clue where is the .RData 
directory.


The message is Workspace restored from /Users/wei/.RData


It tells you that it is in the /Users/wei/ directory.



How could I avoid from this directory? because there is a dot before, 
I do not know where I can find this file.


Also I already try this command : rm(list=ls())   But R still load 
the previous workspace.


What OS? MacOSX? You can turn on showing dotted files which are by 
default hidden. Or you could open a Terminal window and issue the command


 rm /Users/wei/.RData

You could alternatively exit and save after rm(list=ls()) which would 
create an empty workspace which should load very quickly.




With many thanks for any advice!!

Best,
Wei





__
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] Y-axis range in histograms

2010-05-31 Thread Duncan Murdoch

On 31/05/2010 10:49 AM, Aarne Hovi wrote:

Hi,

I'm trying to create a histogram with R. The problem is that the frequency
is high for a couple of x-axis categories (e.g. 1500) and low for most of
the x-axis categories (e.g. 50)  
http://r.789695.n4.nabble.com/file/n2237476/LK3_hist.jpg . When I create the

histogram, it is not very informative, because only the high frequencies can
be seen clearly. Is there any way I could cut the y-axis from the middle so
that the y-axis values ranged for example from 0 to 300, and then again from
900 to 1500?


Using a bar chart like that takes away most of the value of using a bar 
chart:  you lose both area and length as visual clues to the value.  Why 
not do something different?  For example,


x - runif(1700) + rep(1:5, c(1500,50,55,45,50))
hist(x, breaks=5)  # The one you don't like
h - hist(x, breaks=5, plot=FALSE)  # Get the data
plot(h$mids, h$counts, log=y) # Plot on a log scale
abline(v=h$breaks,col=lightgray) # Indicate the bins

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] Sweave png

2010-05-31 Thread Gildas Mazo
Hi,

Is there a simple way to save my figures in png instead of pdf with
Sweave ??

Thanks in advance,

Gidas

__
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] Problems with apply

2010-05-31 Thread Ivan Calandra
Hi,

Here is what ?apply says:
Returns a vector or array or list of values obtained by applying a 
function to margins of an array.

So apply() works on arrays, not on dataframes! Maybe lapply() would do 
what you're looking for (don't have time to look more into it)
And you don't do exactly the same with a for because xx is a matrix (a 
matrix is a 2-dimensional array, dataframes are lists)

HTH,
Ivan

PS: I don't see any data attached. Think about using dput(), it's great ;)


Le 5/31/2010 17:16, Luis Felipe Parra a écrit :
 Hello I am tryin to use the apply functions with two data frames I've got
 and I am getting the following error message

 Error en HistRio$SecSte : $ operator is invalid for atomic vectors

   I don't understand why. when I use the apply I am doing:

 PromP- function(HistRio,AnaQuim){
 xx- c(0,0,0)
 if(length(which(AnaQuim$SecSte==HistRio$SecSte))0){ xx[1]-1 }
 if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0){ xx[2]
 - 1}
 if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0){
 xx[3]-1 }
 if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0 ){ xx[4]
 - 2}
 return(xx)
 }
 zz- apply(HistRio,1,PromP,AnaQuim)
 and if I do exactly the same with a for

 xx- matrix(0,nrow(HistRio),4)
 for(i in 1:nrow(HistRio)){
 if(length(which(AnaQuim$SecSte==HistRio$SecSte[i]))0){ xx[1]-1 }
 if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0){
 xx[2]- 1}
 if(
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0){
 xx[3]-1 }
 if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0
   length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0 ){
 xx[4]- 2}
 }

 I get no error message. Attached is the data I am using. Any idea of why
 this is happening?

 Thank you

 Felipe Parra



 __
 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.


-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php


[[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 extract the 1st field from a vector of strings

2010-05-31 Thread Juliet Hannah
What is the meaning of \\1 here? Thanks.

desc - c(hsa-let-7a MIMAT062 Homo sapiens let-7a,hsa-let-7a*
MIMAT0004481 Homo sapiens let-7a*,hsa-let-7a-2* MIMAT0010195 Homo
sapiens let-7a-2*)

I'm missing something:

 gsub( MIMA.*, \\1, desc)
[1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*
 gsub( MIMA.*, \\2, desc)
[1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*
 gsub( MIMA.*, \\3, desc)
[1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*

On Thu, May 27, 2010 at 10:58 AM, Henrique Dallazuanna www...@gmail.com wrote:
 Try this:

  gsub( MIMA.*, \\1, desc)

 On Thu, May 27, 2010 at 11:37 AM, mau...@alice.it wrote:

 I have the following vector of strings (shown only the first 3 elements)

  desc[1:3]
 [1] hsa-let-7a MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a* MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2* MIMAT0010195 Homo sapiens let-7a-2*
  is.vector(desc)
 [1] TRUE
  A - unlist(strsplit(desc[1:3],   ))
  A
 [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*
  as.vector(A)
 [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*
 
 I would like to extract only the first field (of variable length). That is
 I need a vector containing
 hsa-let-7a 
 hsa-let-7a*
 hsa-let-7a-2*

 The operator [[]][] works only on the single vector element. I would like
 to extract the 1st field
 with one single instruction rather than a loop as traditional programming
 languages request.

 Thank you in advance for you help.
 Maura



 tutti i telefonini TIM!


        [[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.




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O

        [[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 extract the 1st field from a vector of strings

2010-05-31 Thread Henrique Dallazuanna
My mistake:

\\1 is a backreference - see replacement argument in ?gsub.

This work:
gsub((.*) MIMA.*, \\1, desc)


On Mon, May 31, 2010 at 2:00 PM, Juliet Hannah juliet.han...@gmail.comwrote:

 What is the meaning of \\1 here? Thanks.

 desc - c(hsa-let-7a MIMAT062 Homo sapiens let-7a,hsa-let-7a*
 MIMAT0004481 Homo sapiens let-7a*,hsa-let-7a-2* MIMAT0010195 Homo
 sapiens let-7a-2*)

 I'm missing something:

  gsub( MIMA.*, \\1, desc)
 [1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*
  gsub( MIMA.*, \\2, desc)
 [1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*
  gsub( MIMA.*, \\3, desc)
 [1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*

 On Thu, May 27, 2010 at 10:58 AM, Henrique Dallazuanna www...@gmail.com
 wrote:
  Try this:
 
   gsub( MIMA.*, \\1, desc)
 
  On Thu, May 27, 2010 at 11:37 AM, mau...@alice.it wrote:
 
  I have the following vector of strings (shown only the first 3 elements)
 
   desc[1:3]
  [1] hsa-let-7a MIMAT062 Homo sapiens let-7a
  [2] hsa-let-7a* MIMAT0004481 Homo sapiens let-7a*
  [3] hsa-let-7a-2* MIMAT0010195 Homo sapiens let-7a-2*
   is.vector(desc)
  [1] TRUE
   A - unlist(strsplit(desc[1:3],   ))
   A
  [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
  [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
  [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*
   as.vector(A)
  [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
  [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
  [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*
  
  I would like to extract only the first field (of variable length). That
 is
  I need a vector containing
  hsa-let-7a 
  hsa-let-7a*
  hsa-let-7a-2*
 
  The operator [[]][] works only on the single vector element. I would
 like
  to extract the 1st field
  with one single instruction rather than a loop as traditional
 programming
  languages request.
 
  Thank you in advance for you help.
  Maura
 
 
 
  tutti i telefonini TIM!
 
 
 [[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.
 
 
 
 
  --
  Henrique Dallazuanna
  Curitiba-Paraná-Brasil
  25° 25' 40 S 49° 16' 22 O
 
 [[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.
 
 




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] error on Windows OS

2010-05-31 Thread Duncan Murdoch

On 31/05/2010 9:13 AM, M.Ribeiro wrote:
Ok, 
I re-installed the Rtools (now Rtools211 because I was in another computer

with R version 2.10) , and the message now when I tried to install the
package was

Warning: invalid package 'GWSR_1.0.tar.gz'
Erro: ERROR: no packages specified
Warning message:
In install.packages(GWSR_1.0.tar.gz, repos = NULL, type = source) :
  installation of package 'GWSR_1.0.tar.gz' had non-zero exit status


Any Clue?



I would guess that the package didn't exist in the current directory.

I'd recommend working in the CMD window rather than in R (using Rcmd 
INSTALL GWSR_1.0.tar.gz); it is sometimes tricky to see what the state 
of the system is from R.



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] Corrections for Solaris stuff in manual

2010-05-31 Thread Dr. David Kirkby

There are a number of errors in the R manual about Solaris.

http://cran.r-project.org/doc/manuals/R-admin.html#Solaris

1) Firstly, Sun are now owned by Oracle, who bought them for $7 billion.

2) (Recent Sun machines are Opterons (‘amd64’) rather than ‘x86’, but 32-bit 
‘x86’ executables are the default.) 


That's incorrect. All recent Sun workstations used *Intel* CPUs - Opterons have 
not been used for some time. The directory structure is however the same as with 
the operterons (using /usr/lib/amd64).


I'm using a Sun Ultra 27 (quad core 3.33 GHz Xeon) which I bought about 6 months 
ago. That is a current model. Last time I looked, the Ultra 24 was the lower-end 
x64 box, and again used some sort of Intel CPUs.


3) Modern Solaris systems allow a large selection of Open Source software to be 
installed from http://www.opencsw.org (formerly http://www.blastwave.org) via 
pkg-get, 


Again incorrect. Both Blastwave and OpenCSW are in existence. There is a lot of 
bad feelings between the two camps, but they do both still exist.



I was going to ask if you knew how to build R as a 64-bit application on 
OpenSolaris x64, though I see you indicate



Tests with gcc34 on ‘x86’ and ‘amd64’ have been less successful: ‘x86’ builds 
have failed on tests using complex arithmetic35, whereas on ‘amd64’ the builds 
have failed to complete in several different ways, most recently with relocation 
errors for libRblas.so.



I get that when trying to build R within Sage:

http://trac.sagemath.org/sage_trac/ticket/9040

ld.so.1: R: fatal: relocation error: R_AMD64_PC32: file 
/export/home/drkirkby/sage-4.4.2/spkg/build/r-2.10.1.p1/src/lib/libR.so: symbol 
_init: value 0x228000984acd does not fit


There's some info about this problem at

http://developers.sun.com/solaris/articles/about_amd64_abi.html

where it is suggests -Kpic is used to build Position Independent Code (PIC) 
code. I've not tried using -fPIC with gcc, which might solve the problem, as 
that builds PIC code.


Dave

__
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] Problems with apply

2010-05-31 Thread Joris Meys
Ivan is -partly- right. However, in the details it says as well that :
If X is not an array but has a dimension attribute, apply attempts to coerce
it to an array via as.matrix if it is two-dimensional (e.g., data frames) or
via as.array.

The main problem is the fact that what goes into the PromP function is not a
dataframe, not even a matrix, but a vector.  You can easily see where it
goes wrong if you place

print(str(HistRio))

as a first line in your function. You'll also see that (hopefully) it's a
named vector, meaning you could try to rewrite your function like :
if(length(which(AnaQuim$SecSte==HistRio[SecSte]))0){ xx[1]-1 }
etc...

I didn't test it out though, but it should work.

Cheers
Joris

On Mon, May 31, 2010 at 5:16 PM, Luis Felipe Parra 
felipe.pa...@quantil.com.co wrote:

 Hello I am tryin to use the apply functions with two data frames I've got
 and I am getting the following error message

 Error en HistRio$SecSte : $ operator is invalid for atomic vectors

  I don't understand why. when I use the apply I am doing:

 PromP - function(HistRio,AnaQuim){
 xx - c(0,0,0)
 if(length(which(AnaQuim$SecSte==HistRio$SecSte))0){ xx[1]-1 }
 if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0){
 xx[2]
 - 1}
 if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0){
 xx[3]-1 }
 if( length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra)))0 
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte)))0 ){ xx[4]
 - 2}
 return(xx)
 }
 zz- apply(HistRio,1,PromP,AnaQuim)
 and if I do exactly the same with a for

 xx - matrix(0,nrow(HistRio),4)
 for(i in 1:nrow(HistRio)){
 if(length(which(AnaQuim$SecSte==HistRio$SecSte[i]))0){ xx[1]-1 }
 if(length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0){
 xx[2] - 1}
 if(
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0){
 xx[3]-1 }
 if(
 length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FechaSiembra[i])))0
  length(which(as.Date(AnaQuim$AÑO1)=as.Date(HistRio$FinCorte[i])))0 ){
 xx[4] - 2}
 }

 I get no error message. Attached is the data I am using. Any idea of why
 this is happening?

 Thank you

 Felipe Parra

 __
 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.




-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

[[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] store and repeat data based on row names (loop, if statement)

2010-05-31 Thread RCulloch

Hi Jim,

Many thanks - that has worked perfectly, thanks so much for your help!

Best wishes,

Ross
-- 
View this message in context: 
http://r.789695.n4.nabble.com/store-and-repeat-data-based-on-row-names-loop-if-statement-tp2236928p2237628.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 extract the 1st field from a vector of strings

2010-05-31 Thread Gabor Grothendieck
Try replacing a space followed by anything (.*) with the empty string:

 x - c(hsa-let-7a MIMAT062 Homo sapiens let-7a,
+ hsa-let-7a* MIMAT0004481 Homo sapiens let-7a*,
+ hsa-let-7a-2* MIMAT0010195 Homo sapiens let-7a-2*)

 sub( .*, , x)
[1] hsa-let-7ahsa-let-7a*   hsa-let-7a-2*


On Thu, May 27, 2010 at 10:37 AM,  mau...@alice.it wrote:
 I have the following vector of strings (shown only the first 3 elements)

 desc[1:3]
 [1] hsa-let-7a MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a* MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2* MIMAT0010195 Homo sapiens let-7a-2*
 is.vector(desc)
 [1] TRUE
 A - unlist(strsplit(desc[1:3],   ))
 A
 [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*
 as.vector(A)
 [1] hsa-let-7a  MIMAT062 Homo sapiens let-7a
 [2] hsa-let-7a*  MIMAT0004481 Homo sapiens let-7a*
 [3] hsa-let-7a-2*  MIMAT0010195 Homo sapiens let-7a-2*

 I would like to extract only the first field (of variable length). That is I 
 need a vector containing
 hsa-let-7a 
 hsa-let-7a*
 hsa-let-7a-2*

 The operator [[]][] works only on the single vector element. I would like to 
 extract the 1st field
 with one single instruction rather than a loop as traditional programming 
 languages request.

 Thank you in advance for you help.
 Maura



 tutti i telefonini TIM!


        [[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] Put two plots side by side

2010-05-31 Thread Felipe Carrillo
Two different ways:
library(ggplot2)
x=5
size=50
A=data.frame(X=sample(x, size, replace=T), Y=sample(x, size, 
replace=T),a=rep(1:2,each=25));A
# Facetting
qplot(X,Y,data=A) + geom_jitter(position=position_jitter(width=.03)) + 
facet_grid(.~a)
# Or with vp
p=qplot(X, Y, data=A) + geom_jitter(position=position_jitter(width=.03))
ggsave(p, file='main.png')
p1=qplot(X, Y, data=A) + geom_jitter(position=position_jitter(width=.3))
ggsave(p1, file='main2.png')
vport - function(x, y)
viewport(layout.pos.row=x, layout.pos.col=y)
grid.newpage()
pushViewport(viewport(layout=grid.layout(1,2)))
print(p, vp=vport(1,1))
print(p1, vp=vport(1,2))
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA



- Original Message 
 From: Erik Iverson er...@ccbr.umn.edu
 To: Peng Yu pengyu...@gmail.com
 Cc: ggplot2 ggpl...@googlegroups.com
 Sent: Sun, May 30, 2010 7:45:22 PM
 Subject: Re: Put two plots side by side
 
 
 
 I want to put the above two plots side by side (essentially, 
 to mimic
 par(mfrow=c(1,2)) in the traditional graphic system). Is there 
 a
 convenient way to do so in ggplot2?
 

Yes.

My 
 understanding is that you need to create use grid functions to do this. You 
 can 
 create a viewport with a layout (using grid.layout) and then print the 
 ggplot2 
 objects using the vp argument.  I don't know if there is a ggplot2 
 abstraction for this idea.

-- You received this message because you are 
 subscribed to the ggplot2 mailing list.
Please provide a reproducible 
 example: http://gist.github.com/270442

To post: email  ymailto=mailto:ggpl...@googlegroups.com; 
 href=mailto:ggpl...@googlegroups.com;ggpl...@googlegroups.com
To 
 unsubscribe: email ggplot2+ 
 href=mailto:unsubscr...@googlegroups.com;unsubscr...@googlegroups.com
More 
 options: http://groups.google.com/group/ggplot2




__
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] error on Windows OS [SEC=UNCLASSIFIED]

2010-05-31 Thread RICHARD M. HEIBERGER
M.Ribeiro,

You can install on Windows from the tar.gz using the RTools.
You need to set the PATH to find RTools and it looks like you skipped that
step.
Full details are in the R Extensions manual.

Here are my notes, from several years ago as you can see by the R-2.8.0
paths
and the Rtools29.exe set of tools, for running from the MSDOS CMD window.

Change all R-2.8.0 statements to the current version.
Change the cd statement to the directory containing the .tar.gz file.

Rich




Download from
http://www.murdoch-sutherland.com/Rtools/
Rtools29.exe
and install into default locations.
In an MS-DOS Commands Window --- cmd in the Start  Run window
PATH=c:\Rtools\bin;c:\Rtools\perl\bin;c:\Rtools\MinGW\bin;c:\texmf\miktex\bin;c:\progra~1\RExcel\R-2.8.0\bin;c:\windows;c:\windows\system32
rem
^^
rem use correct 8.3 path for the R version that you are using.
c:\
cd C:\mydirectory
rem MyPackage\ is a directory in the above directory
R CMD CHECK --no-examples --no-latex MyPackage  ## detailed checks---faster
R CMD CHECK  MyPackage  ## detailed checks
R CMD INSTALL --buildMyPackage  ## installs and builds .zip
rem this gives the official canonical form that will eventually be sent to
CRAN
rem R CMD BUILD  MyPackage  ## tar.gz
rem problems appear in this file:
C:\mydirectory\MyPackage.Rcheck\00install.out

relevant documents are in
C:\Program Files\RExcel\R-2.8.0\doc\manual\R-admin.html
C:\Program Files\RExcel\R-2.8.0\doc\manual\R-exts.html

[[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] Fancy Page layout

2010-05-31 Thread Noah Silverman
Hi,

Working on a report that is going to have a large number of graphs and
summaries.  We have 80 groups with 20 variables each.

Ideally, I'd like to produce ONE page for each group.  It would have two
columns of 10 graphs and then the 5 number summary of the variables at
the bottom.
So, perhaps the top 2/3 of the page has the graphs and the bottom third
has 20 rows of data summary(maybe a table of sorts.)
This COULD be done in Latex, but would have to be hand coded for each of
the 80 groups which would be painfully slow.

I can easily do the graphs with par(mfrow=c(5,2))  band then draw the
graphs in a loop. 

But I am stuck from here:

1) How do I control the size of the plot window.  (Ideally, it should
print to fill an 8.5 x 11 piece of paper)
2) Is there a way to easily insert a 5 number summary (summary
command) into the lower half of the page.

Does anybody have any ideas??

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.


Re: [R] Fancy Page layout

2010-05-31 Thread RICHARD M. HEIBERGER
Use lattice.

require(lattice)
?lattice
?xyplot

[[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 skip negative values when calculating average

2010-05-31 Thread ecvetano
I have a data frame 10 by 12 with positive and negative numbers. I  
want to select only the positive numbers and find the average.


This calculates the average of everything:
av5 -  subset(ER9r, Day == 253, select = c (Depth1j:Depth0.75j)
av5 - mean(av5)
I need something along the lines of select av50

Thanks in advance!

Emilija

__
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] Fancy Page layout

2010-05-31 Thread baptiste auguie
Hi,


ggplot2 or lattice could help you in creating the plots. Adding a
summary will however require some play with Grid graphics; either
using gridBase to mix lattice / ggplot2 output with base R graphics
(e.g. textplot() from some package I forget), or you'll need to
produce the textual summary in some form that Grid understands (of
course, LaTeX / Sweave is a good option for this step too). A pure
Grid graphics example is illustrated below,

library(ggplot2)
library(gridExtra) # R-forge

str(diamonds)

onelevel - function(d){

  plots - qplot(depth, table, data=d, colour=clarity) + facet_wrap(~cut)
  tab - tableGrob(head(d))
  plotsandtable - c(list(plots), list(tab), list(plot=FALSE,
main=paste(unique(d$color
  do.call(arrange, plotsandtable)

}

l - dlply(diamonds, .(color), onelevel)

pdf(test.pdf)
l_ply(l, function(page) {grid.newpage(); grid.draw(page)} )
dev.off()

HTH,

baptiste




On 31 May 2010 20:16, Noah Silverman n...@smartmediacorp.com wrote:
 Hi,

 Working on a report that is going to have a large number of graphs and
 summaries.  We have 80 groups with 20 variables each.

 Ideally, I'd like to produce ONE page for each group.  It would have two
 columns of 10 graphs and then the 5 number summary of the variables at
 the bottom.
 So, perhaps the top 2/3 of the page has the graphs and the bottom third
 has 20 rows of data summary(maybe a table of sorts.)
 This COULD be done in Latex, but would have to be hand coded for each of
 the 80 groups which would be painfully slow.

 I can easily do the graphs with par(mfrow=c(5,2))  band then draw the
 graphs in a loop.

 But I am stuck from here:

 1) How do I control the size of the plot window.  (Ideally, it should
 print to fill an 8.5 x 11 piece of paper)
 2) Is there a way to easily insert a 5 number summary (summary
 command) into the lower half of the page.

 Does anybody have any ideas??

 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.




-- 


Baptiste Auguié

Departamento de Química Física,
Universidade de Vigo,
Campus Universitario, 36310, Vigo, Spain

tel: +34 9868 18617
http://webs.uvigo.es/coloides

__
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 skip negative values when calculating average

2010-05-31 Thread David Winsemius


On May 31, 2010, at 2:06 PM, ecvet...@uwaterloo.ca wrote:

I have a data frame 10 by 12 with positive and negative numbers. I  
want to select only the positive numbers and find the average.


This calculates the average of everything:
av5 -  subset(ER9r, Day == 253, select = c (Depth1j:Depth0.75j)


That looks to be missing a closing paren. If so, then after fixing you  
first line try:


mean( av5[av50] )


av5 - mean(av5)
I need something along the lines of select av50

Thanks in advance!

Emilija

__


David Winsemius, MD
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] Fancy Page layout

2010-05-31 Thread Noah Silverman
Lattice looks nice, but how can I put some summary text at the bottom?


On 5/31/10 11:27 AM, RICHARD M. HEIBERGER wrote:
 Use lattice.
  
 require(lattice)
 ?lattice
 ?xyplot


__
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] Can not save plot to png file correctly

2010-05-31 Thread Felipe Carrillo
You can save as png like this too:

library(ggplot2)
data=data.frame(
  X=sample(10,1000,replace=T)
  , Y=letters[1:10])
png(mypng.png)
qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
dev.off()
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA



- Original Message 
 From: Peng Yu pengyu...@gmail.com
 To: ggplot2 ggpl...@googlegroups.com
 Sent: Mon, May 31, 2010 12:20:12 PM
 Subject: Can not save plot to png file correctly
 
 library(ggplot2)

data=data.frame(
  
 X=sample(10,1000,replace=T)
  , Y=letters[1:10]
  
 )

p=qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
save(p, 
 file='error.png')

The above qplot work properly if I don't plot it to a 
 file. But if I
plot it to a png file, the png file is always corrupted. Would 
 you
please let me know what is wrong?

-- 
 
Regards,
Peng

-- 
You received this message because you are 
 subscribed to the ggplot2 mailing list.
Please provide a reproducible 
 example: http://gist.github.com/270442

To post: email  ymailto=mailto:ggpl...@googlegroups.com; 
 href=mailto:ggpl...@googlegroups.com;ggpl...@googlegroups.com
To 
 unsubscribe: email ggplot2+ 
 href=mailto:unsubscr...@googlegroups.com;unsubscr...@googlegroups.com
More 
 options: http://groups.google.com/group/ggplot2




__
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] geom_ribbon removes missing values

2010-05-31 Thread Hadley Wickham
Hi Karsten,

There's no easy way to do this because behind the scenes geom_ribbon
uses grid.polygon.

Hadley

On Sun, May 30, 2010 at 7:26 AM, Karsten Loesing
karsten.loes...@gmx.net wrote:
 Hi everyone,

 it looks like geom_ribbon removes missing values and plots a single
 ribbon over the whole interval of x values. However, I'd rather want it
 to act like geom_line, that is, interrupt the ribbon for the interval of
 missing values and continue once there are new values. Here's an example:

 library(ggplot2)
 df - data.frame(
  date = seq(from = as.Date(2010-05-15),
             to = as.Date(2010-05-24),
             by = 1 day),
  low = c(4, 5, 4, 5, NA, NA, 4, 5, 4, 5),
  mid = c(8, 9, 8, 9, NA, NA, 8, 9, 8, 9),
  high = c(12, 13, 12, 13, NA, NA, 12, 13, 12, 13))
 ggplot(df, aes(x = date, y = mid, ymin = low, ymax = high)) +
  geom_line() +
  geom_ribbon(fill = alpha(blue, 0.5))

 When running this code, R tells me:

 Warning message:
 Removed 2 rows containing missing values (geom_ribbon).

 When you look at the graph, you can see that the line stops at May 18
 and starts again on May 21. But the ribbon reaches from May 15 to 24,
 even though there are no values on May 19 and 20.

 Is there an option that I could set? Or a geom/stat that I should use
 instead? In my pre-ggplot2 times I used polygon(), but I figured there
 must be something better in ggplot2 (as there has always been so far).

 Thanks,
 --Karsten

 __
 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.




-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
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] Can not save plot to png file correctly

2010-05-31 Thread Felipe Carrillo
With ggsave the graph windows pops up but using:
png(mypng.png)
qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
dev.off()
The graph is saved in the background
Is there a way to hide the graph window when
using ggsave?

You can save as png like this too:

library(ggplot2)
data=data.frame(
  X=sample(10,1000,replace=T)
  , Y=letters[1:10])
png(mypng.png)
qplot(X, data=data, geom='histogram') + facet_wrap( ~ Y)
dev.off()

 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish  Wildlife Service
California, USA




__
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] solve_TSP ignores control data, or I'm reading the help doc incorrectly.

2010-05-31 Thread Michael Hahsler

the correct way to do it is

solve_TSP(tsp, 2-opt, control=list(rep=56))

-Michael

--
  Dr. Michael Hahsler, Visiting Assistant Professor
  Department of Computer Science and Engineering
  Lyle School of Engineering
  Southern Methodist University, Dallas, Texas

  (214) 768-8878 * mhahs...@lyle.smu.edu * http://lyle.smu.edu/~mhahsler

__
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] [BioC] after updating biomaRt cannot connect any more

2010-05-31 Thread Sean Davis
On Mon, May 31, 2010 at 8:03 AM, mau...@alice.it wrote:

 I recently updated R  2.10.1 Patched (2010-02-20 r51163)
 This morning I reinstalled biomaRt using biocLite.
 Now I can no more connect to biomaRt and even the following instruction is
 hanging  for a while until
 the same error message pops up.
  listMarts()
 Error in value[[3L]](cond) :
  Request to BioMart web service failed. Verify if you are still connected
 to the internet.  Alternatively the BioMart web service is temporarily down.


As Heidi suggested, how did you check to see if you were connected to the
internet?  And was the BioMart service up and how did you check?


 I checked my command syntax  and got the following message:
  library(help=biomaRt)
 Warning messages:
 1: package 'JavaGD' was built under R version 2.9.0 and help may not work
 correctly
 2: package 'Biobase' was built under R version 2.9.0 and help may not work
 correctly
 3: package 'Biostrings' was built under R version 2.9.0 and help may not
 work correctly
 4: package 'IRanges' was built under R version 2.9.0 and help may not work
 correctly
 5: package 'CORNA' was built under R version 2.9.0 and help may not work
 correctly
 6: package 'GEOquery' was built under R version 2.9.0 and help may not work
 correctly
 7: package 'microRNA' was built under R version 2.9.0 and help may not work
 correctly
 8: package 'Rlibstree' was built under R version 2.9.0 and help may not
 work correctly
 
 I am stuck.
 Which packages am I supposed to install again ?  Maybe shall I get rid of R
  2.10.1 Patched
 and restart from scratch ?


Read this page.

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

If you have problems after following the instructions, please follow the
instructions in the posting guide and ask your question again.

Also, note that the newest version of R is 2.11 and not 2.10.1 Patched.

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] correcting a few data in a large data frame

2010-05-31 Thread Mr. Natural

The data frame is lwf that records the survival of bushes over an 8 year
period. Years are called bouts. Dead bushes are recorded as zeros, and live
bushes as 1. 
str(lwf)
'data.frame':   638 obs. of  9 variables:
 $ bushno: int  1 2 3 4 5 6 7 8 9 10 ...
 $ bout1 : int  0 1 0 1 1 1 0 1 0 1 ...
 $ bout2 : int  0 1 0 0 0 0 0 0 0 1 ...
 $ bout3 : int  0 1 0 0 0 0 0 0 0 1 ...
 $ bout4 : int  0 1 0 0 0 0 0 0 0 0 ...
 $ bout5 : int  0 1 0 0 0 0 0 0 0 0 ...
 $ bout6 : int  0 1 0 0 0 0 0 0 0 0 ...
 $ bout7 : int  0 1 0 0 0 0 0 0 0 0 ...
 $ bout8 : int  0 1 0 0 0 0 0 0 0 0 ...

head(lwf)
  bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
1  1 0 0 0 0 0 0 0 0
2  2 1 1 1 1 1 1 1 1
3  3 0 0 0 0 0 0 0 0
4  4 1 0 0 0 0 0 0 0
5  5 1 0 0 0 0 0 0 0
6  6 1 0 0 0 0 0 0 0

A number of the data are incorrect. For example, that for bush 145 in year
three is recorded as dead=0
when it should be alive =1.  The bushes do not come back to life after
they die.

 lwf[lw$bushno==145,]
bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
144145 1 1 0 1 1 1 1 1


I know that I can do this with fix(lwf) or edit(lwf). However, I would like
to learn some more R.
What code could I use to correct these data?

I have been screwing around with such as
lwfb[(lwf$bushno==145)  (lwf$bout3==0),0]- lwf[(lwf$bushno==145) 
(lwf$bout3==0),1]
to no avail.
Any help appreciated.Thanks, MN



-- 
View this message in context: 
http://r.789695.n4.nabble.com/correcting-a-few-data-in-a-large-data-frame-tp2237834p2237834.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] geepack installation problem?

2010-05-31 Thread Denis B

Dear Peter,

Sincere thanks.   Problem solved!

Kind regards,
Denis

-- 
View this message in context: 
http://r.789695.n4.nabble.com/geepack-installation-problem-tp2236893p2237868.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] correcting a few data in a large data frame

2010-05-31 Thread David Winsemius


On May 31, 2010, at 5:29 PM, Mr. Natural wrote:



The data frame is lwf that records the survival of bushes over an 8  
year
period. Years are called bouts. Dead bushes are recorded as zeros,  
and live

bushes as 1.
str(lwf)
'data.frame':   638 obs. of  9 variables:
$ bushno: int  1 2 3 4 5 6 7 8 9 10 ...
$ bout1 : int  0 1 0 1 1 1 0 1 0 1 ...
$ bout2 : int  0 1 0 0 0 0 0 0 0 1 ...
$ bout3 : int  0 1 0 0 0 0 0 0 0 1 ...
$ bout4 : int  0 1 0 0 0 0 0 0 0 0 ...
$ bout5 : int  0 1 0 0 0 0 0 0 0 0 ...
$ bout6 : int  0 1 0 0 0 0 0 0 0 0 ...
$ bout7 : int  0 1 0 0 0 0 0 0 0 0 ...
$ bout8 : int  0 1 0 0 0 0 0 0 0 0 ...

head(lwf)
 bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
1  1 0 0 0 0 0 0 0 0
2  2 1 1 1 1 1 1 1 1
3  3 0 0 0 0 0 0 0 0
4  4 1 0 0 0 0 0 0 0
5  5 1 0 0 0 0 0 0 0
6  6 1 0 0 0 0 0 0 0

A number of the data are incorrect. For example, that for bush 145  
in year

three is recorded as dead=0
when it should be alive =1.  The bushes do not come back to life  
after

they die.


lwf[lw$bushno==145,]

   bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
144145 1 1 0 1 1 1 1 1


I know that I can do this with fix(lwf) or edit(lwf). However, I  
would like

to learn some more R.
What code could I use to correct these data?


rle is a function that records lengths of runs and values. Your  
problem is to find rows where the length of the rle encoded data is  
more than two. Perhaps something like:


apply(lwf[ , -1], 1, function(x){ length( rle(x)$values ) 2 } )



I have been screwing around with such as
lwfb[(lwf$bushno==145)  (lwf$bout3==0),0]- lwf[(lwf$bushno==145) 
(lwf$bout3==0),1]
to no avail.


If all you want to do is correct these by hand then:

lwf[lwf$bushno==145 , bout3] - 1

Or if you want to work on a copy (safer):

lwfb - lwf
lwfb[lwfb$bushno==145 , bout3] - 1


Any help appreciated.Thanks, MN



--
View this message in context: 
http://r.789695.n4.nabble.com/correcting-a-few-data-in-a-large-data-frame-tp2237834p2237834.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
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] correcting a few data in a large data frame

2010-05-31 Thread Dennis Murphy
Hi:

A simple diagnostic is to check how many distinct run lengths exist
in a row - ideally, it should be one or two. If it's more than two,
something
is amiss. Hence, define f() as a function to determine the number of
distinct
runs in a given row and call the apply() function with it:

f - function(x) length(rle(x)$lengths)
apply(lwf[, -1], 1, f)
1 2 3 4 5 6
1 1 1 2 2 2

HTH,
Dennis

On Mon, May 31, 2010 at 2:29 PM, Mr. Natural drstr...@ucdavis.edu wrote:


 The data frame is lwf that records the survival of bushes over an 8 year
 period. Years are called bouts. Dead bushes are recorded as zeros, and live
 bushes as 1.
 str(lwf)
 'data.frame':   638 obs. of  9 variables:
  $ bushno: int  1 2 3 4 5 6 7 8 9 10 ...
  $ bout1 : int  0 1 0 1 1 1 0 1 0 1 ...
  $ bout2 : int  0 1 0 0 0 0 0 0 0 1 ...
  $ bout3 : int  0 1 0 0 0 0 0 0 0 1 ...
  $ bout4 : int  0 1 0 0 0 0 0 0 0 0 ...
  $ bout5 : int  0 1 0 0 0 0 0 0 0 0 ...
  $ bout6 : int  0 1 0 0 0 0 0 0 0 0 ...
  $ bout7 : int  0 1 0 0 0 0 0 0 0 0 ...
  $ bout8 : int  0 1 0 0 0 0 0 0 0 0 ...

 head(lwf)
  bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
 1  1 0 0 0 0 0 0 0 0
 2  2 1 1 1 1 1 1 1 1
 3  3 0 0 0 0 0 0 0 0
 4  4 1 0 0 0 0 0 0 0
 5  5 1 0 0 0 0 0 0 0
 6  6 1 0 0 0 0 0 0 0

 A number of the data are incorrect. For example, that for bush 145 in year
 three is recorded as dead=0
 when it should be alive =1.  The bushes do not come back to life after
 they die.

  lwf[lw$bushno==145,]
bushno bout1 bout2 bout3 bout4 bout5 bout6 bout7 bout8
 144145 1 1 0 1 1 1 1 1


 I know that I can do this with fix(lwf) or edit(lwf). However, I would like
 to learn some more R.
 What code could I use to correct these data?

 I have been screwing around with such as
 lwfb[(lwf$bushno==145)  (lwf$bout3==0),0]- lwf[(lwf$bushno==145) 
 (lwf$bout3==0),1]
 to no avail.
 Any help appreciated.Thanks, MN



 --
 View this message in context:
 http://r.789695.n4.nabble.com/correcting-a-few-data-in-a-large-data-frame-tp2237834p2237834.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.


[[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.


  1   2   >