[R] forest plots in column

2008-09-23 Thread carol white
Hi,
Is it possible to display different forest plots in the same
graphical device (in the same fashion as par(mfrow())) or ideally,
display the forest plot of different data in column, labels on the
left, data points and CI on the right having the same zero?

Any suggestion is welcome.

Best,

Carol 



  
[[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] Unordered multinomial logistic regression with repeated measures

2008-09-23 Thread Naomi Richmond
> Hello
> 
> I would like to know if there is a command in R software for an
> unordered multinomial logistic regression with repeated measures using
> GEE?
> 
> Any help will be appreciated.
> 
> Kind regards
> 
> Naomi Richmond.

[[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 set rownames / colnames for matrices in a list

2008-09-23 Thread Antje
Thanks for the hint with the "dimnames". I found a rather similar problem in 
the mailing list solved like this:


x <- matrix(1:4,2)
y <- matrix(5:8,2)

z <- list(x,y)
nm <- c("a","b")
nms <- list(nm,nm)

z <- lapply(z,function(x){
dimnames(x)<-nms
x
})

Is there anything wrong using a list instead of an array???

Antje



Alain Guillet schrieb:

Hi,

If all your matrices have the same size, you should work with an array 
and not with a list. Then you can use dimnames to set the names of the 
rows, columns, and so on..


Alain

Antje wrote:

Hello,

I have another stupid question. I hope you can give me a hint how to 
solve this:


I have a list and one element is again a list containing matrices, all 
of the same dimensions. Now, I'd like to set the dimnames for all 
matrices:


example code:

m1 <- matrix(1:25, nrow=5)
m2 <- matrix(26:50, nrow=5)
# ... there can be much more than two matrices

l <- list()
l[[1]] <- list(m1,m2)

r_names <- LETTERS[1:5]
c_names <- LETTERS[6:10]

? how can I apply these names to any number of matrices within this 
list-list ?


Ciao,
Antje

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Help for SUR model

2008-09-23 Thread Arne Henningsen
Hi Bill!

On Monday 22 September 2008 23:53, Xianchun Liao wrote:
> I am an R beginner and trying to run a SUR model in R framework.
>
>
>
> subset(esasp500, Obs <=449 & Obs>=197, select = -Date) ->ev13sub
>
> c(Obs>=397) & c(Obs<=399) ->d13
>
> c(Obs>=400) & c(Obs<=449) ->f13
>
> SP500*f13 ->SP500f13
>
>
>
> BBC~SP500+d13+SP500f13  ->sur132
>
> BOW~SP500+d13+SP500f13  ->sur133
>
> CSK~SP500+d13+SP500f13  ->sur134
>
> DTC~SP500+d13+SP500f13  ->sur135
>
> GP~SP500+d13+SP500f13   ->sur136
>
> HAN~SP500+d13+SP500f13  ->sur137
>
> IP~SP500+d13+SP500f13   ->sur138
>
> KMB~SP500+d13+SP500f13  ->sur139
>
> LPX~SP500+d13+SP500f13  ->sur1310
>
> MWV~SP500+d13+SP500f13  ->sur1311
>
> PCH~SP500+d13+SP500f13  ->sur1312
>
> PCL~SP500+d13+SP500f13  ->sur1313
>
> PNR~SP500+d13+SP500f13  ->sur1314
>
> POP~SP500+d13+SP500f13  ->sur1315
>
> SON~SP500+d13+SP500f13  ->sur1316
>
> TIN~SP500+d13+SP500f13  ->sur1317
>
> W~SP500+d13+SP500f13->sur1318
>
> WPP~SP500+d13+SP500f13  ->sur1319
>
> WY~SP500+d13+SP500f13   ->sur1320
>
>
>
> system13 <- list(sur132, sur133, sur134, sur135, sur136, sur137, sur138,
> sur139, sur1310, sur1311, sur1312, sur1313, sur1314, sur1315, sur1316,
> sur1317, sur1318,sur1319,sur1320)
>
> labels13 <-
> ist("sur132","sur133","sur134","sur135","sur136","sur137","sur138","sur1
> 39","sur1310","sur1311","sur1312","sur1313","sur1314","sur1315","sur1316
> ","sur1317","sur1318","sur1319","sur1320")
>
> res13 <- systemfit("SUR", system13,labels13, data=ev13sub)
>
> summary(res13)
>
>
>
> But the results show  Error: could not find function "systemfit".

This error message indicates that you haven't loaded the "systemfit" package.
Please load it with the command
R> library( "systemfit" )
and try again. If you cannot load the package, you have to install it first:
R> install.packages( "systemfit" )

Best wishes,
Arne

> So, how to write a R code to implement the formula and get right
> results.
>
>
>
>
>
> Thanks,
>
>
>
> Bill
>
>
>
>
>
>
>   [[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.

-- 
Arne Henningsen
arne(dot)henningsen(at)googlemail(dot)com
http://www.arne-henningsen.name

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Predictive Analytics event Oct 24-25 (DC) and Nov 6-7 (SF)

2008-09-23 Thread Elise Johnson

Hi, I wanted to make sure you were all aware of these upcoming events. There
is a seminar in Predictive Analytics on Oct. 24-25 in DC, and in San
Francisco Nov 6-7.  This is intensive training for managers, marketers, and
IT people who need to make sense of customer data to predict buying
behavior, profit, etc.  Past attendees have given rave reviews. 

You can find more info at
http://www.predictionimpact.com/predictive-analytics-training.html, e-mail
[EMAIL PROTECTED], or call (415) 683-1146.

thanks --Elise Johnson, Prediction Impact

-- 
View this message in context: 
http://www.nabble.com/Predictive-Analytics-event-Oct-24-25-%28DC%29-and-Nov-6-7-%28SF%29-tp19622682p19622682.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] R-2.7.2 infected?

2008-09-23 Thread Peter Dalgaard
Peter Dalgaard wrote:
> Dave DeBarr wrote:
>>> Did you check the md5 checksum on it?
>>> 
>>
>> Yes; it matched: 540090dd892657804d1099c54d6f770d
>>
>>   
> And it is binary identical to the Austria CRAN one.
>>  
>>> You're the first to report it, and 2.7.2 has been out for almost a
>>> month, so I think it's likely that the CRAN copy is uninfected.
>>> 
>>
>> Sounds promising.  Perhaps it's a false positive from eTrust.
>>
>>
>>   
> Likely. A quick Googling indicates that other programs have been
> "caught" too.
> This link is illuminative:
> http://www.cccp-project.net/forums/index.php?topic=2897.0

(I wanted to do the same thing with R, but http://www.virustotal.com has
a 20M cap on the file size.)

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building binary package fails because of missing dependent package

2008-09-23 Thread Uwe Ligges



Hans-Peter Suter wrote:

On an (Intel Leopard) Mac I try to build a package (mxFinance) which
depends on another package (mxGraphics). The dependendy is 1) a
'Depends:' in DESCRIPTION and 2) an import in NAMESPACE.

- The build fails if the dependent package (mxGraphics) is not
installed in the R.framework

Do I need to have installed all packages which are required by
packages to be built binary (source builds are ok)?



You *may* have to install them depending on the strength of the 
dependency - such as in the case you reported below.


Uwe Ligges



Cheers,
Hans-Peter


---
Macintosh:mxFinance chappi$ R CMD BUILD --binary mxFinance
* checking for file 'mxFinance/DESCRIPTION' ... OK
* preparing 'mxFinance':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* removing junk files
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building binary distribution
* Installing *source* package 'mxFinance' ...
** libs
** arch - i386
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
-fPIC  -g -O2 -march=nocona -c init.c -o init.o
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99 -dynamiclib
-Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o mxFinance.so init.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
ld: warning, duplicate dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib
** arch - ppc
gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/ppc
-I/usr/local/include-fPIC  -g -O2 -c init.c -o init.o
gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99 -dynamiclib
-Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o mxFinance.so init.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
ld: warning, duplicate dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib
** R
** data
** preparing package for lazy loading
Loading required package: mxGraphics
Warning in library(pkg, character.only = TRUE, logical.return = TRUE,
lib.loc = lib.loc) :
  there is no package called 'mxGraphics'
Error: package 'mxGraphics' could not be loaded
Execution halted
ERROR: lazy loading failed for package 'mxFinance'
** Removing 
'/var/folders/xr/xr01D7JAEtGe4S5uaDQSgTI/-Tmp-/Rinst881133514/mxFinance'
 ERROR
* installation failed

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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.7.2 infected?

2008-09-23 Thread Ajay ohri
This is what it does. It seems like a false alarm because in case of
actual infection it seems
quite conspicious

Ajay

www.decisionstats.com



http://www.spywareguide.com/product_show.php?id=2569


Full Name:
Win32.AdClicker Websearch   Read More
Type:Trojan
SG Index: 5 [Explain]
Removal tools:List of products that detect/remove/protect against
Win32.AdClicker:
Desktop Anti-malware: Pro User: X-Cleaner
Control IM and P2P use, block spyware and other malware: RTGuardian
Endpoint Spyware Remediation: Greynet Enterprise Manager
IM, P2P control, malware prevention and web filtering in single
appliance: Unified Security Gateway
Category Description:A Trojan is a program that enables an attacker to
get nearly complete control over an infected PC. Frequently used tool
by malicious hackers. When this program executes, the program performs
a specific set of actions. This usually works toward the goal of
allowing the trojan to survive on a system and open up a backdoor

.
Comment:This Trojan downloads many executable.It changes the
autostarter randomly. It also hijacks the desktop and puts a wall
paper saying that the system is affected and advertises a sites
?smart-security.info?.It duplicates each and every file which the user
creates with the same name and in the same Directory.


Properties:
 Adds other software
 Autostarts/Stays Resident
 Installs Through Exploit
 Opens ports
On Tue, Sep 23, 2008 at 1:29 PM, Peter Dalgaard
<[EMAIL PROTECTED]> wrote:
>
> Peter Dalgaard wrote:
> > Dave DeBarr wrote:
> >>> Did you check the md5 checksum on it?
> >>>
> >>
> >> Yes; it matched: 540090dd892657804d1099c54d6f770d
> >>
> >>
> > And it is binary identical to the Austria CRAN one.
> >>
> >>> You're the first to report it, and 2.7.2 has been out for almost a
> >>> month, so I think it's likely that the CRAN copy is uninfected.
> >>>
> >>
> >> Sounds promising.  Perhaps it's a false positive from eTrust.
> >>
> >>
> >>
> > Likely. A quick Googling indicates that other programs have been
> > "caught" too.
> > This link is illuminative:
> > http://www.cccp-project.net/forums/index.php?topic=2897.0
>
> (I wanted to do the same thing with R, but http://www.virustotal.com has
> a 20M cap on the file size.)
>
> --
>   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
>  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
>  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
> ~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



--
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
 Hi R-helpers,

I have two queries relating to generalising to n dimensions:

What I want to do in the first one is generalise the following statement:
expand<-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers
and expand.grid gives every combination of the set of numbers, so for
example, expand.grid(1:2, 1:3) takes 1,2 and 1,2,3  and gives 1,1   2,1
1,2   2,2   1,3   2,3
My x vector has varying lengths and I can't find a way of giving it every
set without stating each set individually.

Secondly and similarly, I want to get the table within crosstable that has
the elements defined by the combinations given in expand above
crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] where
crosstable is just a crosstabulation of an n+2-dimensional dataset and I am
trying to pick out those that are in combination 'd' of expand.
So for example, using x[1]=2 and x[2]=3 as above example, if d =2 then the
order is 2,1 so I take crosstable[,,2,1].

Can anyone suggest a way to give the code every set without stating each set
individually?

Thank you

[[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] odds ratio: how to create reference

2008-09-23 Thread Bunny, lautloscrew.com

HI there,

i know this is a basic question, though i need some help because this  
is somewhat away from my current issue, but nevertheless interesting  
to me... Lets assume i have some estimated probabilities, say  
estimated by a logit model. i know i can also state them as an odds  
ratio.


Now i´d like to state these odds ratios as a reference to a specific  
outcome of my investigated variable.


for example, if my covariate of interest is race and possible outcomes  
are white, black and hispanic, whereas the latter are minorities in my  
case - how can i state the odds ratio in such a way that white is the  
reference (always 1) and other races' odds ratio are relative to the  
reference. e.g. hispanics are 1.5 times more likely to ...


Is creating 3 binary dummies for race the right way  ? And if so how  
can i go on.
As i said, i know this is rather basic, i am thankful for any links /  
references...


thanks in advance !

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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: subscript out of bounds.

2008-09-23 Thread Patrick Burns

There is a good reason for the error in the
matrix case.  Consider what would need to
happen for:

m[3, 5] <- 100

to work.

Consistency might be a good thing here, but
if so I think it should be an error for the 1-D
case.  This might be a useful difference between
1-D arrays and vectors.  However, it isn't clear
(to me at least) what such a change would break.


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Rolf Turner wrote:


Consider:

> x <- array(1:12,dim=12)
> x[13]
[1] NA]
> m <- array(1:12,dim=c(3,4))
> m[3,5]
Error: subscript out of bounds

Can anyone tell me it there is a Good Reason for the difference in 
behaviour
between 1 dimensional and higher dimensional arrays?  In a bit of code 
that
I was working on I expected the NA behaviour and didn't get it of 
course.  Then

I had to take evasive action to avoid the error.

Naive young thing that I am, I would prefer the NA behaviour to be 
universal.

But I expect that, as usual, I'm overlooking something.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] lme problems

2008-09-23 Thread Mark Difford

Hi Tommaso,

>> I struggle to understand the discrepancy in df between the anova and lme,
>> and the 
>> fact that the interaction term is not significant in the anova but
>> significant in lme.

To begin with, why try to compare things that are obviously quite different?
Surely you can see that the error structure of the two models are different?

aov(Mean1~treatment*layingday+Error(male.pair/treatment/layingday))
lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)

If you want to compare them then at least make them "equal," otherwise what
is the point? (And one might ask, What is the point, anyway?)

## This would be a reasonable comparison
aov(Mean1~treatment*layingday+Error(male.pair))
lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)

Regards, Mark.


Tommaso Pizzari wrote:
> 
> Hi, 
> I'm analysing a dataset in which the same 5 subjects (male.pair) were
> subjected to two treatments (treatment) and were measured for 12
> successive days within each treatment (layingday). Overall 5*2*12=120
> observations. 
> 
> I want to test the effect of treatment, time (layingday) and their
> interaction. I have done so through the ANOVA below:
> 
>> bmc3<-aov(Mean1~treatment*layingday+Error(male.pair/treatment/layingday))
>> summary(bmc3)
> 
> Error: male.pair
>   Df  Sum Sq Mean Sq F value Pr(>F)
> Residuals  1 0.13850 0.13850   
> 
> Error: male.pair:treatment
>   Df  Sum Sq Mean Sq
> treatment  1 0.60525 0.60525
> 
> Error: male.pair:treatment:layingday
>   Df  Sum Sq Mean Sq
> layingday  1 0.64037 0.64037
> 
> Error: Within
>  Df  Sum Sq Mean Sq F valuePr(>F)
> treatment 1 0.02015 0.02015  0.73400.3934
> layingday 1 0.52937 0.52937 19.2878 2.545e-05 ***
> treatment:layingday   1 0.02959 0.02959  1.07820.3013
> Residuals   113 3.10135 0.02745  
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> 
> I then wanted to compare this outcome with an lme, and used the model
> below. However, its outcome doesn't make much sense to me. 
> 
>> bmc4<- lme(Mean1 ~ treatment*layingday, random = ~1|male.pair)
>> summary(bmc4)
> Linear mixed-effects model fit by REML
>  Data: NULL 
> AIC   BIC   logLik
>   -118.4522 -101.9306 65.22609
> 
> Random effects:
>  Formula: ~1 | male.pair
> (Intercept)  Residual
> StdDev:   0.1313573 0.1185902
> 
> Fixed effects: Mean1 ~ treatment * layingday 
>  Value  Std.Error  DF   t-value p-value
> (Intercept)  0.5311005 0.09369140 112  5.668615  0.
> treatment0.0495373 0.04616116 112  1.073138  0.2855
> layingday   -0.0488055 0.00991701 112 -4.921389  0.
> treatment:layingday  0.0138449 0.00627207 112  2.207388  0.0293
>  Correlation: 
> (Intr) trtmnt lyngdy
> treatment   -0.739  
> layingday   -0.688  0.838   
> treatment:layingday  0.653 -0.883 -0.949
> 
> Standardized Within-Group Residuals:
> Min  Q1 Med  Q3 Max 
> -2.44529424 -0.68505388  0.01663401  0.59009515  3.53354000 
> 
> Number of Observations: 120
> Number of Groups: 5 
> 
> I struggle to understand the discrepancy in df between the anova and lme,
> and the fact that the interaction term is not significant in the anova but
> significant in lme. Any help would be greatly appreciated. 
> Best
> Tom
> 
> -- 
> Dr. Tommaso Pizzari
> Edward Grey Institute, Dept of Zoology, 
> University of Oxford, Oxford OX1 3PS
> Tel: (44) 1865 271279, Fax: (44) 1865 271168
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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://www.nabble.com/lme-problems-tp19616517p19623990.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] read.table & readLines behaviour?

2008-09-23 Thread J . delasHeras


Hi,


I have been using 'read.table' regularly to read tab-delimited text  
files with data. No problem, until now.
Now I have a file that appeared to have read fine, and the data inside  
looks correct (structure etc), except I only had 15000+ rows out of  
the expected 24000. Using 'readLines' instead, and breaking up the  
data by tabs, gives me the expected result.
I do not understand why this is happening and I can't find anything  
obvious in the data to explain the bahaviour...

Does anybody have an explanation? something to watch out for?

If I run this I get the incomplete set:

oldprobesets<-read.table("All_norm_calls.txt",sep="\t",header=T,stringsAsFactors=F)
dim(oldprobesets)

[1] 1573311

but I get the right data if I use:


probesets<-readLines("All_norm_calls.txt")
tmp<-matrix(ncol=11,nrow=24000)
for (i in 1:24000) tmp[i,]<-unlist(strsplit(probesets[i+1],split="\t"))
colnames(tmp)<-unlist(strsplit(probesets[1],split="\t"))
probesets<-data.frame(tmp,stringsAsFactors=F)
dim(probesets)

[1] 2400011


Here's my sessionInfo output:


sessionInfo()

R version 2.7.0 (2008-04-22)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United  
Kingdom.1252;LC_MONETARY=English_United  
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252


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

other attached packages:
[1] limma_2.14.0   svSocket_0.9-5 svIO_0.9-5 R2HTML_1.59svMisc_0.9-5
[6] svIDE_0.9-5

loaded via a namespace (and not attached):
[1] tools_2.7.0


Thanks!

Jose

--
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell & Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Installing R 2.7.2 on Windows with /LOADINF flag doesn't do anything

2008-09-23 Thread michael watson (IAH-C)
Hi

I want to install R from a script, so am following
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-customize-t
he-installation_003f.  

I first installed R with the /SAVEINF="r_install_config.txt" flag and it
created a nice text file for me - perfect.

I then uninstalled R, and re-installed from DOS with:

R-2.7.2-win32.exe /LOADINF="r_install_config.txt"

Windows loaded up the installer anyway, and even worse, none of the
options I had changed were set in the installer, they were still the
defaults.

Am I using that flag incorrectly?!

Thanks
Mick

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generalising to n-dimensions

2008-09-23 Thread Laura Bonnett
 crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]]

crosstable is just a crosstabulation of an n+2-dimensional dataset and I am
trying to pick out those that are in combination 'd' of expand.
So for example, for 5-dimensional data using your example:

 Var1 Var2 Var3
1 111
2 211
3 311
4 121
5 221
6 321
7 112
8 212
9 312
10122
11222
12322

d refers to the row of the matrix above - d=2 is 2,1,1 so
crosstable[,,2,1,1] would retrieve all the data where Var1 =2, Var2=1,
Var3=1 and the two remaining variables are given in the crosstabulations for
all values.

Is that any better?


On Sat, Aug 23, 2008 at 10:40 AM, Robin Hankin <[EMAIL PROTECTED]> wrote:

> First bit:
>
> > x <- c(3,2,2)
> > expand.grid(sapply(x,seq_len))
>  Var1 Var2 Var3
> 1 111
> 2 211
> 3 311
> 4 121
> 5 221
> 6 321
> 7 112
> 8 212
> 9 312
> 10122
> 11222
> 12322
> >
>
>
> second bit I'm not sure about.  I didn't quite get why d=2 implied the
> order is 2,1.
> Could you post a small self-contained example?
>
> HTH
>
> rksh
>
>
>
> Laura Bonnett wrote:
>
>>  Hi R-helpers,
>>
>> I have two queries relating to generalising to n dimensions:
>>
>> What I want to do in the first one is generalise the following statement:
>> expand<-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of
>> integers
>> and expand.grid gives every combination of the set of numbers, so for
>> example, expand.grid(1:2, 1:3) takes 1,2 and 1,2,3  and gives 1,1   2,1
>> 1,2   2,2   1,3   2,3
>> My x vector has varying lengths and I can't find a way of giving it every
>> set without stating each set individually.
>>
>> Secondly and similarly, I want to get the table within crosstable that has
>> the elements defined by the combinations given in expand above
>> crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] where
>> crosstable is just a crosstabulation of an n+2-dimensional dataset and I
>> am
>> trying to pick out those that are in combination 'd' of expand.
>> So for example, using x[1]=2 and x[2]=3 as above example, if d =2 then the
>> order is 2,1 so I take crosstable[,,2,1].
>>
>> Can anyone suggest a way to give the code every set without stating each
>> set
>> individually?
>>
>> Thank you
>>
>>[[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.
>>
>>
>
>
> --
> Robin K. S. Hankin
> Senior Research Associate
> Cambridge Centre for Climate Change Mitigation Research (4CMR)
> Department of Land Economy
> University of Cambridge
> [EMAIL PROTECTED]
> 01223-764877
>
>

[[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] odds ratio: how to create reference

2008-09-23 Thread Eik Vettorazzi

Hi,
You can state a probability p as odds p/(1-p) and vice versa. To get an 
odds ratio you need actually two odds. Then you can get the odds ration 
of being/having "a" instead of "b" by odds(a)/odds(b), where "b" is the 
reference level.
If you fit a logistic regression model (which means that your outcome is 
dichotomous) then the estimated coefficients are actually 
log(oddsratios) - which you can transform to odds by exp() .
You can use a factor-variable with three levels for race and 
treatment-contrasts to get odds ratios for not being white against being 
white - make sure, that either your factor has "white" as first level or 
specify the contrast with the "base" argument.
If you create 3 dummy variables and involve an intercept in your model 
your model will be perfectly collinear - the so called "dummy variable 
trap" - you can use an intercept and create two dummies for the 
covariate levels you are actually interested in and put this in your 
logistic model - the result will be the same as with the treatment 
contrasts.


hth.

Bunny, lautloscrew.com schrieb:

HI there,

i know this is a basic question, though i need some help because this 
is somewhat away from my current issue, but nevertheless interesting 
to me... Lets assume i have some estimated probabilities, say 
estimated by a logit model. i know i can also state them as an odds 
ratio.


Now i´d like to state these odds ratios as a reference to a specific 
outcome of my investigated variable.


for example, if my covariate of interest is race and possible outcomes 
are white, black and hispanic, whereas the latter are minorities in my 
case - how can i state the odds ratio in such a way that white is the 
reference (always 1) and other races' odds ratio are relative to the 
reference. e.g. hispanics are 1.5 times more likely to ...


Is creating 3 binary dummies for race the right way  ? And if so how 
can i go on.
As i said, i know this is rather basic, i am thankful for any links / 
references...


thanks in advance !

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] plot error

2008-09-23 Thread glaporta

HI there,

why these lines of code are correct
plot(count~spray, data = InsectSprays)
plot(InsectSprays$count)

but this return an error:
plot(count, data = InsectSprays);

"data" method is not implemented in plot?!
Thanx, Gianandrea
-- 
View this message in context: 
http://www.nabble.com/plot-error-tp19624873p19624873.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] Generalising to n-dimensions

2008-09-23 Thread Robin Hankin

First bit:

> x <- c(3,2,2)
> expand.grid(sapply(x,seq_len))
  Var1 Var2 Var3
1 111
2 211
3 311
4 121
5 221
6 321
7 112
8 212
9 312
10122
11222
12322
>


second bit I'm not sure about.  I didn't quite get why d=2 implied the 
order is 2,1.

Could you post a small self-contained example?

HTH

rksh



Laura Bonnett wrote:

 Hi R-helpers,

I have two queries relating to generalising to n dimensions:

What I want to do in the first one is generalise the following statement:
expand<-expand.grid(1:x[1],1:x[2],...1:x[n]) where x is a vector of integers
and expand.grid gives every combination of the set of numbers, so for
example, expand.grid(1:2, 1:3) takes 1,2 and 1,2,3  and gives 1,1   2,1
1,2   2,2   1,3   2,3
My x vector has varying lengths and I can't find a way of giving it every
set without stating each set individually.

Secondly and similarly, I want to get the table within crosstable that has
the elements defined by the combinations given in expand above
crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]] where
crosstable is just a crosstabulation of an n+2-dimensional dataset and I am
trying to pick out those that are in combination 'd' of expand.
So for example, using x[1]=2 and x[2]=3 as above example, if d =2 then the
order is 2,1 so I take crosstable[,,2,1].

Can anyone suggest a way to give the code every set without stating each set
individually?

Thank you

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



--
Robin K. S. Hankin
Senior Research Associate
Cambridge Centre for Climate Change Mitigation Research (4CMR)
Department of Land Economy
University of Cambridge
[EMAIL PROTECTED]
01223-764877

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot error

2008-09-23 Thread Barry Rowlingson
2008/9/23 glaporta <[EMAIL PROTECTED]>:
>
> HI there,
>
> why these lines of code are correct
> plot(count~spray, data = InsectSprays)
> plot(InsectSprays$count)
>
> but this return an error:
> plot(count, data = InsectSprays);
>
> "data" method is not implemented in plot?!

 The 'plot' function, like many functions in R, does different things
depending on what its first parameter is...

 For plot(count~spray, data=InsectSprays) the first parameter is a
formula, so what is really called is 'plot.formula'. This gets the
names from the formula (count~spray) finds them in the 'data'
parameter and does a plot.

 For plot(InsectSprays$count) you've taken the 'count' vector out of
the data frame, so the ordinary plot function is called.

 If you do plot(count, data=InsectSprays), then 'count' here is just a
bare word, so R looks up 'count' as an object, but doesn't find it (as
long as there's no 'count' object in your workspace).

 You can do plot(~count, data=InsectSprays), but you get a slightly
different plot than plot(count$InsectSprays). Compare and contrast the
following:

 > is=data.frame(count=runif(10),spray=runif(10))
 > plot(count,data=is)
 Error in plot(count, data = is) : object "count" not found
 > plot(~count,data=is)
 > plot(count~1,data=is)
 > plot(is$count)

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generalising to n-dimensions

2008-09-23 Thread Robin Hankin

Laura Bonnett wrote:

crosstable[,,expand[d,1],expand[d,2],expand[d,3],...expand[d,n]]
 
crosstable is just a crosstabulation of an n+2-dimensional dataset and 
I am trying to pick out those that are in combination 'd' of expand. 
So for example, for 5-dimensional data using your example:
 
 Var1 Var2 Var3

1 111
2 211
3 311
4 121
5 221
6 321
7 112
8 212
9 312
10122
11222
12322
 
d refers to the row of the matrix above - d=2 is 2,1,1 so 
crosstable[,,2,1,1] would retrieve all the data where Var1 =2, Var2=1, 
Var3=1 and the two remaining variables are given in the 
crosstabulations for all values.
 
Is that any better?




OK  I think I understand.  The magic package uses this type of 
construction extensively, but not this particular one.


It's trickier than I'd have expected.

Try this:

f <- function(a,v){
   jj <- 
sapply(dim(a)[seq_len(length(dim(a))-length(v))],seq_len,simplify=FALSE)

   jj <- c(jj , as.list(v))
   do.call("[" , c(list(a) , jj, drop=TRUE))
}



[you will have to coerce the output from expand.grid() to a matrix in 
order to extract a row from it]



HTH

rksh







--
Robin K. S. Hankin
Senior Research Associate
Cambridge Centre for Climate Change Mitigation Research (4CMR)
Department of Land Economy
University of Cambridge
[EMAIL PROTECTED]
01223-764877

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 Map using SAS data

2008-09-23 Thread Roger Bivand
Junjie Zhang  hotmail.com> writes:

> 
> I'd like to plot some maps.  Is it possible for me to use SAS map data in R? 

It is always a good idea to look at the Task Views on CRAN. In the Spatial 
Task View, you'll find a description of what you can do using contributed
packages, but - as you would see be reading the links - this does not
include SAS map data (it is possible that you are not supposed to either,
have you checked?). 

The Task View also points to a special interest list which would probably 
be more relevant for you question, but I'm afraid that finding appropriate 
free geodata sources is generally much harder than plotting the maps.

Roger Bivand

> 
> Best,
> Junjie

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Need help creating spatial correlation for MC simulation

2008-09-23 Thread Roger Bivand
jjh21  gmail.com> writes:

> 
> 
> Thank you for the input.
> 
> Which command in the spatstat package am I looking for? The documentation is
> unclear to me.
> 
> milton ruser wrote:
> > 

> > I think that on spatial stat you will find several ways of simulate
> > spatial
> > pattern that (point or line) that may be what you are looking for. Case
> > not,

> > 
> > On Wed, Sep 17, 2008 at 7:36 PM, jjh21  gmail.com> wrote:
> > 
> >>
> >> I want to create a dataset in R with spatial correlation (i.e.
> >> clustering) 
> >> built in for a linear regression analysis. Any tips on how to do this?

The original question was pretty opaque too. I think that the response from 
both the people who replied was based on your use of the word "clustering", 
which is most often used in spatial statistics with reference to the 
analysis of point patterns.

Since that possibly isn't the case, perhaps you should reformulate your 
question, and consider posting on the R-sig-geo list, after reviewing 
the Spatial Task View on your nearest CRAN mirror. My guess would be that
you are thinking of local indicators of spatial association using areal
data, in which case there are some functions in the spdep package, but
until we know what your actual needs are, it is hard to say. You could,
for example, be looking for some of the tests in the DCluster package,
but we cannot tell.

Roger Bivand

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] odds ratio: how to create reference

2008-09-23 Thread Eik Vettorazzi

You notice that your reference is for the SAS-procedure glm?!

To play around and since you provided no data example I've created some 
data (by an idea from Frank Harrell jr. 
http://www.biostat.wustl.edu/archives/html/s-news/2002-04/msg00103.html)


n <- 30
treat <- rep(c('a','b','c'), length.out=n)
lg<- log(1.2)*(treat=='b')+log(1.5)*(treat=='c')   # here the intercept 
is assumed to be 0 which means that there is an even chance of having 
y=1 or y=0 when treat is 'a'.

y <- ifelse(runif(n) <= plogis(lg), 1, 0)
trf<-as.factor(treat)

To have a first look at the data you can do
table(y,treat)

and you can fit your model via
mm<-glm(y~trf,family=binomial(link="logit"))

and to get your odds ratios
exp(coef(mm))

you may look at the model matrix to see that treatment contrasts 
correspond to use two dummies for "b" and "c" and an intercept term 
(which here refers to the reference level "a")

model.matrix(mm)

hth again.



Bunny, lautloscrew.com schrieb:

Hi,

i found something interesting to me:
http://www.otago.ac.nz/sas/stat/chap39/sect27.htm

 and  i am about to get an idea of the reference thing ( -1 ) , but 
couldn´t connect on the following example:


For the GLM parameterization scheme (PARAM=GLM), the design variables 
are as follows.


Maybe you´ll find some time, to take another look.

thanks in advance



Am 23.09.2008 um 11:36 schrieb Eik Vettorazzi:


Hi,
You can state a probability p as odds p/(1-p) and vice versa. To get 
an odds ratio you need actually two odds. Then you can get the odds 
ration of being/having "a" instead of "b" by odds(a)/odds(b), where 
"b" is the reference level.
If you fit a logistic regression model (which means that your outcome 
is dichotomous) then the estimated coefficients are actually 
log(oddsratios) - which you can transform to odds by exp() .
You can use a factor-variable with three levels for race and 
treatment-contrasts to get odds ratios for not being white against 
being white - make sure, that either your factor has "white" as first 
level or specify the contrast with the "base" argument.
If you create 3 dummy variables and involve an intercept in your 
model your model will be perfectly collinear - the so called "dummy 
variable trap" - you can use an intercept and create two dummies for 
the covariate levels you are actually interested in and put this in 
your logistic model - the result will be the same as with the 
treatment contrasts.


hth.

Bunny, lautloscrew.com schrieb:

HI there,

i know this is a basic question, though i need some help because 
this is somewhat away from my current issue, but nevertheless 
interesting to me... Lets assume i have some estimated 
probabilities, say estimated by a logit model. i know i can also 
state them as an odds ratio.


Now i´d like to state these odds ratios as a reference to a specific 
outcome of my investigated variable.


for example, if my covariate of interest is race and possible 
outcomes are white, black and hispanic, whereas the latter are 
minorities in my case - how can i state the odds ratio in such a way 
that white is the reference (always 1) and other races' odds ratio 
are relative to the reference. e.g. hispanics are 1.5 times more 
likely to ...


Is creating 3 binary dummies for race the right way  ? And if so how 
can i go on.
As i said, i know this is rather basic, i am thankful for any links 
/ references...


thanks in advance !

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790





--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Installing R 2.7.2 on Windows with /LOADINF flag doesn't do anything

2008-09-23 Thread Duncan Murdoch

On 23/09/2008 5:27 AM, michael watson (IAH-C) wrote:

Hi

I want to install R from a script, so am following
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Can-I-customize-t
he-installation_003f.  


I first installed R with the /SAVEINF="r_install_config.txt" flag and it
created a nice text file for me - perfect.

I then uninstalled R, and re-installed from DOS with:

R-2.7.2-win32.exe /LOADINF="r_install_config.txt"

Windows loaded up the installer anyway, and even worse, none of the
options I had changed were set in the installer, they were still the
defaults.

Am I using that flag incorrectly?!


The installer is built with Inno Setup (see www.innosetup.com).  I just 
tried the lines above, and I see that some of the defaults are changed, 
but not all.  The "startup options" do not get saved in the file.  These 
are not standard Inno Setup settings, we customized them for R.


You can avoid the dialogs by using /SILENT or /VERYSILENT command line 
options.


I've asked on the Inno Setup newsgroup whether there is support for 
saving custom options in the INF file.  If so, I'll try to fix this for 
2.8.0.


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] read.table & readLines behaviour?

2008-09-23 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
>
> Hi,
>
>
> I have been using 'read.table' regularly to read tab-delimited text
> files with data. No problem, until now.
> Now I have a file that appeared to have read fine, and the data inside
> looks correct (structure etc), except I only had 15000+ rows out of
> the expected 24000. Using 'readLines' instead, and breaking up the
> data by tabs, gives me the expected result.
> I do not understand why this is happening and I can't find anything
> obvious in the data to explain the bahaviour...
> Does anybody have an explanation? something to watch out for?
Hmm:

- completely blank lines
- filling
- quotes

My bet would be on the last one. Does read.delim work better?

Also, just in case: Check length(probesets) after the readLines call.
>
> If I run this I get the incomplete set:
>> oldprobesets<-read.table("All_norm_calls.txt",sep="\t",header=T,stringsAsFactors=F)
>>
>> dim(oldprobesets)
> [1] 1573311
>
> but I get the right data if I use:
>
>> probesets<-readLines("All_norm_calls.txt")
>> tmp<-matrix(ncol=11,nrow=24000)
>> for (i in 1:24000) tmp[i,]<-unlist(strsplit(probesets[i+1],split="\t"))
>> colnames(tmp)<-unlist(strsplit(probesets[1],split="\t"))
>> probesets<-data.frame(tmp,stringsAsFactors=F)
>> dim(probesets)
> [1] 2400011
>
>
> Here's my sessionInfo output:
>
>> sessionInfo()
> R version 2.7.0 (2008-04-22)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics  grDevices datasets  tcltk utils methods
> [8] base
>
> other attached packages:
> [1] limma_2.14.0   svSocket_0.9-5 svIO_0.9-5 R2HTML_1.59   
> svMisc_0.9-5
> [6] svIDE_0.9-5
>
> loaded via a namespace (and not attached):
> [1] tools_2.7.0
>
>
> Thanks!
>
> Jose
>
> --Dr. Jose I. de las Heras  Email:
> [EMAIL PROTECTED]
> The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
> Institute for Cell & Molecular BiologyFax:   +44 (0)131 6507360
> Swann Building, Mayfield Road
> University of Edinburgh
> Edinburgh EH9 3JR
> UK
>
> --The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R-2.7.2 infected?

2008-09-23 Thread Rory.WINSTON

>could this be an intentional attack to compromise a very popular download, and 
>infect thousands of people.what could be the motivations...i hope its not 
>some corporate thug here

No. False positives are relatively common.


What exactly does the Win32/Adclicker.JO trojan do ???

Ajay
www.decisionstats.com
www.iwannacrib.com

On Tue, Sep 23, 2008 at 9:11 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> Dave DeBarr wrote:
>>
>> I tried downloading R-2.7.2
>> (http://cran.cnr.berkeley.edu/bin/windows/base/R-2.7.2-win32.exe,
>> both from Berkeley and cran) and both times I got a warning from
>> Computer Associates eTrust Antivirus (version 7.1.710) that the
>> Win32/Adclicker.JO trojan was
>> detected:
>> The Win32/Adclicker.JO was detected in
>> C:\USERS\USER\APPDATA\LOCAL\MICROSOFT\WINDOWS\TEMPORARY INTERNET
>> FILES\LOW\CONTENT.IE5\61HAYRTG\R-2.7.2-WIN32[1].EXE.
>>
>> Has anyone else seen this?
>
> You're the first to report it, and 2.7.2 has been out for almost a
> month, so I think it's likely that the CRAN copy is uninfected.  Did
> you check the md5 checksum on it?  It matches on the original, so if
> it doesn't match at your end, you've got a bad download.
>
> If it matches and you still get the virus checker reporting, please
> let me know the details about that infection, and I'll try to do a
> manual inspection for it.
>
> Duncan Murdoch
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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.table & readLines behaviour?

2008-09-23 Thread Gabor Grothendieck
Try looking at the result of count.fields to diagnose it.

On Tue, Sep 23, 2008 at 5:19 AM,  <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>
> I have been using 'read.table' regularly to read tab-delimited text files
> with data. No problem, until now.
> Now I have a file that appeared to have read fine, and the data inside looks
> correct (structure etc), except I only had 15000+ rows out of the expected
> 24000. Using 'readLines' instead, and breaking up the data by tabs, gives me
> the expected result.
> I do not understand why this is happening and I can't find anything obvious
> in the data to explain the bahaviour...
> Does anybody have an explanation? something to watch out for?
>
> If I run this I get the incomplete set:
>>
>>
>> oldprobesets<-read.table("All_norm_calls.txt",sep="\t",header=T,stringsAsFactors=F)
>> dim(oldprobesets)
>
> [1] 1573311
>
> but I get the right data if I use:
>
>> probesets<-readLines("All_norm_calls.txt")
>> tmp<-matrix(ncol=11,nrow=24000)
>> for (i in 1:24000) tmp[i,]<-unlist(strsplit(probesets[i+1],split="\t"))
>> colnames(tmp)<-unlist(strsplit(probesets[1],split="\t"))
>> probesets<-data.frame(tmp,stringsAsFactors=F)
>> dim(probesets)
>
> [1] 2400011
>
>
> Here's my sessionInfo output:
>
>> sessionInfo()
>
> R version 2.7.0 (2008-04-22)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics  grDevices datasets  tcltk utils methods
> [8] base
>
> other attached packages:
> [1] limma_2.14.0   svSocket_0.9-5 svIO_0.9-5 R2HTML_1.59svMisc_0.9-5
> [6] svIDE_0.9-5
>
> loaded via a namespace (and not attached):
> [1] tools_2.7.0
>
>
> Thanks!
>
> Jose
>
> --
> Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
> The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
> Institute for Cell & Molecular BiologyFax:   +44 (0)131 6507360
> Swann Building, Mayfield Road
> University of Edinburgh
> Edinburgh EH9 3JR
> UK
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] odds ratio: how to create reference

2008-09-23 Thread Philip Twumasi-Ankrah
To select another reference level from the default that R chooses you can use 
the "relevel" function

example;

Reorder Levels of Factorwarpbreaks$tension <- relevel(warpbreaks$tension, 
ref="M")
summary(lm(breaks ~ wool + tension, data=warpbreaks))


function findlink(pkg, fn) {
var Y, link;
Y = location.href.lastIndexOf("\\") + 1;
link = location.href.substring(0, Y);
link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
location.href = link;
}

This sets "M" as the reference level for the analysis. At the prompt on the R 
workspace, type

?relevel 

A Smile costs Nothing  
 But Rewards Everything

Happiness is not perfected until it is shared
  -Jane Porter  
  


--- On Tue, 9/23/08, Bunny, lautloscrew.com <[EMAIL PROTECTED]> wrote:
From: Bunny, lautloscrew.com <[EMAIL PROTECTED]>
Subject: [R] odds ratio: how to create reference
To: r-help@r-project.org
Date: Tuesday, September 23, 2008, 4:06 AM

HI there,

i know this is a basic question, though i need some help because this  
is somewhat away from my current issue, but nevertheless interesting  
to me... Lets assume i have some estimated probabilities, say  
estimated by a logit model. i know i can also state them as an odds  
ratio.

Now i´d like to state these odds ratios as a reference to a specific  
outcome of my investigated variable.

for example, if my covariate of interest is race and possible outcomes  
are white, black and hispanic, whereas the latter are minorities in my  
case - how can i state the odds ratio in such a way that white is the  
reference (always 1) and other races' odds ratio are relative to the  
reference. e.g. hispanics are 1.5 times more likely to ...

Is creating 3 binary dummies for race the right way  ? And if so how  
can i go on.
As i said, i know this is rather basic, i am thankful for any links /  
references...

thanks in advance !

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] odds ratio: how to create reference

2008-09-23 Thread Frank E Harrell Jr

Philip Twumasi-Ankrah wrote:

To select another reference level from the default that R chooses you can use the 
"relevel" function

example;

Reorder Levels of Factorwarpbreaks$tension <- relevel(warpbreaks$tension, 
ref="M")
summary(lm(breaks ~ wool + tension, data=warpbreaks))


function findlink(pkg, fn) {
var Y, link;
Y = location.href.lastIndexOf("\\") + 1;
link = location.href.substring(0, Y);
link = link + "../../" + pkg + "/chtml/" + pkg + ".chm::/" + fn;
location.href = link;
}

This sets "M" as the reference level for the analysis. At the prompt on the R 
workspace, type

?relevel 

A Smile costs Nothing  
 But Rewards Everything


Happiness is not perfected until it is shared
  -Jane Porter


These calculations are automatic using the Design package, e.g.

dd <- datadist(d); options(datadist='d')
f <- lrm(y ~ pol(age,2)*sex+rcs(weight,4), data=d)
summary(f, sex='m')   # makes 'm' the reference cell if you don't like 
the default; gives odds ratios


For the sex OR age is set to the median (default; easily changed; 
doesn't matter if interaction term omitted).


Bunny in your original post it would be less confusing if you did not 
call levels of an independent variable the outcomes.  Many people refer 
to the dependent variable as the outcome variable.


Frank





--- On Tue, 9/23/08, Bunny, lautloscrew.com <[EMAIL PROTECTED]> wrote:
From: Bunny, lautloscrew.com <[EMAIL PROTECTED]>
Subject: [R] odds ratio: how to create reference
To: r-help@r-project.org
Date: Tuesday, September 23, 2008, 4:06 AM

HI there,

i know this is a basic question, though i need some help because this  
is somewhat away from my current issue, but nevertheless interesting  
to me... Lets assume i have some estimated probabilities, say  
estimated by a logit model. i know i can also state them as an odds  
ratio.


Now i´d like to state these odds ratios as a reference to a specific  
outcome of my investigated variable.


for example, if my covariate of interest is race and possible outcomes  
are white, black and hispanic, whereas the latter are minorities in my  
case - how can i state the odds ratio in such a way that white is the  
reference (always 1) and other races' odds ratio are relative to the  
reference. e.g. hispanics are 1.5 times more likely to ...


Is creating 3 binary dummies for race the right way  ? And if so how  
can i go on.
As i said, i know this is rather basic, i am thankful for any links /  
references...


thanks in advance !



--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Coefficients, OR and 95% CL

2008-09-23 Thread Eik Vettorazzi

l.mod<-glm(menarche~age,binomial)

you will get odds-ratios by exponentiating the coefficients of this 
model, so


exp(coef(l.mod))

will do this job. You may notice that this will produce an "OR" for the 
intercept part as well - which is not interpretable.
For the confidence intervals for this odds ratio you have to 
exponentiate the borders of the "standard" confidence intervals for the 
log-odds-ratios,


exp(confint(l.mod))

hth.

Luciano La Sala schrieb:

Dear R-users,

After running a logistic regression, I need to calculate OR by exponentiating the coefficient, and then I need the 95% CL for the OR as well. For the following example (taken from P. Dalaagard's book), what would be the most straightforward method of getting what I need? Could anyone enlight me please?   


Thank you!
Lucho 

  

summary(glm(menarche~age,binomial))



Call:
glm(formula = menarche ~ age, family = binomial)

Deviance Residuals: 
 Min1QMedian3Q   Max  
-4.68654  -0.13049  -0.01067   0.09608   2.35254  


Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -17.9175 1.7074  -10.49   <2e-16 ***

age   1.3549 0.1296   10.45   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 


(Dispersion parameter for binomial family taken to be 1)

Null deviance: 974.31  on 703  degrees of freedom
Residual deviance: 223.95  on 702  degrees of freedom
  (635 observations deleted due to missingness)
AIC: 227.95

Number of Fisher Scoring iterations: 9






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  


--
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/42803-8243
F ++49/40/42803-7790

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Coefficients, OR and 95% CL

2008-09-23 Thread Nutter, Benjamin
You might also consider

?confint

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jorge Ivan Velez
Sent: Monday, September 22, 2008 5:36 PM
To: Luciano La Sala
Cc: R mailing list
Subject: Re: [R] Coefficients, OR and 95% CL

Dear Luciano,
See ?logistic.display in the epicalc package. If glm1 is your model,
something like

logistic.display(glm1)

should do the job.


HTH,


Jorge


On Mon, Sep 22, 2008 at 5:28 PM, Luciano La Sala
<[EMAIL PROTECTED]>wrote:

> Dear R-users,
>
> After running a logistic regression, I need to calculate OR by
> exponentiating the coefficient, and then I need the 95% CL for the OR
as
> well. For the following example (taken from P. Dalaagard's book), what
would
> be the most straightforward method of getting what I need? Could
anyone
> enlight me please?
>
> Thank you!
> Lucho
>
> > summary(glm(menarche~age,binomial))
>
> Call:
> glm(formula = menarche ~ age, family = binomial)
>
> Deviance Residuals:
> Min1QMedian3Q   Max
> -4.68654  -0.13049  -0.01067   0.09608   2.35254
>
> Coefficients:
>Estimate Std. Error z value Pr(>|z|)
> (Intercept) -17.9175 1.7074  -10.49   <2e-16 ***
> age   1.3549 0.1296   10.45   <2e-16 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> (Dispersion parameter for binomial family taken to be 1)
>
>Null deviance: 974.31  on 703  degrees of freedom
> Residual deviance: 223.95  on 702  degrees of freedom
>  (635 observations deleted due to missingness)
> AIC: 227.95
>
> Number of Fisher Scoring iterations: 9
>
>
>
>
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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.


===

P Please consider the environment before printing this e-mail

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News & World Report (2008).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use\...{{dropped:13}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Coefficients, OR and 95% CL

2008-09-23 Thread Frank E Harrell Jr

Eik Vettorazzi wrote:

l.mod<-glm(menarche~age,binomial)

you will get odds-ratios by exponentiating the coefficients of this 
model, so


exp(coef(l.mod))

will do this job. You may notice that this will produce an "OR" for the 
intercept part as well - which is not interpretable.
For the confidence intervals for this odds ratio you have to 
exponentiate the borders of the "standard" confidence intervals for the 
log-odds-ratios,


exp(confint(l.mod))

hth.


The approach of anti-logging a coefficient only works in the simple case 
in which the variable is binary (or a one-unit change is of interest and 
the variable is linear), doesn't interact with another variable, and the 
reference cell desired equals the reference cell coded.


Frank



Luciano La Sala schrieb:

Dear R-users,

After running a logistic regression, I need to calculate OR by 
exponentiating the coefficient, and then I need the 95% CL for the OR 
as well. For the following example (taken from P. Dalaagard's book), 
what would be the most straightforward method of getting what I need? 
Could anyone enlight me please?  
Thank you!

Lucho
 

summary(glm(menarche~age,binomial))



Call:
glm(formula = menarche ~ age, family = binomial)

Deviance Residuals:  Min1QMedian3Q   Max  
-4.68654  -0.13049  -0.01067   0.09608   2.35254 
Coefficients:
Estimate Std. Error z value Pr(>|z|)(Intercept) 
-17.9175 1.7074  -10.49   <2e-16 ***

age   1.3549 0.1296   10.45   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)

Null deviance: 974.31  on 703  degrees of freedom
Residual deviance: 223.95  on 702  degrees of freedom
  (635 observations deleted due to missingness)
AIC: 227.95

Number of Fisher Scoring iterations: 9






__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.
  





--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-23 Thread claus-juergen . neumann
   
 Claus-Juergen 
 Neumann/BASF-AG/B 
 ASFAn 
r-help@r-project.org   
 23.09.2008 12:49Kopie 
   
 Thema 
Problem during porting R-2.7.2 on  
HP-UP 11.11 PA-Risc
   
   
   
   
   
   







Dear "R"-Team,
we had some problem to install R-2.7.2 on HP-UX 11.11 on PA-Risc platform.

1.) i load down the Software and made a extract of the tar-file in a
specific Directory.

2.) i follow the instructions on the INSTALL file:
 ./configure

3.) during "configure" we got a error message see below:
 checking for history_truncate_file... no
 configure: error: --with-readline=yes (default) and headers/libs are
not available

and the "configure" stops.


on the HP-UX server there are the HP Compiler and the GNU compiler with
gmake and and ... installed.
Please have a look to my logfiles. Hopefully you had a idea what we can do.
Thanks a lot for your help

(See attached file: BASF_CONFIGURE.log.txt)(See attached file:
config.log.txt)

very best regards
Claus-Juergen Neumann

Global R&D Information Technology and Information Management


Phone: +49 621 60-27453, Mobile: +49 172 7437400, Fax: +49 621 60-27092,
E-Mail: [EMAIL PROTECTED]
Postal Address: BASF SE, AP/CLS - LI444, D-67117 Limburgerhof, Germany


BASF - The Chemical Company


BASF SE, Registered Office: 67056 Ludwigshafen, Germany
Companies' Register: Amtsgericht Ludwigshafen, Registration No.: HRB 6000
Chairman of the Supervisory Board: Juergen Strube
Board of Executive Directors:
Juergen Hambrecht, Chairman; Eggert Voscherau, Vice Chairman;
Kurt Bock, Martin Brudermueller, John Feldmann, Andreas Kreimeyer, Stefan
Marcinowski, Harald Schwager__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-23 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
>
>  Claus-Juergen 
>  Neumann/BASF-AG/B 
>  ASFAn 
> r-help@r-project.org   
>  23.09.2008 12:49Kopie 
>
>  Thema 
> Problem during porting R-2.7.2 on  
> HP-UP 11.11 PA-Risc
>
>
>
>
>
>
>
>
>
>
>
>
>
> Dear "R"-Team,
> we had some problem to install R-2.7.2 on HP-UX 11.11 on PA-Risc platform.
>
> 1.) i load down the Software and made a extract of the tar-file in a
> specific Directory.
>
> 2.) i follow the instructions on the INSTALL file:
>  ./configure
>
> 3.) during "configure" we got a error message see below:
>  checking for history_truncate_file... no
>  configure: error: --with-readline=yes (default) and headers/libs are
> not available
>
> and the "configure" stops.
>
>
> on the HP-UX server there are the HP Compiler and the GNU compiler with
> gmake and and ... installed.
> Please have a look to my logfiles. Hopefully you had a idea what we can do.
> Thanks a lot for your help
>   
Attachments are chopped by the mailing list softare, and the r-devel
list would have been a better choice.

Anyways, the error is what it says: You are trying to use the readline
library and it or its headers isn't there (at least not where configure
looks for it). So either install them or use --with-readline=no and live
without commandline recall. This is explained  at a number of places in
http://cran.r-project.org/doc/manuals/R-admin.html (search for "readline").
> (See attached file: BASF_CONFIGURE.log.txt)(See attached file:
> config.log.txt)
>
> very best regards
> Claus-Juergen Neumann
>
> Global R&D Information Technology and Information Management
>
>
> Phone: +49 621 60-27453, Mobile: +49 172 7437400, Fax: +49 621 60-27092,
> E-Mail: [EMAIL PROTECTED]
> Postal Address: BASF SE, AP/CLS - LI444, D-67117 Limburgerhof, Germany
>
>
> BASF - The Chemical Company
>
>
> BASF SE, Registered Office: 67056 Ludwigshafen, Germany
> Companies' Register: Amtsgericht Ludwigshafen, Registration No.: HRB 6000
> Chairman of the Supervisory Board: Juergen Strube
> Board of Executive Directors:
> Juergen Hambrecht, Chairman; Eggert Voscherau, Vice Chairman;
> Kurt Bock, Martin Brudermueller, John Feldmann, Andreas Kreimeyer, Stefan
> Marcinowski, Harald Schwager
> 
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-23 Thread Martyn Plummer
On Tue, 2008-09-23 at 15:35 +0200, Peter Dalgaard wrote:
> [EMAIL PROTECTED] wrote:
> >
> >  Claus-Juergen 
> >  Neumann/BASF-AG/B 
> >  ASFAn 
> > r-help@r-project.org   
> >  23.09.2008 12:49Kopie 
> >
> >  Thema 
> > Problem during porting R-2.7.2 on  
> > HP-UP 11.11 PA-Risc
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Dear "R"-Team,
> > we had some problem to install R-2.7.2 on HP-UX 11.11 on PA-Risc platform.
> >
> > 1.) i load down the Software and made a extract of the tar-file in a
> > specific Directory.
> >
> > 2.) i follow the instructions on the INSTALL file:
> >  ./configure
> >
> > 3.) during "configure" we got a error message see below:
> >  checking for history_truncate_file... no
> >  configure: error: --with-readline=yes (default) and headers/libs are
> > not available
> >
> > and the "configure" stops.
> >
> >
> > on the HP-UX server there are the HP Compiler and the GNU compiler with
> > gmake and and ... installed.
> > Please have a look to my logfiles. Hopefully you had a idea what we can do.
> > Thanks a lot for your help
> >   
> Attachments are chopped by the mailing list softare, and the r-devel
> list would have been a better choice.
> 
> Anyways, the error is what it says: You are trying to use the readline
> library and it or its headers isn't there (at least not where configure
> looks for it). So either install them or use --with-readline=no and live
> without commandline recall. This is explained  at a number of places in
> http://cran.r-project.org/doc/manuals/R-admin.html (search for "readline").

Don't forget to also read the platform-specific notes on HP-UX in
appendix C.5 of the same document.  This may help you with any further
problems.


> > (See attached file: BASF_CONFIGURE.log.txt)(See attached file:
> > config.log.txt)
> >
> > very best regards
> > Claus-Juergen Neumann


---
This message and its attachments are strictly confidenti...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-23 Thread claus-juergen . neumann

Dear "R"-Team,
we had some problem to install R-2.7.2 on HP-UX 11.11 on PA-Risc platform.

1.) i load down the Software and made a extract of the tar-file in a
specific Directory.

2.) i follow the instructions on the INSTALL file:
 ./configure

3.) during "configure" we got a error message see below:
 checking for history_truncate_file... no
 configure: error: --with-readline=yes (default) and headers/libs are
not available

and the "configure" stops.


on the HP-UX server there are the HP Compiler and the GNU compiler with
gmake and and ... installed.
Please have a look to my logfiles. Hopefully you had a idea what we can do.
Thanks a lot for your help

(See attached file: BASF_CONFIGURE.log.txt)(See attached file:
config.log.txt)

very best regards
Claus-Juergen Neumann

Global R&D Information Technology and Information Management


Phone: +49 621 60-27453, Mobile: +49 172 7437400, Fax: +49 621 60-27092,
E-Mail: [EMAIL PROTECTED]
Postal Address: BASF SE, AP/CLS - LI444, D-67117 Limburgerhof, Germany


BASF - The Chemical Company


BASF SE, Registered Office: 67056 Ludwigshafen, Germany
Companies' Register: Amtsgericht Ludwigshafen, Registration No.: HRB 6000
Chairman of the Supervisory Board: Juergen Strube
Board of Executive Directors:
Juergen Hambrecht, Chairman; Eggert Voscherau, Vice Chairman;
Kurt Bock, Martin Brudermueller, John Feldmann, Andreas Kreimeyer, Stefan
Marcinowski, Harald Schwager__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] additional parameters in function called by tapply

2008-09-23 Thread Heidemeier Dr, Joachim
Der R-Gurus,
first apologies if this is a FAQ, but I  due to lack of R-knowledge and 
terminology I wasn't able to find it.
I have the following problem in aggregating results of a model calculation:
The results are yearly values of several parameters with several hierarchical 
spatial factors taken from a database as a data frame with the following 
structure

value | year | spatial1  | spatial2 | spatial3 | parameter
the values are given for spatial1 units, i.e. the com
spatial3 contains one or many spatial2 units, spatial2 contains one or many 
spatial1 units.
The normal aggregation goes in a two step way:

a) summation of the parameter values of the same spatial differentiaton (e.g. 
sums of spatial2 or spatial3)
b) calculation of the average of several years of the sums

for step a I use tapply with the following call

indices <- (list(year,spatial2,parameter)
resultspatial <- tapply(value,indices,sum)

for step b I use apply with the result of a and  a function block_average
block_average <- funcition(value,year,number_of_years_to_average) with the 
parameters value and years as vectors and number_of_years as integer.

When I'm trying to skip the spatial aggregation, i.e. just do the 
block_averaging over years, I have the problem (AFIU the man page), that I 
can't provide the years vector as parameter to the function block_average via 
tapply. What would be the R-ish approach to this problem.
TIA
   joachim heidemeier

--
Dr. Joachim Heidemeier
c/o Umweltbundesamt FG II 2.2
Tel.: +49340 2103-2780
eMail: [EMAIL PROTECTED]




[[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] xyplot problem

2008-09-23 Thread Pascal A. Niklaus
Hi all,

I am trying to produce some panels with dots in an X/Y plane where the 
diameter of the dots indicates a Z value (like e.g. earthquake maps where dot 
sizes indicate magnitudes and X/Y the location).

This works fine with xyplot, e.g.:

xyplot(1:3~1:3,cex=1:3,pch=16)

However, when I do this with a panel variable, e.g.:

x<-rep(1:3,5)
y <- rep(1:3,5)
sz <- rep(1:5,each=3)
grp <- factor(rep(1:5,each=3))
xyplot(y~x | grp , cex=sz)

then sz in the cex argument is not applied per group as I would expect. Same 
for other arguments like col.

Is this really the intended behaviour? 

How can I achieve what I want, i.e., that the cex argument is different for 
the different levels of grp?

Thank you for your help

Pascal Niklaus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] gbm error

2008-09-23 Thread jtf2076

Darrin, what version of R are you using have the same question.  I have been
using the gbm package without problem with R 2.7.1. but I recently switched
computers and downloaded 2.7.2.  I used the following code, which works fine
on my old computer with 2.7.1 but I get an error with the new version.  

> fin.tc5.lr01 <- gbm.step(data=fin, 
+ gbm.x = 7:14,
+ gbm.y = 24,
+ family = "bernoulli",
+ tree.complexity = 5,
+ learning.rate = 0.01,
+ bag.fraction = 0.5)
Error: could not find function "gbm.step"



Darin Brooks wrote:
> 
> Good afternoon
>  
> Has anyone tried using Dr. Elith's BRT script?  I cannot seem to run
> gbm.step  from the installed gbm package.  Is it something external to
> gbm?
>  
> When I run the script itself
>  
> <- gbm.step(data=model.data, 
> 
> gbm.x = colx:coly,
> 
> gbm.y = colz,
> 
> family = "bernoulli",
> 
> tree.complexity = 5,
> 
> learning.rate = 0.01,
> 
> bag.fraction = 0.5)
> 
>  
> ... I keep encountering the same error:
>  
> ERROR:  
>   unexpected ')' in "bag.fraction = 0.5)"
>  
> I've tried all sorts of variations (such as)
>  
> sep22BRT.lr01 <- gbm{data=sep22BRT, 
> gbm.x = sep22BRT[,3:42], 
> gbm.y = sep22BRT[,1], 
> family = "bernoulli", 
> tree.complexity = 5, 
> learning.rate = 0.01, 
> bag.fraction = 0.5}
>  
> and cannot find the problem. 
>  
> Is there a glaring error that I am overlooking? 
>  
>  
> Darin Brooks
> Geomatics/GIS/Remote Sensing Coordinator
> Kim Forest Management Ltd. Cranbrook Office
> Cranbrook, BC
>  
>  
> 
>   [[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://www.nabble.com/gbm-error-tp19614927p19628403.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] Statistical question re assessing fit of distribution functions.

2008-09-23 Thread Ted Byers

Thanks Timur

While assessing whether or not the best option would be a normal
distribution (it won't be, the data in this case LOOKS more poisson, or if I
explude the first week of results, a negative exponential; and in my other
case, cauchy is more likely), I really need a test that can be applied
regardless of the distribution to see which distribution fits best.  Using
log-likelihood, there doesn't seem to be much to choose between exponential
and poisson (the log-likelihhod for them being almost the same, regardless
of the sample even tough the parameters are very different from one sample
to the next - I don't understand why yet), and the others I have tried are
MUCH worse, but I'm not done yet.

Are you aware of functions that allow estimation of all the parameters of a
non-central distribution?  I ask because a problem I'll be working on in a
few weeks will involve the kind of skew produced by a non-central
distribution (among others).  I see some functions allow you to work with
skewed distributions (e.g. "[dpqr]stable  the skewed stable distribution ")
but I have not yet found functions that alow one to estimate their
parameters from real data.

Thanks,

Ted

Timur Shtatland wrote:
> 
> If one of the goals is the normality test, then there may be better
> alternatives to the Kolmogorov-Smirnov test.
> See an explanation on:
> http://graphpad.com/FAQ/viewfaq.cfm?faq=959
> 
> The R implementation:
> ?shapiro.test
> 
> A casual search also turned this up:
> http://tolstoy.newcastle.edu.au/R/help/04/09/3201.html
> http://tolstoy.newcastle.edu.au/R/help/04/08/3121.html
> http://www.karlin.mff.cuni.cz/~pawlas/2008/MAI061/dagost.R
> 
> Best,
> 
> Timur
> --
> Timur Shtatland, Ph.D.
> Senior Bioinformatics Scientist
> Agencourt Bioscience Corporation - A Beckman Coulter Company
> 500 Cummings Center, Suite 2450
> Beverly, MA 01915
> www.agencourt.com
> 
> On Mon, Sep 22, 2008 at 12:26 PM, Ted Byers <[EMAIL PROTECTED]> wrote:
>>
>> I am in a situation where I have to fit a distrution, such as cauchy or
>> normal, to an empirical dataset.  Well and good, that is easy.
>>
>> But I wanted to assess just how good the fit is, using ks.test.
>>
>> I am concerned about the following note in the docs (about the example
>> provided):  "Note that the distribution theory is not valid here as we
>> have
>> estimated the parameters of the normal distribution from the same sample"
>>
>> This implies I should not use ks.test(x,"pnorm",mean =1.187, sd =0.917),
>> where the numbers shown are estimated from 'x'.  If this is so, how do I
>> get
>> a correct test?  I know I can not use different samples because of just
>> how
>> different the parameters are from one sample to the next, so using
>> parameters estimated from the sample from week one to define the
>> distribution function for ks.test will give a poor fit for the data from
>> week two.  And the sample size is small enough that I would not have
>> confidence in the parameters estimated from a portion of a samlpe to fit
>> against the remainder of the sample.
>>
>> Thanks
>>
>> Ted
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Statistical-question-re-assessing-fit-of-distribution-functions.-tp19611539p19611539.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Statistical-question-re-assessing-fit-of-distribution-functions.-tp19611539p19629108.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] xyplot problem

2008-09-23 Thread Henrique Dallazuanna
Is this what you want?

xyplot(y~x | grp,
panel = function(x, y, ...){
panel.xyplot(x, y, cex = 1:3, pch = 19, col = 2:5)
})

On Tue, Sep 23, 2008 at 10:27 AM, Pascal A. Niklaus <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to produce some panels with dots in an X/Y plane where the
> diameter of the dots indicates a Z value (like e.g. earthquake maps where dot
> sizes indicate magnitudes and X/Y the location).
>
> This works fine with xyplot, e.g.:
>
> xyplot(1:3~1:3,cex=1:3,pch=16)
>
> However, when I do this with a panel variable, e.g.:
>
> x<-rep(1:3,5)
> y <- rep(1:3,5)
> sz <- rep(1:5,each=3)
> grp <- factor(rep(1:5,each=3))
> xyplot(y~x | grp , cex=sz)
>
> then sz in the cex argument is not applied per group as I would expect. Same
> for other arguments like col.
>
> Is this really the intended behaviour?
>
> How can I achieve what I want, i.e., that the cex argument is different for
> the different levels of grp?
>
> Thank you for your help
>
> Pascal Niklaus
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] xyplot problem

2008-09-23 Thread Richard . Cotton
> I am trying to produce some panels with dots in an X/Y plane where the 
> diameter of the dots indicates a Z value (like e.g. earthquake maps 
where dot 
> sizes indicate magnitudes and X/Y the location).
> 
> This works fine with xyplot, e.g.:
> 
> xyplot(1:3~1:3,cex=1:3,pch=16)
> 
> However, when I do this with a panel variable, e.g.:
> 
> x<-rep(1:3,5)
> y <- rep(1:3,5)
> sz <- rep(1:5,each=3)
> grp <- factor(rep(1:5,each=3))
> xyplot(y~x | grp , cex=sz)
> 
> then sz in the cex argument is not applied per group as I would expect. 
Same 
> for other arguments like col.
> 
> Is this really the intended behaviour? 
> 
> How can I achieve what I want, i.e., that the cex argument is different 
for 
> the different levels of grp?

Within a panel function, packet.number tells you what the levels of each 
conditioning factor are.  Try something like this:
#x,y,grp as above
mypanelfn <- function(...) panel.xyplot(cex=packet.number(), ...)
xyplot(y~x | grp , panel=mypanelfn)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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.7.2 infected?

2008-09-23 Thread Duncan Murdoch

On 22/09/2008 8:38 PM, Dave DeBarr wrote:

I tried downloading R-2.7.2 
(http://cran.cnr.berkeley.edu/bin/windows/base/R-2.7.2-win32.exe, both from 
Berkeley and cran) and both times I got a warning from Computer Associates 
eTrust Antivirus (version 7.1.710) that the Win32/Adclicker.JO trojan was 
detected:
The Win32/Adclicker.JO was detected in 
C:\USERS\USER\APPDATA\LOCAL\MICROSOFT\WINDOWS\TEMPORARY INTERNET 
FILES\LOW\CONTENT.IE5\61HAYRTG\R-2.7.2-WIN32[1].EXE.

Has anyone else seen this?


It's not R, it's CA:  see the message below.  Is there any way for you 
to post the false positive to their tech support?


Duncan Murdoch


Path: news.jrsoftware.org!not-for-mail
From: Martin Holmes <[EMAIL PROTECTED]>
Newsgroups: jrsoftware.innosetup
Subject: The latest silly antivirus false positive
Date: Tue, 23 Sep 2008 07:43:56 -0700

Hi folks,

CA Antivirus this morning flagged all of my recent InnoSetup-created 
setup exe files as having the Win32/Adclicker.JO trojan in them. CA, by 
default, just deletes infected files, but having been bitten by this 
before, I had set it to quarantine them instead, and was able to restore 
them.


So you might want to prepare for a stack of emails from users who have 
CA AV installed.


Cheers,
Martin


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?

2008-09-23 Thread zhijie zhang
Dear R users,
  I hope to explain the concepts of skewness and kurtosis by generating
series of distributions with same skewness and different kurtosis or  with
same kurtosis and different skewness, but it seems that i cannot find the
right functions.
  I have searched the mailing list, but no answers were found.
  Is it possible to do that in R? Which function could be used?
  Thanks a lot.

-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:+86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
Website: www.statABC.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[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] xyplot problem

2008-09-23 Thread Gabor Grothendieck
xyplot will pass a vector of indices through the subscripts argument
to the panel so try this:

xyplot(y ~ x | grp, panel = function(x, y, subscripts, ...) {
  panel.xyplot(x, y, cex = sz[subscripts], ...)
   }
)

On Tue, Sep 23, 2008 at 9:27 AM, Pascal A. Niklaus <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to produce some panels with dots in an X/Y plane where the
> diameter of the dots indicates a Z value (like e.g. earthquake maps where dot
> sizes indicate magnitudes and X/Y the location).
>
> This works fine with xyplot, e.g.:
>
> xyplot(1:3~1:3,cex=1:3,pch=16)
>
> However, when I do this with a panel variable, e.g.:
>
> x<-rep(1:3,5)
> y <- rep(1:3,5)
> sz <- rep(1:5,each=3)
> grp <- factor(rep(1:5,each=3))
> xyplot(y~x | grp , cex=sz)
>
> then sz in the cex argument is not applied per group as I would expect. Same
> for other arguments like col.
>
> Is this really the intended behaviour?
>
> How can I achieve what I want, i.e., that the cex argument is different for
> the different levels of grp?
>
> Thank you for your help
>
> Pascal Niklaus
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Summing up columns with NA elements in a data frame

2008-09-23 Thread ravi
Hi all,
When I try to sum a few columns in a data frame (which has NA’s randomly 
distributed as elements), I am not able to get the summing operation to ignore 
the NA’s.
Let me explain with the following code :
 
a<-structure(list(a1 = c(NA, 2, 3, NA, 5, 6, NA, 8, 9, NA), a2 = c(NA,
+ 4, 5, 5, NA, 7, 8, 8, NA, 10), a3 = c(2, NA, 6, 8, NA, 12, 14,
+ NA, 18, 20)), .Names = c("a1", "a2", "a3"), row.names = c(NA,
+ -10L), class = "data.frame")
print(a)
a$a4<-a$a1+a$a2+a$a3 #method 1
print(a)
b<-apply(a,1,sum) #method 2
print(b)
d<-apply(a,1,FUN=function(x) (sum(x),na.rm=T)) # not the right syntax, 
apparently - method 3
print(d)
## 
I would like to know how to make the na.rm=T to work, or any other solution. 
I am also mystified by the following result :
 
attach(a)
a$a4<-a1+a2+a3 # method 4
detach(a)
print(a)
# 
Now, the row numbers (why?) seem to get added - sometimes.
There are some things that I am missing here. Will appreciate all help in 
understanding the issues here.
Thanking You,
Ravi

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Summing up columns with NA elements in a data frame

2008-09-23 Thread Henrique Dallazuanna
Try this:

a$a4 <- rowSums(a, na.rm = T)

On Tue, Sep 23, 2008 at 12:20 PM, ravi <[EMAIL PROTECTED]> wrote:
> Hi all,
> When I try to sum a few columns in a data frame (which has NA's randomly 
> distributed as elements), I am not able to get the summing operation to 
> ignore the NA's.
> Let me explain with the following code :
> 
> a<-structure(list(a1 = c(NA, 2, 3, NA, 5, 6, NA, 8, 9, NA), a2 = c(NA,
> + 4, 5, 5, NA, 7, 8, 8, NA, 10), a3 = c(2, NA, 6, 8, NA, 12, 14,
> + NA, 18, 20)), .Names = c("a1", "a2", "a3"), row.names = c(NA,
> + -10L), class = "data.frame")
> print(a)
> a$a4<-a$a1+a$a2+a$a3 #method 1
> print(a)
> b<-apply(a,1,sum) #method 2
> print(b)
> d<-apply(a,1,FUN=function(x) (sum(x),na.rm=T)) # not the right syntax, 
> apparently - method 3
> print(d)
> ##
> I would like to know how to make the na.rm=T to work, or any other solution.
> I am also mystified by the following result :
>  
> attach(a)
> a$a4<-a1+a2+a3 # method 4
> detach(a)
> print(a)
> #
> Now, the row numbers (why?) seem to get added - sometimes.
> There are some things that I am missing here. Will appreciate all help in 
> understanding the issues here.
> Thanking You,
> Ravi
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?

2008-09-23 Thread Yihui Xie
Hi,

Certainly it's possible. Use any distribution function as long as you
can change its skewness and kurtosis, e.g. the Chi-square
distribution. The corresponding R functions are p*, q*, d*, and r* - I
think you know these functions already (e.g. rchisq()).

The only thing that you should be clear about is the relationship
between the arguments of distribution functions in R and those in a
certain theoretical distribution. Refer to
http://en.wikipedia.org/wiki/Probability_distribution if you don't
remember those formulae for skewness and kurtosis.

Regards,
Yihui
--
Yihui Xie <[EMAIL PROTECTED]>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China



On Tue, Sep 23, 2008 at 10:59 PM, zhijie zhang <[EMAIL PROTECTED]> wrote:
> Dear R users,
>  I hope to explain the concepts of skewness and kurtosis by generating
> series of distributions with same skewness and different kurtosis or  with
> same kurtosis and different skewness, but it seems that i cannot find the
> right functions.
>  I have searched the mailing list, but no answers were found.
>  Is it possible to do that in R? Which function could be used?
>  Thanks a lot.
>
> --
> With Kind Regards,
>
> oooO:
> (..):
> :\.(:::Oooo::
> ::\_)::(..)::
> :::)./:::
> ::(_/
> :
> [***]
> Zhi Jie,Zhang ,PHD
> Tel:+86-21-54237149
> Dept. of Epidemiology,School of Public Health,Fudan University
> Address:No. 138 Yi Xue Yuan Road,Shanghai,China
> Postcode:200032
> Email:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Website: www.statABC.com
> [***]
> oooO:
> (..):
> :\.(:::Oooo::
> ::\_)::(..)::
> :::)./:::
> ::(_/
> :
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] xyplot problem

2008-09-23 Thread Deepayan Sarkar
On 9/23/08, Pascal A. Niklaus <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>  I am trying to produce some panels with dots in an X/Y plane where the
>  diameter of the dots indicates a Z value (like e.g. earthquake maps where dot
>  sizes indicate magnitudes and X/Y the location).
>
>  This works fine with xyplot, e.g.:
>
>  xyplot(1:3~1:3,cex=1:3,pch=16)
>
>  However, when I do this with a panel variable, e.g.:
>
>  x<-rep(1:3,5)
>  y <- rep(1:3,5)
>  sz <- rep(1:5,each=3)
>  grp <- factor(rep(1:5,each=3))
>  xyplot(y~x | grp , cex=sz)
>
>  then sz in the cex argument is not applied per group as I would expect. Same
>  for other arguments like col.
>
>  Is this really the intended behaviour?

Yes. Graphical arguments like 'cex' get passed to the panel function
directly, which needs to deal with it appropriately.

>  How can I achieve what I want, i.e., that the cex argument is different for
>  the different levels of grp?

Write your own panel function that extracts the appropriate subset of 'cex'.

xyplot(y~x | grp , cex=sz,
   panel = function(x, y, cex, subscripts, ...) {
   panel.xyplot(x, y, cex = cex[subscripts],
subscripts = subscripts, ...)
   })

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] graphing netCDF files

2008-09-23 Thread Paul Hiemstra

Hi Steve,

(I'm replying to your e-mail at the mailing list to get it included 
there also)


I've written some stuff on graphs with sp at the R wiki:

http://wiki.r-project.org/rwiki/doku.php?id=tips:spatial-data:spatial_data_visualization

or have a look at the gallery containing plots with the code that 
created them:


http://r-spatial.sourceforge.net/gallery/

cheers!
Paul

[EMAIL PROTECTED] wrote:

Hello

I'm working with a large hydrological data set stored in a netCDF format.
The file stores x and y coordinates in the UTM projected coordinate system,
yet when I use image to graphically display the z variable, the image is
distorted in the sense that it does not plot the map in the correct spatial
organization.

I'm wondering if I need to define the projection of the netCDF file with
rgdal or proj4 routines first before I send it to the graphics device.

My code is as follows:

 q1_2001 <- open.ncdf("H:\\SKF_DESKTOP FILES\\My
Documents\\EDEN\\EDEN\\Surfaces\\2000_q1.nc", readunlimi=FALSE) #opens ncdf
file for reading
   wat.data2000q1 <- get.var.ncdf(q1_2001,  verbose=FALSE ) # gets the real
information

 # GENERAL EXAMINATION OF HEADER DATA in the wat.data file
   day <- get.var.ncdf(q1_2001, "time")   # length(day) 91 days in quarter
   UTMx <-   get.var.ncdf(q1_2001, "x")   # columns (eastings)  # should
return 405
   UTMy <-   get.var.ncdf(q1_2001, "y")   # rows (northings)   #
should return 287

# plot first 91 days (3 months of the year)
for(i in 1:91) {
   !is.na( image(UTMx, UTMy, z = wat.data2001q1[,,i], col=brewer.pal(8,
"YlGnBu"),
 axes=T, pty="s", ylab="UTM Northing", xlab="UTM Easting",
 main = "First Quater 2001")  )
 }

As I indicated above the map is displayed on the graphics device. However
the orientation is distorted pulling the x axis to wide and the y axis too
tall.  How can I set the graphics device to know the orientation and
scaling (if these are the correct terms) in order to display this map
correctly?

All insights will be greatly appreciated.

Thanks
Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Office (305) 224 - 4282
[EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +31302535773
Fax:+31302531145
http://intamap.geo.uu.nl/~paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?

2008-09-23 Thread hadley wickham
On Tue, Sep 23, 2008 at 9:59 AM, zhijie zhang <[EMAIL PROTECTED]> wrote:
> Dear R users,
>  I hope to explain the concepts of skewness and kurtosis by generating
> series of distributions with same skewness and different kurtosis or  with
> same kurtosis and different skewness, but it seems that i cannot find the
> right functions.
>  I have searched the mailing list, but no answers were found.
>  Is it possible to do that in R? Which function could be used?
>  Thanks a lot.

You might want to have a look at Pearson's type IV distribution.  This
document, http://www-cdf.fnal.gov/publications/cdf6820_pearson4.pdf,
provides a pretty good introduction, and I think you can use the
method of moments in reverse to fix the first four moments (~mean, sd,
skewness, kurtosis) and then derive the appropriate parameters of the
Pearson's distribution.

Hadley


-- 
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] Modifying output to Google Docs

2008-09-23 Thread Ajay ohri
Hi List,
Graphical output to PDF's ,RTF ,CSV is known through R.
Can it be modified for outputting to Google Docs (which is basically
uploaded files ,published to become html pages)

Is there any package on this ?

Regards,

Ajay
--

[[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] xyplot problem

2008-09-23 Thread hadley wickham
On Tue, Sep 23, 2008 at 8:27 AM, Pascal A. Niklaus <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to produce some panels with dots in an X/Y plane where the
> diameter of the dots indicates a Z value (like e.g. earthquake maps where dot
> sizes indicate magnitudes and X/Y the location).
>
> This works fine with xyplot, e.g.:
>
> xyplot(1:3~1:3,cex=1:3,pch=16)
>
> However, when I do this with a panel variable, e.g.:
>
> x<-rep(1:3,5)
> y <- rep(1:3,5)
> sz <- rep(1:5,each=3)
> grp <- factor(rep(1:5,each=3))
> xyplot(y~x | grp , cex=sz)
>
> then sz in the cex argument is not applied per group as I would expect. Same
> for other arguments like col.
>
> Is this really the intended behaviour?

You might find this easier to do with ggplot2:

install.packages("ggplot2")
library(ggplot2)

qplot(x, y, size = sz, facets = . ~ grp)

ggplot2 also automatically scales the size and provides a legend.

Hadley

-- 
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] How to draw the graph of f(x,y) = x * y ?

2008-09-23 Thread Paul Smith
Dear All,

The function curve() draws the graph of functions from R to R. Is
there some homologous function to curve() to draw functions from R^2
to R?

Thanks in advance,

Paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] superscript text style in axis label in graph

2008-09-23 Thread Benoit Boulinguiez
Hi all,
 
I'd like to use superscript or subscript in the axis label of a graph. Is
that possible in R?
For instance in xlab="Ce (mmol/m3)", I'd need the "3" of cubic meter in
superscript.
 

Regards/Cordialement

-
Benoit Boulinguiez
Ph.D
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Campus de Beaulieu, 263 Avenue du Général Leclerc
35700 Rennes, France
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
http://www.ensc-rennes.fr/ 

 

[[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] Creating a Legend

2008-09-23 Thread Steve Murray

Dear all,

I'm trying to create a legend for my graph. I hope to have the title as "Land 
Use Type" and the two elements being "Urban" and "Rural" with a red point and 
green point respectively. So far I have the following command, but obviously it 
isn't correct:

> legend("topright", title="Land Use Type", cex=0.75, pch=16, 
> col="red","Urban"&"green","Rural", ncol=2)


As you can see, I'm a bit confused as to how to deal with the point colours and 
associated text.

Also, how would I make the associated text ("Urban" and "Rural") smaller than 
the title?


Many thanks for any suggestions!

Steve

_
Discover Bird's Eye View now with Multimap from Live Search

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] superscript text style in axis label in graph

2008-09-23 Thread Jorge Ivan Velez
Dear Benoit,
Perhaps

plot(1:10,xlab=expression(Ce (mmol/m^3)))

See also ?plotmath for more information.

HTH,


Jorge



On Tue, Sep 23, 2008 at 12:57 PM, Benoit Boulinguiez <
[EMAIL PROTECTED]> wrote:

> Hi all,
>
> I'd like to use superscript or subscript in the axis label of a graph. Is
> that possible in R?
> For instance in xlab="Ce (mmol/m3)", I'd need the "3" of cubic meter in
> superscript.
>
>
> Regards/Cordialement
>
> -
> Benoit Boulinguiez
> Ph.D
> Ecole de Chimie de Rennes (ENSCR) Bureau 1.20
> Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
> Campus de Beaulieu, 263 Avenue du Général Leclerc
> 35700 Rennes, France
> Tel 33 (0)2 23 23 80 83
> Fax 33 (0)2 23 23 81 20
> http://www.ensc-rennes.fr/
>
>
>
>[[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] R2HTML: output from for-loops

2008-09-23 Thread Werner Wernersen
Hi,

I am trying to prepare a report with R2HTML using 
HTMLStart(outdir="./html", filename="report", echo=T, HTMLframe=F)

then, for instance, I want to get the output of a loop:
for (i in 1:20) print(summary(rnorm(1000)))

but only the first of summaries really ends up in the html file.
What am I doing wrongly?

Thanks,
  Werner


__
Do You Yahoo!?
Sie sin
 Massenmails. 
http://mail.yahoo.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] gsub difficulty

2008-09-23 Thread Charles Annis, P.E.
Greetings R-ians:

I know what doesn’t work but I don’t know why, nor how to remedy things.

I have a character string containing "." which I want to replace with " "

gsub(".", " ", file.label) replaces the every character with a blank.

However gsub(".xls", " ", file.label) replaces ".xls" with a blank as
expected.

It appears that "." is some kind of wild-card.  How do I tell gsub that a
period is just a period?

Thanks.


Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.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] bandwidth selection for locpoly

2008-09-23 Thread Chinthaka Kuruwita
Hello All,

Is there a local bandwidth selection routine for local polynomial
regression (locpoly) ?

Thanks

Chinthaka Kuruwita

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 draw arrows or segment lines in 3 dimensional graph

2008-09-23 Thread yabado

Hi

I have a dataset which is like this:
ID  X1  Y1  Z1  X2  Y2  Z2
1   32  127 85  31.7121 85
2   37.9153 88  34.6137 90
3   36.8134 88  36.1155 97
4   31.4136 87  29  113 70


I would like draw the arrow or segment line for each ID from (x1, y1, z1) to
(x2, y2, z2)
Is there a way to do this kind of 3-D graph.

Thank you
-- 
View this message in context: 
http://www.nabble.com/How-to-draw-arrows-or-segment-lines-in-3-dimensional-graph-tp19632610p19632610.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] Modifying output to Google Docs

2008-09-23 Thread Barry Rowlingson
2008/9/23 Ajay ohri <[EMAIL PROTECTED]>:
> Hi List,
> Graphical output to PDF's ,RTF ,CSV is known through R.
> Can it be modified for outputting to Google Docs (which is basically
> uploaded files ,published to become html pages)
>
> Is there any package on this ?

 Do you basically mean an R implementation of the Google Data APIs:

http://code.google.com/apis/gdata/clientlibs.html

 or at least, that part of the API for dealing with google documents?

http://code.google.com/apis/documents/developers_guide_protocol.html

 That would be very interesting... something like:

 library(google)
 g=google("username","password")
 d=data.frame(x=1:10,y=runif(10))
 googleSendData(g, d)

 it might be easier to start by hooking into one of the other language
client libs (java, python) instead of trying to write one in native R
from the start. Although there's XML handling for R and the protocol
appears to be based on that

 Something to do in those long winter nights ahead in the northern
hemisphere perhaps...

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Oja Median will soon be available

2008-09-23 Thread Daniel Vogel

Hello,
in reply to the recent discussion about the Oja median, I would like to
announce that by the end of this year we will make a package available that
offers a routine for calculating the Oja median.

This routine will have both, an exact computation as well as a randomized
search heuristic, which delivers reliable and very fast results at least up
to dimension 8.

Best regards,

Daniel Vogel



Daniel Vogel
TU Dortmund, Germany

Phone: +49 231-755-3180
Fax:   +49 231-755-4387

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Nonparametric multiple comparison with 'npmc'.

2008-09-23 Thread zollin

Hi dear R users,
I want to do multiple comparison with 'npmc' package.
But I don't understand which tests use in it? What limitations they have?
Than they differ from Tukey or Dunnett tests?

Or at least where can I find the detailed information on the tests used in
'npmc' (manual from package is too short).

Thank you very much.

Rishat A. Gabidullin.

-- 
View this message in context: 
http://www.nabble.com/Nonparametric-multiple-comparison-with-%27npmc%27.-tp19632724p19632724.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 with large gamm

2008-09-23 Thread Dave Depew

Hi All,
I was wondering if anyone has had any experience running gamm(mgcv) with 
a large spatial data set?
I know the gamm help says this is a bad idea, but I wondered if there 
was a way to use something like filehash to store the matrices that gamm 
creates?


--
David Depew
PhD Candidate
Department of Biology
University of Waterloo
200 University Ave W.
Waterloo, ON. Canada
N2L 3G1

(T) 1-519-888-4567 x33895
(F) 1-519-746-0614

http://www.science.uwaterloo.ca/~ddepew

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 draw the graph of f(x,y) = x * y ?

2008-09-23 Thread Duncan Murdoch

On 9/23/2008 12:54 PM, Paul Smith wrote:

Dear All,

The function curve() draws the graph of functions from R to R. Is
there some homologous function to curve() to draw functions from R^2
to R?


No, you would have to write it yourself.  The basic idea is to use 
outer() to construct a matrix of function evaluations, then plot the 
matrix using persp, contour, image, rgl::persp3d, etc.  There are 
examples on the ?contour man page.


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] gsub difficulty

2008-09-23 Thread Marc Schwartz
on 09/23/2008 12:16 PM Charles Annis, P.E. wrote:
> Greetings R-ians:
> 
> I know what doesn’t work but I don’t know why, nor how to remedy things.
> 
> I have a character string containing "." which I want to replace with " "
> 
> gsub(".", " ", file.label) replaces the every character with a blank.
> 
> However gsub(".xls", " ", file.label) replaces ".xls" with a blank as
> expected.
> 
> It appears that "." is some kind of wild-card.  How do I tell gsub that a
> period is just a period?
> 
> Thanks.

A period is indeed a wild card, the interpretation meaning any character.

In your second example, the interpretation would be replace 'xls',
preceded by any character, with a space:

  > gsub(".xls", " ", "xlsAxls.xls")
  [1] "xls  "


To specify a period as an explicit character, you need to escape it,
which in R means double the escape character:

  > gsub("\\.xls", " ", "xlsAxls.xls")
  [1] "xlsAxls "

HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] gsub difficulty

2008-09-23 Thread Charles Annis, P.E.
Thanks!

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: Phil Spector [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2008 1:30 PM
To: Charles Annis, P.E.
Subject: Re: [R] gsub difficulty

Charles -
Here are two ways:

> string = 'one.two.three'
> gsub('\\.',' ',string)
[1] "one two three"
> gsub('.',' ',string,fixed=TRUE)
[1] "one two three"


- Phil Spector
 Statistical Computing Facility
 Department of Statistics
 UC Berkeley
 [EMAIL PROTECTED]


On Tue, 23 Sep 2008, Charles Annis, P.E. wrote:

> Greetings R-ians:
>
> I know what doesn?t work but I don?t know why, nor how to remedy things.
>
> I have a character string containing "." which I want to replace with " "
>
> gsub(".", " ", file.label) replaces the every character with a blank.
>
> However gsub(".xls", " ", file.label) replaces ".xls" with a blank as
> expected.
>
> It appears that "." is some kind of wild-card.  How do I tell gsub that a
> period is just a period?
>
> Thanks.
>
>
> Charles Annis, P.E.
>
> [EMAIL PROTECTED]
> phone: 561-352-9699
> eFax:  614-455-3265
> http://www.StatisticalEngineering.com
>  
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Modifying output to Google Docs

2008-09-23 Thread Ajay ohri
I am India based. Winters aren't long at all.


I dont have that hot programming skills in C or R packages so need help.
Maybe we can get Google on our side this way . They are supposed to have
some good stats package too.

Ajay

On Tue, Sep 23, 2008 at 10:49 PM, Barry Rowlingson <
[EMAIL PROTECTED]> wrote:

> 2008/9/23 Ajay ohri <[EMAIL PROTECTED]>:
> > Hi List,
> > Graphical output to PDF's ,RTF ,CSV is known through R.
> > Can it be modified for outputting to Google Docs (which is basically
> > uploaded files ,published to become html pages)
> >
> > Is there any package on this ?
>
>  Do you basically mean an R implementation of the Google Data APIs:
>
> http://code.google.com/apis/gdata/clientlibs.html
>
>  or at least, that part of the API for dealing with google documents?
>
> http://code.google.com/apis/documents/developers_guide_protocol.html
>
>  That would be very interesting... something like:
>
>  library(google)
>  g=google("username","password")
>  d=data.frame(x=1:10,y=runif(10))
>  googleSendData(g, d)
>
>  it might be easier to start by hooking into one of the other language
> client libs (java, python) instead of trying to write one in native R
> from the start. Although there's XML handling for R and the protocol
> appears to be based on that
>
>  Something to do in those long winter nights ahead in the northern
> hemisphere perhaps...
>
> Barry
>



-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

[[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] Options for viewing / using results from lm

2008-09-23 Thread Michael Just
Hello,
I would like to state what I am (trying) to do. I have data set. It has 5749
rows (including the header) and 23 columns.  The data contains values
related to spatial aspects of the 412 landscapes (over various years). I
will be making 2 groups from the data based on spatial extent. I will then
be performing a quadratic lm for each extent by percent forest vs 1 of 8
other metrics. For a total of 16 (2 extents * 8 metrics) quad lm runs. I
will be doing this 'manually'. I hope this is the best way to do these
analyses.

e.g.
ed.qlm.s <- lm(data=small, pfor~ED+I(pfor^2))
pd.qlm.s <- lm(data=small, pfor~PD+I(pfor^2))
...
ed.qlm.l <- lm(data=large, pfor~ED+I(pfor^2))
pd.qlm.l <- lm(data=large, pfor~PD+I(pfor^2))
etc.

I am ultimately intested in the residuals and how they compare amongst
various delineations fo the data.

Q1: I would like to view the residuals for each run.  I think this might be
better done in a another program. I have the read the R import/export
manual. However, using it and trying to use the cat, list, sink, or write
functions I am still lost. What is the best way to export the residual (and
or other available data from lm) data for viewing elsewhere? A table?

Q2: How can I take the residuals and create an object(s) for further
analysis.

I'd appreciate any comments or suggestions including 'read the manual' but
if thats the case perhaps with a little direction.

Thank you kindly,
Cheers,
M Just

[[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] Modifying output to Google Docs

2008-09-23 Thread Ajay ohri
Usage of Google Docs for this- PDFs especially Graphical PDFs can be a
bit heavy. If sending by email to other users, they may find it difficult to
open ,download etc (older computers or low bandwidth).
By outputting PDF directly to a Google Doc, it becomes light and portable
for people to view and collaborate on projects  in different parts of the
world.

If you extend this to Google spreadsheets this functionality is especially
useful for financial reporting or marketing metrics reports or collaborative
presentations to be made.

Now all we need is someone who knows enough C to do it.I am willing to help
as much as I can.

The only language I am really good at is (embarrassingly ) SAS

Regards,

Ajay

On Tue, Sep 23, 2008 at 11:09 PM, Ajay ohri <[EMAIL PROTECTED]> wrote:

> I am India based. Winters aren't long at all.
>
>
> I dont have that hot programming skills in C or R packages so need help.
> Maybe we can get Google on our side this way . They are supposed to have
> some good stats package too.
>
> Ajay
>
> On Tue, Sep 23, 2008 at 10:49 PM, Barry Rowlingson <
> [EMAIL PROTECTED]> wrote:
>
>> 2008/9/23 Ajay ohri <[EMAIL PROTECTED]>:
>> > Hi List,
>> > Graphical output to PDF's ,RTF ,CSV is known through R.
>> > Can it be modified for outputting to Google Docs (which is basically
>> > uploaded files ,published to become html pages)
>> >
>> > Is there any package on this ?
>>
>>  Do you basically mean an R implementation of the Google Data APIs:
>>
>> http://code.google.com/apis/gdata/clientlibs.html
>>
>>  or at least, that part of the API for dealing with google documents?
>>
>> http://code.google.com/apis/documents/developers_guide_protocol.html
>>
>>  That would be very interesting... something like:
>>
>>  library(google)
>>  g=google("username","password")
>>  d=data.frame(x=1:10,y=runif(10))
>>  googleSendData(g, d)
>>
>>  it might be easier to start by hooking into one of the other language
>> client libs (java, python) instead of trying to write one in native R
>> from the start. Although there's XML handling for R and the protocol
>> appears to be based on that
>>
>>  Something to do in those long winter nights ahead in the northern
>> hemisphere perhaps...
>>
>> Barry
>>
>
>
>
> --
> Regards,
>
> Ajay Ohri
> http://tinyurl.com/liajayohri
>
>
>


-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

[[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 a Legend

2008-09-23 Thread John Fox
Dear Steve,

Try

legend("topright", title="Land Use Type", cex=0.75, pch=16, 
  col=c("red", "green"), legend=c("Urban", "Rural"), ncol=2)

I hope this helps,
 John

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


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Steve Murray
> Sent: September-23-08 12:57 PM
> To: r-help@r-project.org
> Subject: [R] Creating a Legend
> 
> 
> Dear all,
> 
> I'm trying to create a legend for my graph. I hope to have the title as
"Land
> Use Type" and the two elements being "Urban" and "Rural" with a red point
and
> green point respectively. So far I have the following command, but
obviously
> it isn't correct:
> 
> > legend("topright", title="Land Use Type", cex=0.75, pch=16,
> col="red","Urban"&"green","Rural", ncol=2)
> 
> 
> As you can see, I'm a bit confused as to how to deal with the point
colours
> and associated text.
> 
> Also, how would I make the associated text ("Urban" and "Rural") smaller
than
> the title?
> 
> 
> Many thanks for any suggestions!
> 
> Steve
> 
> _
> Discover Bird's Eye View now with Multimap from Live Search
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] quantile regression: plotting coefficients on only one variable (rq)

2008-09-23 Thread Michael Faye
Dear all.

I have a question on plotting the coefficients from a series of mutivariate
quantile regressions.  The following code plots the coefficients for each
RHS variable x1 and x2. Is there a way to plot only the coefficients on x1?
In the data I am using, I have a large number of fixed effects and do want
to plot the coefficients on these fixed effects.


quant.plot <- summary(rq(paste("y ~ x1 + x2"), tau=1:9/10))
postscript(file=paste(output.dir, "plot.eps", sep="/"),
paper="special",
width=10,
height=10,
horizontal=FALSE)

plot(quant.plot)

Best
Michael

[[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] gsub difficulty

2008-09-23 Thread Charles Annis, P.E.
Thanks, Jorge, for another alternative.

 

Charles Annis, P.E.

 
[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
 
http://www.StatisticalEngineering.com

 

  _  

From: Jorge Ivan Velez [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2008 2:21 PM
To: [EMAIL PROTECTED]
Subject: Re: [R] gsub difficulty

 

 

Dear Charles,

 

Phil Spector answered your original question by using two different
approaches, but here I'm going again :) 

 

x="your.string.is.here"

gsub("[.]"," ",x)

[1] "your string is here"

 

HTH,

 

Jorge

 

 

On Tue, Sep 23, 2008 at 1:23 PM, Jorge Ivan Velez <[EMAIL PROTECTED]>
wrote:

 

Deat Charles,

 

Is this what you want?

 

x=".xls"

sub(".","",x)

[1] "xls"

 

HTH,

 

Jorge





On Tue, Sep 23, 2008 at 1:16 PM, Charles Annis, P.E.
<[EMAIL PROTECTED]> wrote:

Greetings R-ians:

I know what doesn't work but I don't know why, nor how to remedy things.

I have a character string containing "." which I want to replace with " "

gsub(".", " ", file.label) replaces the every character with a blank.

However gsub(".xls", " ", file.label) replaces ".xls" with a blank as
expected.

It appears that "." is some kind of wild-card.  How do I tell gsub that a
period is just a period?

Thanks.


Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.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] gsub difficulty

2008-09-23 Thread Gabor Grothendieck
Any of these will replace every dot with a space:

x <- "a.b.c"
gsub("\\.", " ", x)
gsub("[.]", " ", x)
gsub(".", " ", x, fixed = TRUE)
chartr(".", " ", x)

See ?regex for more info on regular expressions.

On Tue, Sep 23, 2008 at 1:16 PM, Charles Annis, P.E.
<[EMAIL PROTECTED]> wrote:
> Greetings R-ians:
>
> I know what doesn't work but I don't know why, nor how to remedy things.
>
> I have a character string containing "." which I want to replace with " "
>
> gsub(".", " ", file.label) replaces the every character with a blank.
>
> However gsub(".xls", " ", file.label) replaces ".xls" with a blank as
> expected.
>
> It appears that "." is some kind of wild-card.  How do I tell gsub that a
> period is just a period?
>
> Thanks.
>
>
> Charles Annis, P.E.
>
> [EMAIL PROTECTED]
> phone: 561-352-9699
> eFax:  614-455-3265
> http://www.StatisticalEngineering.com
>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Options for viewing / using results from lm

2008-09-23 Thread Nordlund, Dan (DSHS/RDA)
I haven't seen a response to this yet, so I will give my $0.25US worth (which 
is not worth that much anymore ).  :-)

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Michael Just
> Sent: Tuesday, September 23, 2008 11:01 AM
> To: r-help@r-project.org
> Subject: [R] Options for viewing / using results from lm
> 
> Hello,
> I would like to state what I am (trying) to do. I have data 
> set. It has 5749
> rows (including the header) and 23 columns.  The data contains values
> related to spatial aspects of the 412 landscapes (over 
> various years). I
> will be making 2 groups from the data based on spatial 
> extent. I will then
> be performing a quadratic lm for each extent by percent 
> forest vs 1 of 8
> other metrics. For a total of 16 (2 extents * 8 metrics) quad 
> lm runs. I
> will be doing this 'manually'. I hope this is the best way to do these
> analyses.
> 
> e.g.
> ed.qlm.s <- lm(data=small, pfor~ED+I(pfor^2))
> pd.qlm.s <- lm(data=small, pfor~PD+I(pfor^2))
> ...
> ed.qlm.l <- lm(data=large, pfor~ED+I(pfor^2))
> pd.qlm.l <- lm(data=large, pfor~PD+I(pfor^2))
> etc.
> 
> I am ultimately intested in the residuals and how they compare amongst
> various delineations fo the data.
> 
> Q1: I would like to view the residuals for each run.  I think 
> this might be
> better done in a another program. I have the read the R import/export
> manual. However, using it and trying to use the cat, list, 
> sink, or write
> functions I am still lost. What is the best way to export the 
> residual (and
> or other available data from lm) data for viewing elsewhere? A table?

Why do you think it is better done in another program?  Keeping it in R saves 
you from the exporting, which you say you are having trouble with.

> 
> Q2: How can I take the residuals and create an object(s) for further
> analysis.
>

See ?residuals.

Try the following:

x <- sample(1:20, 100, replace=TRUE)
y <- rnorm(100)
fit.lm <- lm(y ~ x)
plot(residuals(fit.lm))
plot(x,residuals(fit.lm))

 
> I'd appreciate any comments or suggestions including 'read 
> the manual' but
> if thats the case perhaps with a little direction.
> 
> Thank you kindly,
> Cheers,
> M Just
> 

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 
 

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] quantile regression: plotting coefficients on only one variable (rq)

2008-09-23 Thread Mark Difford

Hi Michael,

It's in the manual:

?plot.summary.rqs

plot(summary(rq(..., tau=c(...)), parm = x1, ...)

Regards, Mark.


Michael Faye wrote:
> 
> Dear all.
> 
> I have a question on plotting the coefficients from a series of
> mutivariate
> quantile regressions.  The following code plots the coefficients for each
> RHS variable x1 and x2. Is there a way to plot only the coefficients on
> x1?
> In the data I am using, I have a large number of fixed effects and do want
> to plot the coefficients on these fixed effects.
> 
> 
> quant.plot <- summary(rq(paste("y ~ x1 + x2"), tau=1:9/10))
> postscript(file=paste(output.dir, "plot.eps", sep="/"),
> paper="special",
> width=10,
> height=10,
> horizontal=FALSE)
> 
> plot(quant.plot)
> 
> Best
> Michael
> 
>   [[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://www.nabble.com/quantile-regression%3A-plotting-coefficients-on-only-one-variable-%28rq%29-tp19633899p19634794.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] R2HTML: output from for-loops

2008-09-23 Thread Greg Snow
The problem is probably due to what is considered a top level expression to be 
evaluated and how R2HTML processes these.

A simpler alternative is to use txtStart() or etxtStart() from the 
TeachingDemos package.  These work similar to HTMLStart(), but don't do the 
html markup (the etxt version does a little bit of markup, but you need to 
postprocess the file with enscript).

These functions being simpler handle the output in a different way and a quick 
test shows that the loop you show below does work with these.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> project.org] On Behalf Of Werner Wernersen
> Sent: Tuesday, September 23, 2008 11:05 AM
> To: [EMAIL PROTECTED]
> Subject: [R] R2HTML: output from for-loops
>
> Hi,
>
> I am trying to prepare a report with R2HTML using
> HTMLStart(outdir="./html", filename="report", echo=T, HTMLframe=F)
>
> then, for instance, I want to get the output of a loop:
> for (i in 1:20) print(summary(rnorm(1000)))
>
> but only the first of summaries really ends up in the html file.
> What am I doing wrongly?
>
> Thanks,
>   Werner
>
>
> __
> Do You Yahoo!?
> Sie sin
>  Massenmails.
> http://mail.yahoo.com
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Modifying output to Google Docs

2008-09-23 Thread Barry Rowlingson
2008/9/23 Ajay ohri <[EMAIL PROTECTED]>:

> By outputting PDF directly to a Google Doc, it becomes light and portable
> for people to view and collaborate on projects  in different parts of the
> world.
> If you extend this to Google spreadsheets this functionality is especially
> useful for financial reporting or marketing metrics reports or collaborative
> presentations to be made.

 There's command-line tools (written in python, but probably in other
languages elsewhere) to do this:

http://code.google.com/p/gdatacopier/

 their example is:

./gdoc-cp.py --username [EMAIL PROTECTED] --import --local
files/doc.txt --title "New Document"

 So all you need to do is call that from R with system() and wrap it
up in some R functions.

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 draw the graph of f(x,y) = x * y ?

2008-09-23 Thread Paul Smith
On Tue, Sep 23, 2008 at 6:32 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> The function curve() draws the graph of functions from R to R. Is
>> there some homologous function to curve() to draw functions from R^2
>> to R?
>
> No, you would have to write it yourself.  The basic idea is to use outer()
> to construct a matrix of function evaluations, then plot the matrix using
> persp, contour, image, rgl::persp3d, etc.  There are examples on the
> ?contour man page.

Thanks, Duncan. perps does what I was looking for.

Paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 convert backslash to slash?

2008-09-23 Thread Shengqiao Li


How to use sub, gsub, etc. to replace "\" in a string to "/"?

For example,convert "C:\foo\bar" to "C:/foo/bar".

Thanks,

Shengqiao Li

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 convert backslash to slash?

2008-09-23 Thread Gabor Grothendieck
This was just posted today:

https://stat.ethz.ch/pipermail/r-help/2008-September/174696.html

On Tue, Sep 23, 2008 at 4:00 PM, Shengqiao Li <[EMAIL PROTECTED]> wrote:
>
> How to use sub, gsub, etc. to replace "\" in a string to "/"?
>
> For example,convert "C:\foo\bar" to "C:/foo/bar".
>
> Thanks,
>
> Shengqiao Li
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Coloring spaces between lines in xyplot

2008-09-23 Thread Seth W Bigelow

R-listers:

I am summarizing input I got on a recent query about creating stacked,
colored line plots in xyplot.
The only input I got regarding xyplot was to use the polygon() command, but
this seemed to require some awkward data manipulation.
In contrast, I got several snippets of functional code for use in the
ggplot2 and plotrix packages, both of which produced nice graphs with
minimal effort. (Apparently the filled bands option in the xYplot function
in the Hmisc package will also do this).

### stacked line graphs in plotrix package

x <-matrix(x,nrow=10) # create matrix of x values
y <-matrix(y,nrow=10) # create matrix of y values

stackpoly(x,y,stack=TRUE)   # make the graph


### stacked line graphs in ggplot2 package

x <- rep(seq(1,10), 2)# create column of x values
y <- c(1+1.5*(1:10), 0.2 + 1.3*(1:10) )   # create column of y values
trt <- rep(c("low", "high"), each = 10)   # create column with identify of
treatments

qplot(x, y, fill=trt, geom="area")# plot the graph

I ended up using ggplot2, because I had to churn out a large number of
these, and the "facets" command allowed me to make panels
in a manner akin to the lattice system.

Thanks to Carl, Hadley, Xie, Jim and Frank for responding.

--Seth Bigelow



Dr. Seth  W. Bigelow
Biologist, Sierra Nevada Research Center
Pacific Southwest Research Station, USDA Forest Service. 1731 Research Park
Drive, Davis CA 95618

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Options for viewing / using results from lm

2008-09-23 Thread Michael Just
Hello,

>Why do you think it is better done in another program? Keeping it in R
saves you from the exporting, which you say you are having trouble with.

I think it might be better for viewing capabilities. If I had columns of
residuals right next to each other I could spot differences amongst
locations. Right? If I can take the residual values and put them back into
my main data file I can then have the options to use grouping values that
exist there. (Like I asked here:
http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)

>> Q2: How can I take the residuals and create an object(s) for further
*analysis.
*
**

>See ?residuals.

>Try the following:

>x <- sample(1:20, 100, replace=TRUE)
>y <- rnorm(100)
>fit.lm <- lm(y ~ x)
>plot(residuals(fit.lm))
>plot(x,residuals(fit.lm))


When I was thinking further analysis, for example, could I take the
residuals for all metrics in one extent and compare them to all residuals
for all metrics in another extent? Even though the were created with 16
different models?

In 'plot(residuals(fit.lm))' what is the index 'counting'?


Thank you kindly for you $0.25,

Cheers,

M Just

[[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 convert backslash to slash?

2008-09-23 Thread hadley wickham
Except it's a bit tricker because:

s <- "C:\foo\bar"
print(s)

You'd need to work with

encodeString( "C:\foo\bar")

but that won't work in general:

"c:\xjobs"
"c:\"
"c:\help"

Hadley

On Tue, Sep 23, 2008 at 3:00 PM, Shengqiao Li <[EMAIL PROTECTED]> wrote:
>
> How to use sub, gsub, etc. to replace "\" in a string to "/"?
>
> For example,convert "C:\foo\bar" to "C:/foo/bar".
>
> Thanks,
>
> Shengqiao Li
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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


Re: [R] Options for viewing / using results from lm

2008-09-23 Thread Greg Snow
You can do things like this pseudocode:

> fit1 <- lm( y ~ x1, data=mydata )
> fit2 <- lm( y ~ x2, data=mydata )
> fit3 <- lm( y ~ x1*x2, data=mydata )
...

> mydata$r1 <- resid(fit1)
> mydata$r2 <- resid(fit2)
> mydata$r3 <- resid(fit3)

Or

> mydata <- cbind(mydata, r1=resid(fit1), r2=resid(fit2), ...

To view the data in a spreadsheet like table:

> View(mydata)

And scroll over to the r columns, using indexing or the subset function can 
reorder the columns to make this easier.

A simple plot:

> pairs( mydata[ , paste('r',1:10, sep='')], col=c('red','green','blue')[ 
> mydata$g1 ],
+ panel=panel.smooth )

Or there are various other ways to explore the data within R.  If you really 
feel the need to use another tool, do like the above, then use write.table to 
export it to a csv file or paste it to a spreadsheet.   There is also the 
rggobi package which will automate the exporting to the ggobi program which 
allows a lot more visualization options.

Hope this helps,


--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> project.org] On Behalf Of Michael Just
> Sent: Tuesday, September 23, 2008 2:06 PM
> To: r-help@r-project.org
> Cc: [EMAIL PROTECTED]
> Subject: Re: [R] Options for viewing / using results from lm
>
> Hello,
>
> >Why do you think it is better done in another program? Keeping it in R
> saves you from the exporting, which you say you are having trouble
> with.
>
> I think it might be better for viewing capabilities. If I had columns
> of
> residuals right next to each other I could spot differences amongst
> locations. Right? If I can take the residual values and put them back
> into
> my main data file I can then have the options to use grouping values
> that
> exist there. (Like I asked here:
> http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)
>
> >> Q2: How can I take the residuals and create an object(s) for further
> *
> analysis.
> *
> **
>
> >See ?residuals.
>
> >Try the following:
>
> >x <- sample(1:20, 100, replace=TRUE)
> >y <- rnorm(100)
> >fit.lm <- lm(y ~ x)
> >plot(residuals(fit.lm))
> >plot(x,residuals(fit.lm))
>
>
> When I was thinking further analysis, for example, could I take the
> residuals for all metrics in one extent and compare them to all
> residuals
> for all metrics in another extent? Even though the were created with 16
> different models?
>
> In 'plot(residuals(fit.lm))' what is the index 'counting'?
>
>
> Thank you kindly for you $0.25,
>
> Cheers,
>
> M Just
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Proper power computation for one-sided binomial tests.

2008-09-23 Thread Collin Lynch
Hi, I trying to determine the best way to compute the power for a
one-sample one-sided binomial test.  Specifically I need to sample a
population of individuals and ask whether a sample rate of 0% is
compatable with a minimum threshold of 3% and how many samples are needed.

I have made use of power.prop.test but I am not sure if a) that is the
correct (or best) function to use and b) if the output is quite right.

Here is a sample run:
> power.prop.test(p1=0, p2=0.03, sig.level=0.05, power=0.90,
alt="one.sided")

 Two-sample comparison of proportions power calculation

  n = 279.3004
 p1 = 0
 p2 = 0.03
  sig.level = 0.05
  power = 0.9
alternative = one.sided

 NOTE: n is number in *each* group

This is an attempt to test whether a sample of 0% occurrance is compatable
with an a-priori probability of 3% at the specified significance levels.

My questions are those above, and, as a followup whether the caveat about
n being the number in each group means that I need to sample twice that
number in a single group.  I don't believe so but I want to be sure.

Thanks in advance,
Collin Lynch.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Contional

2008-09-23 Thread Michael Pearmain
Hi All,

I'm having trouble selecting rows to delete, that i can't seem to overcome.

Below is some sample data, i am trying to dedup the data based on each user,
and simultaneously the timestamp (at the side i have highlighted expected
row to be removed)

I've looked at the lag function but can't seem to make it work?

My logic ran along the lines of an ifelse statement and then remove after
that, but it doesn't seem to work? Any help appreciated

Let's call the data test

test$lag <- ifelse(test$user_id==lag(test$user_id)
& test$timestamp==lag(test$timestamp),1,0)

Can anyone help on this?

Mike



Source_type   timestampuser_id
75381   0 07-07-2008-21:03:55 848307909687
75379   1 07-07-2008-19:52:55 848307838407
75380   2 07-07-2008-19:54:14 848307838407
75378   1 07-07-2008-15:24:01 848285633277
75374   1 07-07-2008-13:39:17 848273633667
75377   2 07-07-2008-13:39:55 848273633667
75376   2 07-07-2008-13:39:55 848273633667Remove
75375   2 07-07-2008-13:56:05 848273633667
75373   1 07-07-2008-17:11:00 848272661427
75371   1 07-07-2008-13:19:00 848270431847
75372   2 07-07-2008-13:19:14 848270431847
75369   1 07-07-2008-12:49:16 848269676907   Remove
75370   2 07-07-2008-12:49:16 848269676907
75366   1 07-07-2008-13:29:15 848263484847
75368   2 07-07-2008-13:29:44 848263484847

Thanks in advance

[[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] Options for viewing / using results from lm

2008-09-23 Thread Michael Just
Greg,
Thanks for the pseudocode and cbind suggestions I think these should be
quite helpful. What package is the function 'view' in? As for exporting
elsewhere, basically I would to have the values of residuals saved in a
spreadsheet in addition to any visualizations created within R.

Thanks,
M Just

On Tue, Sep 23, 2008 at 3:26 PM, Greg Snow <[EMAIL PROTECTED]> wrote:

> You can do things like this pseudocode:
>
> > fit1 <- lm( y ~ x1, data=mydata )
> > fit2 <- lm( y ~ x2, data=mydata )
> > fit3 <- lm( y ~ x1*x2, data=mydata )
> ...
>
> > mydata$r1 <- resid(fit1)
> > mydata$r2 <- resid(fit2)
> > mydata$r3 <- resid(fit3)
>
> Or
>
> > mydata <- cbind(mydata, r1=resid(fit1), r2=resid(fit2), ...
>
> To view the data in a spreadsheet like table:
>
> > View(mydata)
>
> And scroll over to the r columns, using indexing or the subset function can
> reorder the columns to make this easier.
>
> A simple plot:
>
> > pairs( mydata[ , paste('r',1:10, sep='')], col=c('red','green','blue')[
> mydata$g1 ],
> + panel=panel.smooth )
>
> Or there are various other ways to explore the data within R.  If you
> really feel the need to use another tool, do like the above, then use
> write.table to export it to a csv file or paste it to a spreadsheet.   There
> is also the rggobi package which will automate the exporting to the ggobi
> program which allows a lot more visualization options.
>
> Hope this helps,
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> [EMAIL PROTECTED]
> 801.408.8111
>
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > project.org] On Behalf Of Michael Just
> > Sent: Tuesday, September 23, 2008 2:06 PM
> > To: r-help@r-project.org
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [R] Options for viewing / using results from lm
> >
> > Hello,
> >
> > >Why do you think it is better done in another program? Keeping it in R
> > saves you from the exporting, which you say you are having trouble
> > with.
> >
> > I think it might be better for viewing capabilities. If I had columns
> > of
> > residuals right next to each other I could spot differences amongst
> > locations. Right? If I can take the residual values and put them back
> > into
> > my main data file I can then have the options to use grouping values
> > that
> > exist there. (Like I asked here:
> > http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)
> >
> > >> Q2: How can I take the residuals and create an object(s) for further
> > *
> > analysis.
> > *
> > **
> >
> > >See ?residuals.
> >
> > >Try the following:
> >
> > >x <- sample(1:20, 100, replace=TRUE)
> > >y <- rnorm(100)
> > >fit.lm <- lm(y ~ x)
> > >plot(residuals(fit.lm))
> > >plot(x,residuals(fit.lm))
> >
> >
> > When I was thinking further analysis, for example, could I take the
> > residuals for all metrics in one extent and compare them to all
> > residuals
> > for all metrics in another extent? Even though the were created with 16
> > different models?
> >
> > In 'plot(residuals(fit.lm))' what is the index 'counting'?
> >
> >
> > Thank you kindly for you $0.25,
> >
> > Cheers,
> >
> > M Just
> >
> > [[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] how to model this

2008-09-23 Thread senne
Dear list,

I met with a business case and feel frustrated to model it,scenario is like
this

1. logistics department running
2. a lot of customers place orders and goods need to be send to their site
(nationwide)
3. order received and then choose from a list of truck carriers to deliver
goods,a cheapest one should be selected but might not available for the
limit of order-shipment time,so a more expensive one has to be used.

this logistics department run the process on case-by-case basis ,no forecast
from sale department and no bargain power against carriers. I have past 2
years order history and freight history,on which some descriptive statistics
is done and result is really ugly,expensive carriers were used
extensively.I'm trying to find some ways to benchmark or optimize the
process,but due to my lack of statistics modeling skills( I'm from
accounting background and luckily because I have used R to show some
improvement in past analysis,I'm asked to deal with this :(
really can't find the clue where to start.I'll very appreciate if anyone can
point  me to the right direction(books ,papers, or similar situations might
be examined many times) .

thanks
-- 
[EMAIL PROTECTED]

[[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] Statistical question re assessing fit of distribution functions.

2008-09-23 Thread David Scott

On Tue, 23 Sep 2008, Ted Byers wrote:



Thanks Timur

While assessing whether or not the best option would be a normal
distribution (it won't be, the data in this case LOOKS more poisson, or if I
explude the first week of results, a negative exponential; and in my other
case, cauchy is more likely), I really need a test that can be applied
regardless of the distribution to see which distribution fits best.  Using
log-likelihood, there doesn't seem to be much to choose between exponential
and poisson (the log-likelihhod for them being almost the same, regardless
of the sample even tough the parameters are very different from one sample
to the next - I don't understand why yet), and the others I have tried are
MUCH worse, but I'm not done yet.

Are you aware of functions that allow estimation of all the parameters of a
non-central distribution?  I ask because a problem I'll be working on in a
few weeks will involve the kind of skew produced by a non-central
distribution (among others).  I see some functions allow you to work with
skewed distributions (e.g. "[dpqr]stable  the skewed stable distribution ")
but I have not yet found functions that alow one to estimate their
parameters from real data.

Thanks,

Ted



Ted,

You have talked about heavy tailed, skewed distributions. To fit these 
you need to look at some packages. There are a number of possibilities in 
fBasics which is part of Rmetrics, sn is a very nice package for the skew 
normal and skew t distributions, and there are packages for the hyperbolic 
and generalized hyperbolic distributions: HyperbolicDist, ghyp and QRMlib.


You won't find much on goodness of fit tests I think. I have an 
implementation of the Cramer-von Mises test for the hyperbolic in my 
package (HyperbolicDist) but I am not aware of a lot else being available.


David Scott

_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
Auckland 1142,NEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED]

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 R load a saved workspace from the Internet?

2008-09-23 Thread Paul Smith
Dear All,

Can load() load a saved workspace from an Internet address? I have
tried it but I am getting errors:

In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'http://X/workspace.RData', probable
reason 'No such file or directory'

Paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Contional

2008-09-23 Thread jim holtman
Is this what you want:  TRUE marks the ones to be removed

> mark <- (head(x$timestamp, -1) == tail(x$timestamp, -1)) &
+ (head(x$user_id, -1) == tail(x$user_id, -1))
> x$flag <- c(FALSE, mark)
> x
  Source_type   timestamp  user_id  flag
75381   0 07-07-2008-21:03:55 848307909687 FALSE
75379   1 07-07-2008-19:52:55 848307838407 FALSE
75380   2 07-07-2008-19:54:14 848307838407 FALSE
75378   1 07-07-2008-15:24:01 848285633277 FALSE
75374   1 07-07-2008-13:39:17 848273633667 FALSE
75377   2 07-07-2008-13:39:55 848273633667 FALSE
75376   2 07-07-2008-13:39:55 848273633667  TRUE
75375   2 07-07-2008-13:56:05 848273633667 FALSE
75373   1 07-07-2008-17:11:00 848272661427 FALSE
75371   1 07-07-2008-13:19:00 848270431847 FALSE
75372   2 07-07-2008-13:19:14 848270431847 FALSE
75369   1 07-07-2008-12:49:16 848269676907 FALSE
75370   2 07-07-2008-12:49:16 848269676907  TRUE
75366   1 07-07-2008-13:29:15 848263484847 FALSE
75368   2 07-07-2008-13:29:44 848263484847 FALSE
>




On Tue, Sep 23, 2008 at 4:44 PM, Michael Pearmain <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm having trouble selecting rows to delete, that i can't seem to overcome.
>
> Below is some sample data, i am trying to dedup the data based on each user,
> and simultaneously the timestamp (at the side i have highlighted expected
> row to be removed)
>
> I've looked at the lag function but can't seem to make it work?
>
> My logic ran along the lines of an ifelse statement and then remove after
> that, but it doesn't seem to work? Any help appreciated
>
> Let's call the data test
>
> test$lag <- ifelse(test$user_id==lag(test$user_id)
> & test$timestamp==lag(test$timestamp),1,0)
>
> Can anyone help on this?
>
> Mike
>
>
>
> Source_type   timestampuser_id
> 75381   0 07-07-2008-21:03:55 848307909687
> 75379   1 07-07-2008-19:52:55 848307838407
> 75380   2 07-07-2008-19:54:14 848307838407
> 75378   1 07-07-2008-15:24:01 848285633277
> 75374   1 07-07-2008-13:39:17 848273633667
> 75377   2 07-07-2008-13:39:55 848273633667
> 75376   2 07-07-2008-13:39:55 848273633667Remove
> 75375   2 07-07-2008-13:56:05 848273633667
> 75373   1 07-07-2008-17:11:00 848272661427
> 75371   1 07-07-2008-13:19:00 848270431847
> 75372   2 07-07-2008-13:19:14 848270431847
> 75369   1 07-07-2008-12:49:16 848269676907   Remove
> 75370   2 07-07-2008-12:49:16 848269676907
> 75366   1 07-07-2008-13:29:15 848263484847
> 75368   2 07-07-2008-13:29:44 848263484847
>
> Thanks in advance
>
>[[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] How to convert backslash to slash?

2008-09-23 Thread Duncan Murdoch

On 23/09/2008 4:00 PM, Shengqiao Li wrote:

How to use sub, gsub, etc. to replace "\" in a string to "/"?

For example,convert "C:\foo\bar" to "C:/foo/bar".


If those are R strings, there are no backslashes in the first one.  It 
has a formfeed and a backspace in it.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Proper power computation for one-sided binomial tests.

2008-09-23 Thread Peter Dalgaard

Collin Lynch wrote:

Hi, I trying to determine the best way to compute the power for a
one-sample one-sided binomial test.  Specifically I need to sample a
population of individuals and ask whether a sample rate of 0% is
compatable with a minimum threshold of 3% and how many samples are needed.

I have made use of power.prop.test but I am not sure if a) that is the
correct (or best) function to use and b) if the output is quite right.

Here is a sample run:
  

power.prop.test(p1=0, p2=0.03, sig.level=0.05, power=0.90,


alt="one.sided")

 Two-sample comparison of proportions power calculation

  n = 279.3004
 p1 = 0
 p2 = 0.03
  sig.level = 0.05
  power = 0.9
alternative = one.sided

 NOTE: n is number in *each* group

This is an attempt to test whether a sample of 0% occurrance is compatable
with an a-priori probability of 3% at the specified significance levels.

My questions are those above, and, as a followup whether the caveat about
n being the number in each group means that I need to sample twice that
number in a single group.  I don't believe so but I want to be sure.

  

Yes, that's wrong. Now you can be sure ;-)

For this kind of problem I'd go directly for the binomial distribution. 
If the actual probability is 0, this is essentially deterministic and 
you can look at


> binom.test(0,99,p=.03, alt="less")

   Exact binomial test

data:  0 and 99
number of successes = 0, number of trials = 99, p-value = 0.04902
alternative hypothesis: true probability of success is less than 0.03
95 percent confidence interval:
0. 0.02980667
sample estimates:
probability of success
0

So you have significance at n=99, which I think we can easily agree is 
less than two times 249



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can R load a saved workspace from the Internet?

2008-09-23 Thread Peter Dalgaard

Paul Smith wrote:

Dear All,

Can load() load a saved workspace from an Internet address? I have
tried it but I am getting errors:

In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file 'http://X/workspace.RData', probable
reason 'No such file or directory'

  
Yes, but you need to open an url connection explicitly (I have forgotten 
why this is so).


load(url("http://X/workspace.RData";))

or even better, follow the last example in ?load.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to model this

2008-09-23 Thread senne
Dear list,

I met with a business case and feel frustrated to model it,scenario is like
this

1. logistics department running
2. a lot of customers place orders and goods need to be send to their site
(nationwide)
3. order received and then choose from a list of truck carriers to deliver
goods,a cheapest one should be selected but might not available for the
limit of order-shipment time,so a more expensive one has to be used.

this logistics department run the process on case-by-case basis ,no forecast
from sale department and no bargain power against carriers. I have past 2
years order history and freight history,on which some descriptive statistics
is done and result is really ugly,expensive carriers were used
extensively.I'm trying to find some ways to benchmark or optimize the
process,but due to my lack of statistics modeling skills( I'm from
accounting background and luckily because I have used R to show some
improvement in past analysis,I'm asked to deal with this :(
really can't find the clue where to start.I'll very appreciate if anyone can
point  me to the right direction(books ,papers, or similar situations might
be examined many times) .

thanks

[[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] Contional

2008-09-23 Thread Peter Alspach
Michael

test[!duplicated(paste(test$timestamp, test$user_id)),] 

should remove the second (and subsequent) occurrences of duplicates.
Your example suggests you don't always want to keep the first
occurrence, but the rule which determines which occurrence you want to
keep is not obvious to me.

HTH 

Peter Alspach
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Michael Pearmain
> Sent: Wednesday, 24 September 2008 8:44 a.m.
> To: r-help@r-project.org
> Subject: [R] Contional
> 
> Hi All,
> 
> I'm having trouble selecting rows to delete, that i can't 
> seem to overcome.
> 
> Below is some sample data, i am trying to dedup the data 
> based on each user, and simultaneously the timestamp (at the 
> side i have highlighted expected row to be removed)
> 
> I've looked at the lag function but can't seem to make it work?
> 
> My logic ran along the lines of an ifelse statement and then 
> remove after that, but it doesn't seem to work? Any help appreciated
> 
> Let's call the data test
> 
> test$lag <- ifelse(test$user_id==lag(test$user_id)
> & test$timestamp==lag(test$timestamp),1,0)
> 
> Can anyone help on this?
> 
> Mike
> 
> 
> 
> Source_type   timestampuser_id
> 75381   0 07-07-2008-21:03:55 848307909687
> 75379   1 07-07-2008-19:52:55 848307838407
> 75380   2 07-07-2008-19:54:14 848307838407
> 75378   1 07-07-2008-15:24:01 848285633277
> 75374   1 07-07-2008-13:39:17 848273633667
> 75377   2 07-07-2008-13:39:55 848273633667
> 75376   2 07-07-2008-13:39:55 848273633667Remove
> 75375   2 07-07-2008-13:56:05 848273633667
> 75373   1 07-07-2008-17:11:00 848272661427
> 75371   1 07-07-2008-13:19:00 848270431847
> 75372   2 07-07-2008-13:19:14 848270431847
> 75369   1 07-07-2008-12:49:16 848269676907   Remove
> 75370   2 07-07-2008-12:49:16 848269676907
> 75366   1 07-07-2008-13:29:15 848263484847
> 75368   2 07-07-2008-13:29:44 848263484847
> 
> Thanks in advance
> 
>   [[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.
> 

The contents of this e-mail are privileged and/or confidential to the named
 recipient and are not to be used by any other person and/or organisation.
 If you have received this e-mail in error, please notify the sender and delete
 all material pertaining to this e-mail.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 R load a saved workspace from the Internet?

2008-09-23 Thread Paul Smith
On Tue, Sep 23, 2008 at 11:06 PM, Peter Dalgaard
<[EMAIL PROTECTED]> wrote:
>> Can load() load a saved workspace from an Internet address? I have
>> tried it but I am getting errors:
>>
>> In addition: Warning message:
>> In readChar(con, 5L, useBytes = TRUE) :
>>  cannot open compressed file 'http://X/workspace.RData', probable
>> reason 'No such file or directory'
>
> Yes, but you need to open an url connection explicitly (I have forgotten why
> this is so).
>
> load(url("http://X/workspace.RData";))
>
> or even better, follow the last example in ?load.

Yes, Peter, that works. Thanks!

I do not know why with read.csv and read.table url() is not needed,
but with load() is. Should not the approach be similar in both cases?

Paul

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 model this

2008-09-23 Thread jim holtman
One way of modeling this is to use discrete event simulation since you
want some randomness to the time it takes trucks to travel and
therefore be available for the next load.  I have used this to model
various aspects of loading and routing trucks.

On Tue, Sep 23, 2008 at 4:58 PM, senne <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I met with a business case and feel frustrated to model it,scenario is like
> this
>
> 1. logistics department running
> 2. a lot of customers place orders and goods need to be send to their site
> (nationwide)
> 3. order received and then choose from a list of truck carriers to deliver
> goods,a cheapest one should be selected but might not available for the
> limit of order-shipment time,so a more expensive one has to be used.
>
> this logistics department run the process on case-by-case basis ,no forecast
> from sale department and no bargain power against carriers. I have past 2
> years order history and freight history,on which some descriptive statistics
> is done and result is really ugly,expensive carriers were used
> extensively.I'm trying to find some ways to benchmark or optimize the
> process,but due to my lack of statistics modeling skills( I'm from
> accounting background and luckily because I have used R to show some
> improvement in past analysis,I'm asked to deal with this :(
> really can't find the clue where to start.I'll very appreciate if anyone can
> point  me to the right direction(books ,papers, or similar situations might
> be examined many times) .
>
> thanks
>
>[[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.


  1   2   >