Re: [R] Issue with using geocode

2012-11-26 Thread Jeff Newmiller

a) Please post in plain text.

b) Although you mention Excel, it does not seem to be relevant.  (This is 
a good thing, but mentioning it is a red herring.)


c) Your definition of X is not executable R code.  If you have already 
imported data from elsewhere, you can use dput to make it easy for us to 
read it in (essentially) exactly as you have it loaded in your memory. I 
have assumed that you have a vector of strings that you failed to give us.


d) Quoting your variable X is not right. Rather you should index it. See 
below.


On Sun, 25 Nov 2012, ioanna ioannou wrote:


Hello,

A very simple question but I am stuck. I have an excel file each row is an
address. However, I cannot make geocode read each line and come up with the
latitude longitude. Could you please correct my code?


library(ggmap)

X-c (2 Afxentiou Ampelokipi Thessaloniki Greece, 2 Afxentiou Ampelokipi
Thessaloniki Greece, 4 Afxentiou Ampelokipi Thessaloniki Greece, 55
Agathonos Ampelokipi Thessaloniki Greece)

For (i in 1:4){

Y-geocode('X')


Y[i] - geocode(X[i])


print Y[i]

}



Or better yet, eliminate the entire for loop and just give geocode the 
whole vector:


Y - geocode( X )

Then see what is in Y:

Y


Best wishes,

Ioanna

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



---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] compatibility of load() in R 2.15.2

2012-11-26 Thread David Winsemius


On Nov 25, 2012, at 10:50 PM, Jack Tanner wrote:

I have some large-ish files that are the output of save() from R  
2.15.1, which
that version can load() just fine. After upgrading to 2.15.2, load()  
no longer

works on these files. Is this a known issue?


No longer works?

--

David Winsemius, MD
Alameda, CA, USA

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


Re: [R] bbmle Warning: optimization did not converge

2012-11-26 Thread arun4
Thank you Uwe Ligges-3



--
View this message in context: 
http://r.789695.n4.nabble.com/bbmle-Warning-optimization-did-not-converge-tp4650730p4650812.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] R jags clear deviance

2012-11-26 Thread Guillaume2883
Hi all,

I'd like to fit different models using a loop together with the jags
package.
to do this, I load the following packages runjags, R2jags and coda 
and use the function jags to fit my models.
 
The problem is that the following  a windowx with the following message
appear between each model fitting inside my loop : the following objects in
.GlobalEnv will mask objects in the attached database: deviance. Remove this
objests from .GlobalEnv ?
I need to click each time on yes or no and that's bad.

Do you have an idea to overcome thos issue ?

I tried different stuffs using remove function but it did not work

Thanking you in advance

Guillaume





--
View this message in context: 
http://r.789695.n4.nabble.com/R-jags-clear-deviance-tp4650814.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] R strange behaviour when building huge concatenation

2012-11-26 Thread angeloimm
Hello
I'm using some R code in order to use the model BG-NBD implementation
I'm using Java and I call R by using RCaller.
I must admit that i'm really really new to R so maybe I'm doing something
wrong.
I use the code on this URL:  http://code.google.com/p/clv-master-thesis/
http://code.google.com/p/clv-master-thesis/  
This is my working Java code (a simple Junit test):
@Test
public void testRCaller(){
try {
RCaller caller = new RCaller();
caller.setRscriptExecutable(/usr/bin/Rscript);
caller.cleanRCode();
RCode code = new RCode();
code.clear();
String helper = /dati/helper.R;
String modelNbd = /dati/model-nbd.R;
String modelParetoNbd = /dati/model-pareto-nbd.R;
String modelBgNbd = /dati/model-bg-nbd.R;
String modelCbgCnbd = /dati/model-cbg-cnbd-k.R;
code.R_source(helper);
code.R_source(modelNbd);
code.R_source(modelParetoNbd);
code.R_source(modelBgNbd);
code.R_source(modelCbgCnbd);
code.addRCode(cdData - read.table(\/dati/cdnow.csv\, head=T));
code.addRCode(names(cdData)[2] - \x\;);
code.addRCode(bgMleFit - bgEstimateParameters(cdData, list(r=1, alpha=2,
a=1, b=2)););
code.addRCode(summary(bgMleFit););
code.addRCode(cdBgParams - as.list(coef(bgMleFit)););
code.addRCode(t - 39;);
code.addRCode(cdBgCe - bgConditionalForecast(cdData, cdBgParams, t););
code.addRCode((cdBgSumEstimate - sum(cdBgCe)););
code.addRCode((cdBgMsle - mean((log(cdData$p2x+1)-log(cdBgCe+1))^2)););
code.addRCode((corr - cor(cdData$p2x, cdBgCe)););
caller.setRCode(code);
caller.runAndReturnResult(cdBgCe);
ROutputParser parser = caller.getParser();
ArrayListString nomi = parser.getNames();
for (String nome : nomi) {
double[] previsioni = parser.getAsDoubleArray(nome);
logger.info(Nome +nome+ lunghezza valori +previsioni.length);
for (int i = 0; i  previsioni.length; i++) {
logger.info(Valore + previsioni[i]);
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}

By running this code all works pretty good; now i didn't want to use the csv
file as data source; I wanted to query DB and pass data to R
As far as I know the R read.table function builds a data.frame from reading
the provided csv file. So what I did is:
I used Java in order to read the csv and I wrote this code (after I read the
csv file and for semplicity I don't write the code related to the csv
reading):
@Test
public void testRCaller(){
try {
RCaller caller = new RCaller();
caller.setRscriptExecutable(/usr/bin/Rscript);
caller.cleanRCode();
RCode code = new RCode();
code.clear();
String helper = /dati/helper.R;
String modelNbd = /dati/model-nbd.R;
String modelParetoNbd = /dati/model-pareto-nbd.R;
String modelBgNbd = /dati/model-bg-nbd.R;
String modelCbgCnbd = /dati/model-cbg-cnbd-k.R;
code.R_source(helper);
code.R_source(modelNbd);
code.R_source(modelParetoNbd);
code.R_source(modelBgNbd);
code.R_source(modelCbgCnbd);
MapString, Object data = this.readCsvData();
StringBuilder userIds = new StringBuilder(ID - c();
long[] utenti = (long[])data.get(userIds);
int[] ordini = (int[]) data.get(ordini);
double[] tx = (double[]) data.get(tx);
double[] t = (double[])data.get(t);
int[] p2x = (int[]) data.get(p2tx);
for(int i = 0; i  utenti.length; i++){
userIds.append(utenti[i]+, );
}
//here i check if the stringbuilder ends with, and i clean it...checkSb is
simply an utility method
userIds = checkSb(userIds).append(););
code.addIntArray(p1x, ordini);
code.addDoubleArray(tx, tx);
code.addDoubleArray(t, t);
code.addIntArray(p2x, p2x);
code.addRCode(cdData-data.frame(ID , p1x, tx, t, p2x););
code.addRCode(names(cdData)[2] - \x\;);
code.addRCode(bgMleFit - bgEstimateParameters(cdData, list(r=1, alpha=2,
a=1, b=2)););
code.addRCode(summary(bgMleFit););
code.addRCode(cdBgParams - as.list(coef(bgMleFit)););
code.addRCode(t - 39;);
code.addRCode(cdBgCe - bgConditionalForecast(cdData, cdBgParams, t););
code.addRCode((cdBgSumEstimate - sum(cdBgCe)););
code.addRCode((cdBgMsle - mean((log(cdData$p2x+1)-log(cdBgCe+1))^2)););
code.addRCode((corr - cor(cdData$p2x, cdBgCe)););
caller.setRCode(code);
caller.runAndReturnResult(cdBgCe);
ROutputParser parser = caller.getParser();
ArrayListString nomi = parser.getNames();
for (String nome : nomi) {
double[] previsioni = parser.getAsDoubleArray(nome);
logger.info(Nome +nome+ lunghezza valori +previsioni.length);
for (int i = 0; i  previsioni.length; i++) {
logger.info(Valore + previsioni[i]);
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
As you can see the code is totally similar to the previous one except that I
don't use read.table function.
Well by executing this code I have an error. At first I thought in some
error in the Java code but I checked and no error was present
Then I tried the code in the R console. Well I have something really
strange.
Let's start from this instruction (the int array is recovered from the csv
file):

int[] ordini = (int[]) data.get(ordini);
code.addIntArray(p1x, ordini);

This Java-RCaller instruction generates this R code: p1x-c(..).
More exactly the generated R code is the 

Re: [R] compatibility of load() in R 2.15.2

2012-11-26 Thread PIKAL Petr
Hi

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of David Winsemius
 Sent: Monday, November 26, 2012 9:11 AM
 To: Jack Tanner
 Cc: r-h...@stat.math.ethz.ch
 Subject: Re: [R] compatibility of load() in R 2.15.2
 
 
 On Nov 25, 2012, at 10:50 PM, Jack Tanner wrote:
 
  I have some large-ish files that are the output of save() from R
  2.15.1, which that version can load() just fine. After upgrading to
  2.15.2, load() no longer works on these files. Is this a known issue?

What does mean no longer works? Any error message?

I can only guess, but maybe objects in those saved files were created with some 
packages which are not installed in your new R version. If this is the case 
just install those packages and all shall be OK.

Regards
Petr

 
 No longer works?
 
 --
 
 David Winsemius, MD
 Alameda, CA, USA
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Help with predict function in glm

2012-11-26 Thread Rui Barradas

Hello,

Why mail a question just to me? Post to the list and the odds of getting 
more answers (and better) are bigger.
As for your question, the problem is in the call to glm, you don't need 
the prefix 'train$' in the formula, the argument 'data' solves that and 
when predicting R will look for the columns with names in the formula 
and is unable to find columns called train$Outcome and train$Weight in 
the new data.frame 'test'. Corrected:


mylogit - glm(Outcome ~ Weight, data=train, family = binomial(logit))
predictions - predict(mylogit, newdata = test, type= response)


Hope this helps,

Rui Barradas
Em 26-11-2012 01:42, somnath bandyopadhyay escreveu:


Hi,
I am trying some basic logistic regression analysis using glm. I just have one dependent 
variable (Outcome) which is binary in nature and one independent variable (Weight). I fit 
a model using a training data set (train) which has 85 observations and try to apply it 
on an independent dataset (test) which has 55 observations. When I apply the predict 
function on the fitted model for the new dataset, I get the following warning 
Warning message: 'newdata' had 55 rows but variable(s) found have 85 rows and 
the predict works on the training observations and not on the test observations.

Following is he session info, code and the training and test datasets I am 
using.

What am I doing wrong? Any help would be greatly appreciated.

Thanks,
S.


train - read.table(train_data.txt, header=T, row.names=1, sep=\t)
test- read.table(test_data.txt, header=T, row.names=1, sep=\t)
mylogit - glm(train$Outcome ~ train$Weight, data=train, family = 
binomial(logit))
predictions - predict(mylogit, newdata = test, type= response)

Warning message:
'newdata' had 55 rows but variable(s) found have 85 rows



sessionInfo()

R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 
LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

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





train

Outcome Weight
AB256939_21 0 0.331
AB257076_21 0 0.308
AB257079_21 0 0.453
AB415508_21 0 0.303
AB700497_21 0 0.354
AB904508_21 0 0.336
AC048719_21 0 0.420
AC185939_21 0 0.249
AC185940_21 0 1.525
AC445840_21 0 0.261
E7490523_21 0 0.269
E7490524_21 0 0.213
E7659579_21 0 0.360
E7661528_21 0 0.271
E7781094_21 0 0.156
E7781095_21 0 0.221
E7781096_21 0 0.098
E7969081_21 0 0.430
E8117594_21 0 0.321
E8133295_21 0 0.166
E8161578_22 0 0.269
E8483037_21 0 0.162
E8559720_21 0 0.226
L1065550_18 0 0.396
L1065607_17 0 0.541
L1065944_24 0 0.131
L1066017_20 0 0.421
L1069261_12 0 0.357
L1069262_14 0 0.309
L1069263_27 0 0.283
L1069297_24 0 0.620
L1081528_21 0 0.561
L1084066_21 0 0.564
L1086090_21 0 0.649
L1104280_17 0 0.181
L362_22 0 0.199
L1118063_15 0 0.369
L1133550_21 0 0.302
L1144201_14 0 0.249
L1155023_7 0 0.257
L1158386_21 0 0.470
L1163051_4 0 0.446
...
...
...



test

Weight
AB256870_21 0.364
AB256873_21 0.329
AB415518_21 0.219
AB460669_21 0.481
AB609036_21 0.313
AB609038_21 0.196
AB700495_21 0.402
AB700498_21 0.343
AC112834_21 0.372
AC185937_21 0.270
AC269527_21 0.285
E7352023_21 0.358
E7661554_21 0.471
E7750502_21 0.437
E7845183_21 0.232
E7854155_21 0.474
E7854156_21 0.121
E7924877_21 0.312
E7969079_21 0.423
E8139256_21 0.329
E8161577_22 1.060
E8161580_21 0.157
E8364473_21 0.227
E8364474_21 0.069
L1065940_14 0.256
L1065946_10 0.184
L1066018_25 0.282
L1069260_15 1.094









__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] zoo timeseries plot; minor tic mark level control

2012-11-26 Thread Alex van der Spek
I cannot figure out how to tune the minor tic marks on the date axis of a
zoo plot.

I read hundreds of CSV files from a zip archive transparently. The
time/date strings I convert to POSIXct format, order them and then make a
zoo object as there may be cases which have unequal time stamping. As
follows:
##
#Transform timestamps and reorder them
dat - transform(dat, Timestamp = as.POSIXct(Timestamp, format = %m/%d/%Y
%H:%M:%S, tz =Europe/Paris))
dat-dat[order(dat$Timestamp),]

#Make a zoo object
zdt - zoo(dat[,2:4], dat$Timestamp)

#Plot
plot.zoo(zdt,main=mttl,xlab=NULL,panel=panel.yaxis,
 yaxt='n',type = 'l',cex=0.2)
#

The plot is easy. For this data the timestamping is every 5 seconds over
many weeks (2 to 3 months). The standard tic mark labeling I get with the
plot.zoo() is just the abbreviated name of the month (Oct and Nov). How
can I add minor tic marks for the individual days?

All and any help or pointers welcome.
Alex van der Spek

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


Re: [R] zoo timeseries plot; minor tic mark level control

2012-11-26 Thread Gabor Grothendieck
On Mon, Nov 26, 2012 at 6:36 AM, Alex van der Spek do...@xs4all.nl wrote:
 I cannot figure out how to tune the minor tic marks on the date axis of a
 zoo plot.

 I read hundreds of CSV files from a zip archive transparently. The
 time/date strings I convert to POSIXct format, order them and then make a
 zoo object as there may be cases which have unequal time stamping. As
 follows:
 ##
 #Transform timestamps and reorder them
 dat - transform(dat, Timestamp = as.POSIXct(Timestamp, format = %m/%d/%Y
 %H:%M:%S, tz =Europe/Paris))
 dat-dat[order(dat$Timestamp),]

 #Make a zoo object
 zdt - zoo(dat[,2:4], dat$Timestamp)

 #Plot
 plot.zoo(zdt,main=mttl,xlab=NULL,panel=panel.yaxis,
  yaxt='n',type = 'l',cex=0.2)
 #

 The plot is easy. For this data the timestamping is every 5 seconds over
 many weeks (2 to 3 months). The standard tic mark labeling I get with the
 plot.zoo() is just the abbreviated name of the month (Oct and Nov). How
 can I add minor tic marks for the individual days?

 All and any help or pointers welcome.
 Alex van der Spek

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

See the examples in ?plot.zoo . Several of  those have major and minor
tick marks.

--
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


[R] Problem with glm, gaussian family with log-link

2012-11-26 Thread Florian Weiler
Dear all,

I am using the book Generalized Linera Models and Extension by Hardin and
Hilbe (second edition, 2007) at the moment. The authors suggest that
instead of OLS models, the log link is generally used for response data
that take only positive values on the continuous scale. Of course they
also suggest residual plots to check whether a normal linera model using
an identity link can still be used.

I am trying to replicate in R what they do in the book in STATA. Indeed, I
have no problems in STATA with the log link. However, when calling the same
model using R's glm-function, but specifying *family=gaussian(link=log) *I
am asked to provide starting values. When I set them all equal to zero, I
always get the message that the algorithm did not converge. Picking other
values the message is sometimes the same, but more often I get:
*
*
*Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  : *
*  NA/NaN/Inf in 'x' *
*
*
As I said, in STATA I can run these models without setting starting values
and without errors. I tried many different models, and different datasets,
but the problem is always the same (unless I only include one single
independent variable). Could anyone tell me why this is the case, or what I
do wrong, or why the suggested models from the book might not be
appropriate? I'd appreciate any help!

Best,
Florian

[[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] Webinar signup: Advances in Gradient Boosting: the Power of Post-Processing. December 14, 10-11 a.m., PST

2012-11-26 Thread Lisa Solomon
Webinar signup:

Advances in Gradient Boosting: the Power of Post-Processing

December 14, 10-11 a.m., PST



Webinar Registration:
http://2.salford-systems.com/gradientboosting-and-post-processing/


Course Outline:

*Gradient Boosting and Post-Processing:

o   What is missing from Gradient Boosting?

o   Why post-processing techniques are used?

*Applications Benefiting from Post-Processing: Examples from a variety 
of industries.

o   Financial Services

o   Biomedical

o   Environmental

o   Manufacturing

o   Adserving

*Typical Post-Processing Steps

*Techniques:

o   Generalized Path Seeker (GPS): modern high-speed LASSO-style regularized  
regression.

o   Importance Sampled Learning Ensembles (ISLE): identify and reweight  the 
most influential trees.

o   Rulefit: ISLE on steroids.  Identify the most influential nodes and rules.

*Case Study Example:

o   Output/Results without Post-Processing

o   Output/Results with Post-Processing

o   Demo




[[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] Partial dependence plot in randomForest package (all flat responses)

2012-11-26 Thread Liaw, Andy
Not unless we have more information.  Please read the Posting Guide to see how 
to make it easier for people to answer your question.

Best,
Andy

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Oritteropus
Sent: Thursday, November 22, 2012 2:02 PM
To: r-help@r-project.org
Subject: [R] Partial dependence plot in randomForest package (all flat 
responses)

Hi,
I'm trying to make a partial plot with package randomForest in R. After I
perform my random forest object I type

partialPlot(data.rforest, pred.data=act2, x.var=centroid, C) 

where data.rforest is my randomforest object, act2 is the original dataset,
centroid is one of the predictor and C is one of the classes in my response
variable. 
Whatever predictor or response class I try I always get a plot with a
straight line (a completely flat response). Similarly, If I set a
categorical variable as predictor, I get a barplot with all the bar with the
same height. I suppose I'm doing something wrong here because all other
analysis on the same rforest object seem correct (e.g. varImp or MDSplot).
Is it possible it is related to some option set in random forest object? Can
somebody see the problem here?
Thanks for your time



--
View this message in context: 
http://r.789695.n4.nabble.com/Partial-dependence-plot-in-randomForest-package-all-flat-responses-tp4650470.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.
Notice:  This e-mail message, together with any attachme...{{dropped:11}}

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

2012-11-26 Thread ONKELINX, Thierry
Dear all,

I'm trying to connect to an MSAccess database (ArcGIS personal geodatabase). I 
keep getting an error about the channel when using sqlQuery(). However, 
sqlTables() does not complain about the channel and lists all tables in the 
database. If I try sqlFetch(), then R crashes.

I'm happy to hear suggestions on how to solve this.

Best regards,

Thierry

 MDB - 
 odbcConnectAccess(//inbodata/indata/Projects/PRJ_Watervogels/Geoloket/Telgebieden
  watervogeltellingen/Watervogellocaties_copy.mdb)
 sqlQuery(channnel = MDB, SELECT gebiedscode FROM ganzengebieden;)
Error in sqlQuery(channnel = MDB, SELECT gebiedscode FROM ganzengebieden;) :
  first argument is not an open RODBC channel
 sqlTables(channel = MDB) #truncated output!
   TABLE_SCHEMTABLE_NAME   TABLE_TYPE REMARKS
13NAganzengebiedenTABLENA
 sqlFetch(channel = MDB, 'ganzengebieden') #makes R crash

 sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=Dutch_Belgium.1252  LC_CTYPE=Dutch_Belgium.1252
[3] LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Belgium.1252

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

other attached packages:
[1] RODBC_1.3-6

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


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
team Biometrie  Kwaliteitszorg / team Biometrics  Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
thierry.onkel...@inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than 
asking him to perform a post-mortem examination: he may be able to say what the 
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure 
that a reasonable answer can be extracted from a given body of data.
~ John Tukey


* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the 
writer and may not be regarded as stating an official position of INBO, as long 
as the message is not confirmed by a duly signed document.

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


Re: [R] RExcel, ROOo and LibreOffice inquiry

2012-11-26 Thread John Kane


John Kane
Kingston ON Canada


 -Original Message-
 From: landronim...@gmail.com
 Sent: Sun, 25 Nov 2012 15:02:16 +0100
 To: jrkrid...@inbox.com
 Subject: Re: [R] RExcel, ROOo and LibreOffice inquiry
 
 On Sun, Nov 25, 2012 at 2:38 PM, John Kane jrkrid...@inbox.com wrote:
 Can you supply a link for ROOo ? I don't see it anywhere.
 
 Oh, sorry. I thought it was obvious:
 http://rcom.univie.ac.at/download.html#ROOo

It should have been.  I must need new glasses.
 
 
 Also what do you mean OpenOffice is deprecated?
 
 Do you mean in terms of using it with ROOo?   Otherwide OOo, now under
 new management at Apache is under active development under the name
 Apache Open Office.
 
 Sun/Oracle discontinued developing OOo and donated it to Apache, which
 to my surprise made a recent release. However many Linux distros
 switched to LibreOffice, originally forked from OOo in 2010. To my
 understanding LibO is the project that should be followed by
 end-users.

I am not a close follow of the AOO/LibreOffice saga but as far as I know there 
are good points to each and certainly from my reading of the OOo forums there 
is no particular reason in general to go with one or the other.  Each one has 
its own peculiarities and minor bugs so which to use seems a matter of personal 
pereference and specific need at any givin point in time.

I suspect the move to LibreOffice with many distros was more a pollcy decision 
when OOo 's fate was in question.  Since the Apache move, it looks like AOO is 
going to be quite viable.

I think that LibreOffice offers a bit better compatibility with MS products.

I use both on Ubuntu 12.10 quite happily.

 
 Since ROOo is beta and rather outdated, I was wondering if there were
 an effort to bring an RExcel-like functionality to recent LibO or
 Gnumeric releases.

Not the slightest idea about that. Sorry I cannot help.  You might want to post 
a question on one of the OOo forums  about it.  I did not see ROOo in the AOO 
extensions bank so I'd be worried about it.


 
 Regards
 Liviu


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

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

2012-11-26 Thread Terry Therneau
First a statistical issue: The survfit routine will produce predicted survival curves for 
any requested combination of the covariates in the original model.  This is not the same 
thing as an adjusted survival curve.  Confusion on this is prevalent, however.  True 
adjustment requires a population average over the confounding factors and is closely 
related to the standardized incidence ratio concept found in epidemiology.


To answer your technical question:
   fit - coxph(Surv(.
   mysurv - survfit(fit, newdata= mydata)
This will give a set of predicted curves, one for each observation in mydata.  If we 
assume 2 treatments and 4 ethnicities, this means that there are 8 possible predicted 
curves.  You can certainly take the curves for trt=1, white and trt=2, white, plot 
them together on one graph, and call this your adjusted survival curves; the mydata data 
set would have two observations.  This is not a correct label but is certainly common.


Terry Therneau

On 11/26/2012 05:00 AM, r-help-requ...@r-project.org wrote:

Dear R-users
I am trying to make an adjusted Kaplan-Meier curve (using the Survival package) 
but I am having difficulty with
plotting it so that the plot only shows the curves for the adjusted results.
My data come from a randomised controlled trial, and I would like the adjusted 
Kaplan-Meier
curve to only show two curves for the adjusted survival: one for those on 
treatment (Treatment==1)
and another curve for those on placebo (Treatment==0).

My problem is that when I plot the survfit of my coxph, I think it displays a 
curve for
every single individual factor in my coxph, whereas I would like it to only 
display the
adjusted curves for when Treatment==1 and Treatment==0.  How can I do this?

A simplified example of my code with only one effect-modifier is:

simple.cox.ethnicity- coxph(Surv(whenfailed,failed) ~ factor(Treatment) + 
factor(ethnicity)) #I've my data are attached already
survfit.simple.cox.ethnicity- survfit(simple.cox.ethnicity,survmat) #survmat 
is a data.frame that contains Treatment and ethnicity
plot(survfit.simple.cox.ethnicity, col=c(red,black), main=survfit.simple.cox, 
xlab=survival time, ylab=propotion surviving)

Thank you so much for your help.
Yours gratefully,
Brent Caldwell


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

2012-11-26 Thread Sam Steingold
this overcomes the summary generation, but not printing:

--8---cut here---start-8---
summary.difftime - function (v, ...) {
  s - summary(as.numeric(v), ...)
  r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
  names(r) - c(string)
  r[[units(v)]] - s
  class(r) - c(data.frame,summary.difftime)
  r
}
print.summary.difftime - function (sd) print.data.frame(sd)
--8---cut here---end---8---

summary(infl), where infl$delay is a difftime vector, prints

...
   
delay   
  
 string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs, 6.98 
days)  
 secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0, 
602949.7) 

  

  

instead of something like

   delay
   Min.:492 ms
   1st Qu.: 18.08 min

c

so, how do I arrange for a proper printing of difftime summary as a part
of the data frame summary?

 * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-25 00:50:51 -0800]:

 On Nov 24, 2012, at 7:48 PM, Sam Steingold wrote:

 * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-23 13:14:17
 -0800]:

 See 
 http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-should-I-write-summary-methods_003f

 --8---cut here---start-8---
 summary.difftime - function (v) {
  s - summary(as.numeric(v))
  r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
  names(r) - c(string)
  r[[units(v)]] - s
  class(r) - c(data.frame,summary.difftime)
  r
 }
 print.summary.difftime - function (sd) print.data.frame(sd)
 --8---cut here---end---8---

 it appears to work for a single vector:

 --8---cut here---start-8---
 r1 - summary(infl$delay)
 r1
   string secs
 Min.492.00 ms  0.5
 1st Qu. 18.08 min   1085.0
 Median   1.77 hrs   6370.0
 Mean 8.20 hrs  29530.0
 3rd Qu.  8.12 hrs  29250.0
 Max.6.98 days 602900.0
 str(r1)
 Classes 'summary.difftime' and 'data.frame': 6 obs. of  2 variables:
 $ string: chr  492.00 ms 18.08 min 1.77 hrs 8.20 hrs ...
 $ secs  :Classes 'summaryDefault', 'table'  num [1:6] 4.92e-01
 1.08e+03 6.37e+03 2.95e+04 2.92e+04 ...
 --8---cut here---end---8---

 but not as a part of data frame:

 --8---cut here---start-8---
 a - summary(infl)
 Error in summary.difftime(X[[22L]], ...) :
  unused argument(s) (maxsum = 7, digits = 12)
 --8---cut here---end---8---

 I guess I should somehow accept a list of options in
 summary.difftime()
 and pass them on to the inner call to summary() (or should it be
 explicitly summary.numeric()?)


 In the usual way. If you know that the function will be called with
 arguments from the summary.data.frame function then you should allow the
 argument list to accept them. You can ignore them or provide provisions
 for them. You just can't define your function to have only one argument
 if you expect (as you should since you passes summary a dataframe
 object) that it might be called within summary.data.frame.

 This is the argument list for summary.data.frame:

   summary.data.frame
 function (object, maxsum = 7, digits = max(3, getOption(digits) -
 3), ...)

 how do I do that?

 summary.difftime - function (v, ... ) { 

 There are many asked and answered questions on rhelp about how to deal
 with the dots arguments.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://www.memritv.org http://memri.org
http://honestreporting.com http://dhimmi.com http://openvotingconsortium.org
People with a good taste are especially appreciated by cannibals.

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

2012-11-26 Thread Marc Schwartz
On Nov 26, 2012, at 7:37 AM, ONKELINX, Thierry thierry.onkel...@inbo.be 
wrote:

 Dear all,
 
 I'm trying to connect to an MSAccess database (ArcGIS personal geodatabase). 
 I keep getting an error about the channel when using sqlQuery(). However, 
 sqlTables() does not complain about the channel and lists all tables in the 
 database. If I try sqlFetch(), then R crashes.
 
 I'm happy to hear suggestions on how to solve this.
 
 Best regards,
 
 Thierry
 
 MDB - 
 odbcConnectAccess(//inbodata/indata/Projects/PRJ_Watervogels/Geoloket/Telgebieden
  watervogeltellingen/Watervogellocaties_copy.mdb)
 sqlQuery(channnel = MDB, SELECT gebiedscode FROM ganzengebieden;)
 Error in sqlQuery(channnel = MDB, SELECT gebiedscode FROM ganzengebieden;) :
  first argument is not an open RODBC channel
 sqlTables(channel = MDB) #truncated output!
   TABLE_SCHEMTABLE_NAME   TABLE_TYPE REMARKS
 13NAganzengebiedenTABLENA
 sqlFetch(channel = MDB, 'ganzengebieden') #makes R crash
 
 sessionInfo()
 R version 2.15.2 (2012-10-26)
 Platform: i386-w64-mingw32/i386 (32-bit)
 
 locale:
 [1] LC_COLLATE=Dutch_Belgium.1252  LC_CTYPE=Dutch_Belgium.1252
 [3] LC_MONETARY=Dutch_Belgium.1252 LC_NUMERIC=C
 [5] LC_TIME=Dutch_Belgium.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 other attached packages:
 [1] RODBC_1.3-6
 
 loaded via a namespace (and not attached):
 [1] tools_2.15.2


Some comments:

1. DB related posts should go to R-SIG-DB:

  https://stat.ethz.ch/mailman/listinfo/r-sig-db

2. You might try to use odbcConnectAccess2007() to see if that provides a 
resolution.

3. You might also be sure that you don't have a 32/64 bit mis-match between the 
ODBC drivers, the DSN configuration and Access. I note that you are running 32 
bit R on Windows, so perhaps you have already looked into this. There is some 
additional info on this in the RODBC vignette and some posts in the archives 
suggesting that you might get other errors, but worth considering if you have 
not. The crash suggests that something is amiss in the configuration.

Regards,

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.


[R] creation of an high frequency series

2012-11-26 Thread Paul Gilbert


(from R-help Digest, Vol 117, Issue 26)


Date: Sun, 25 Nov 2012 07:49:05 -0800 (PST)
From: billycorgcandi...@gmail.com
To:r-help@r-project.org
Subject: [R] creation of an high frequency series
Message-ID:1353858545067-4650744.p...@n4.nabble.com
Content-Type: text/plain; charset=us-ascii

Hi R Users!

I would like to create an high frequency series but I am experiencing some
difficulties.

My series should start at 09.30 a.m. each day and end at 16.00 for, let's
say, 2 years. I don't care on how many observations are for each day. It's
ok also one observation each minute. In this case, I would have 390
observations each day.

I have tried the following:

start - ISOdatetime(year=2001, month=1, day=1, hour=9, min=0, sec=0,
tz=GMT)
end   - ISOdatetime(year=2001, month=1, day=1, hour=16, min=0, sec=0,
tz=GMT)

z - zooreg(NA, start = start, end = end, frequency=390)


For this problem
 z - zooreg(rep(NA,390), start = start, end = end, frequency=390)

works, however, if your real problem is that you have time stamps, 
possibly not equally spaced, then you should consider zoo() with the 
order.by argument, for example:


z - zoo(rep(NA,390), order.by = start + 30 * 0:389)

If your data source actually provides the time stamps then this should 
be very easy.


Note that neither of these do consistency checking between the length of 
the series and the specified time frame, that is up to you to do. You 
might get warning messages later indicating that something is not right 
if you made a mistake. Your zooreg() above seems to just ignore the 
inconsistency whereas I think zoo() with order.by recycles the data.


Paul



but the result is a poor, single NA. And I am not considering multiple
days..

How could I solve this problem??

Thank you so much!!


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

2012-11-26 Thread R_Antony
Hi,
Here im not able to connect with MS-SQLSERVER database with *.R-File. 

Previously i was able to do in R in different machine and configuration was
R Ver-2.11.1
Package Installed : RODBC_1.3-2

And now where im doinig now there the same code im trying to execute but its
not connecting.
configuration is,
R Ver-2.12
Package Installed : RODBC_1.3-2 - here iam trying to install (RODBC_1.3-6)
which will support for R 2.12. But getting error while do installation.

ERROR I
GETTING==
C:\Documents and Settings\mduserR CMD INSTALL C:\Program
Files\R\R-2.12.0\bin\
RODBC_1.3-6.tar.gz
* installing to library 'C:/PROGRA~1/R/R-212~1.0/library'
* installing *source* package 'RODBC' ...
** libs
gcc -IC:/PROGRA~1/R/R-212~1.0/include -I.-O3 -Wall  -std=gnu99 -c
RODB
C.c -o RODBC.o
gcc: not found
make: *** [RODBC.o] Error 127
ERROR: compilation failed for package 'RODBC'
* removing 'C:/PROGRA~1/R/R-212~1.0/library/RODBC'
==


- Could anyone please help me ?

Thanks
Antony



--
View this message in context: 
http://r.789695.n4.nabble.com/Connect-R-with-SQLSERVER-tp4650822.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] Import/Export excel files to/from R, without changing the file type

2012-11-26 Thread Bart Joosen
You should read your error messages more carefully, especially: could not
find function!

take a look at loadworkbook and loadWorkbook.

Bart



--
View this message in context: 
http://r.789695.n4.nabble.com/Import-Export-excel-files-to-from-R-without-changing-the-file-type-tp4650717p4650823.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How to count the number of different elements in a column

2012-11-26 Thread Hard Core
Hello,
Suppose that i have a dataframe
a - read.dta(banca_impresa.dta)

i have a column with 17900 obs like 

1
2
3
1
6
7
8
3
4
4

and i want to know the number of the different values so in this case it
would be 7 
How can i do? 
Thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825.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] Class Not found execption

2012-11-26 Thread sheenmaria
I am trying to call a r file named es.r which have lotes of R functions. 
These R functions are internally calling java functions by using .jnew()
and .jcall(). I have added 
necessary jar's to the Classpath and I am able to run es.r from command
prompt . 


 But when I tried to call it from anoter r file using source()
getting Exception 
Error in .jnew(com/algoTree/ClientElasticSearch/ElasticSearchLoader) : 
 java.lang.ClassNotFoundException 

How can I solve this ? 
How can i execute the file from r-console. ?



--
View this message in context: 
http://r.789695.n4.nabble.com/Class-Not-found-execption-tp4650824.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

2012-11-26 Thread alanarocha

Goodmorning,
I'moneafazrtrbhoquhasa  
variablefactorcomtwoNivesCandH.Queoaatravésdlinear  
regressionrelationshipetrehaSaerifthe  
variablespthiedoseogmerparawanttheHtothatanddouCrespctinteRaficthat  
showsthe two curvesHandCLIRand

Selecionar tudo
Thank you
Ana C. Rocha Rua

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] merging two specific rows in a DF

2012-11-26 Thread karthicklakshman
Hello members,

I have this data frame with 3 columns,
C1  C2  TYPE
10  20  A
33  44  B
66  80  A
111 140 B
144 220 B
300 340 A
380 449 A
455 500 B
510 520 A
540 580 B

Here,  the rows 4 , 5 has type B and similarly 6,7 has A . I need to
merge these rows in a way to get the output with unique type, something like
below, where the lowest value from DF$C1 and  highest value from DF$C2
corresponding to rows 4,5 are picked.

C1  C2  TYPE
10  20  A
33  44  B
66  80  A
111 220 B
300 449 A
455 500 B
510 520 A
540 580 B

I Request your kind help..
Regards,
karthick




--
View this message in context: 
http://r.789695.n4.nabble.com/merging-two-specific-rows-in-a-DF-tp4650826.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 in splitting the records

2012-11-26 Thread arunkumar1111
Hi

I have set of records seperated by a separator say $$$ i want to get the
values in a dataframe.

eq

qwer$$12$$qwre
ewrtr$7789$ewwe

I want the output as\

V1   V2V3
qwer 12 qwre
ewrtr  7789 ewwwe



Please help me






-
Thanks in Advance
Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/Help-in-splitting-the-records-tp4650827.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] some help

2012-11-26 Thread dattel_palme
Hey again!

I finally, after some work done before, had time to apply the code. 
The sorting of the table did not work well or maybe something was
misunderstood.

I have a table with 973 rows and 1329 col (ascii/text file). I want to sort
the table that all columns are one under each other so that at the end I
have 973*1329 rows and 1 col. The col should be sorted in a way that col 2
is under col 1, col 3 under col 2, col 4 under col 3 etc. 

I applied this code:
dat - read.table(filename, sep=separator, header=TRUE)
stacked - do.call(rbind, dat) 
unlist(dat) 

..but putting dim(dat), the number of rows and col was still 973 and 1329.
So seemingly it did not work as i wanted.

Thanks very much for more help.

Stefan







--
View this message in context: 
http://r.789695.n4.nabble.com/some-help-tp4648316p4650828.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Hard Core
this is wrong because with the command unique it counts the only values
that are unique ..

in my column, for instance, 1 and 4 are not unique so the formula doesn't
work in my case 



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650843.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to count the number of different elements in a column

2012-11-26 Thread chuck.01

length(unique(a))



Hard Core wrote
 Hello,
 Suppose that i have a dataframe
 a - read.dta(banca_impresa.dta)
 
 i have a column with 17900 obs like 
 
 1
 2
 3
 1
 6
 7
 8
 3
 4
 4
 
 and i want to know the number of the different values so in this case it
 would be 7 
 How can i do? 
 Thank you





--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650833.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] Performing operations only on selected data

2012-11-26 Thread arun
HI Marcel,

Sorry, that was a mistake.
I guess this should be the one:
 df$condition2-ifelse(df$condition1=1,runif(length(df$condition1),0,1),df$condition1)
df$condition2 

#[1] 0.5207776 0.5227388 0.5196520 0.6552820 2.000 2.000 2.000
 #[8] 2.000 3.000 3.000 3.000 3.000 4.000 4.000
#[15] 4.000 4.000
A.K.





- Original Message -
From: Jeff Newmiller jdnew...@dcn.davis.ca.us
To: Marcel Curlin cemar...@u.washington.edu; r-help@r-project.org
Cc: 
Sent: Monday, November 26, 2012 1:23 AM
Subject: Re: [R] Performing operations only on selected data

a) Please read the posting guide. This mailing list is not Nabble, and you are 
requested to post in plain text and include context from previous messages in 
the thread.

b) arun's solution is wrong in two respects: it fails to add condition1 to the 
random numbers, and it feeds differently-sized vectors as values to the ifelse 
function.

The length of each argument to ifelse should be as long as the desired result.

BTW: df is a function in the base package, always present. It is not a good 
idea to use that name for your own purposes, as eventually you may want to use 
that base function or at least not confuse others.
---
Jeff Newmiller                        The     .       .  Go Live...
DCN:jdnew...@dcn.davis.ca.us        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Marcel Curlin cemar...@u.washington.edu wrote:

Thank you, this works very well. My only remaining question about this
is
about how ifelse is working; I understand the basic syntax
(df$condition2
gets assigned the value *runif(nrow(df1[df1$condition1=1,]),0,1)* or
the
value *df$condition1* depending on whether or not df$condition1 meets
the
criterion =1.

As I understand it, runif(nrow(df1[df1$condition1=1,]),0,1) is a
vector
of random values with vector length equal to the number of rows meeting
df$condition1=1 and df$condition1 is just my column of condition1
values.
So the command seems to be going down row by row and assigning
condition2
values from one of two vectors in an interleaved way. 

So my question is, how does R keep track of which item in each of the
vectors to assign to condition2? For example, if the first 4 entries of
condition1 are 1, 3, 4, 1,  how does R know to use the *first* entry of
vector runif(nrow(df1[df1$condition1=1,]),0,1) then the *second* and
*third* values of vector df$condition1, then the *second* value of
vector
runif(nrow(df1[df1$condition1=1,]),0,1)?



--
View this message in context:
http://r.789695.n4.nabble.com/Performing-operations-only-on-selected-data-tp4650646p4650803.html
Sent from the R help mailing list archive at Nabble.com.

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

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


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


Re: [R] Help with predict function in glm

2012-11-26 Thread genome1976

That did it!



Thanks so much as always.





I emailed the question to you because I think you are an R expert based 
on all the suggestions, feedback and codes I have received from you in 
the past. 
Yes, I do look for answers in the open 
forum but when it comes to a question for which the answers out there 
are not very clear I prefer to ask somebody whom I can trust. I hope I 
don’t bother you with my questions.
Thanks once again.




Cheers!
-Som.

Date: Mon, 26 Nov 2012 03:33:43 -0800
From: ml-node+s789695n4650829...@n4.nabble.com
To: genome1...@hotmail.com
Subject: Re: Help with predict function in glm



Hello,


Why mail a question just to me? Post to the list and the odds of getting 

more answers (and better) are bigger.

As for your question, the problem is in the call to glm, you don't need 

the prefix 'train$' in the formula, the argument 'data' solves that and 

when predicting R will look for the columns with names in the formula 

and is unable to find columns called train$Outcome and train$Weight in 

the new data.frame 'test'. Corrected:


mylogit - glm(Outcome ~ Weight, data=train, family = binomial(logit))

predictions - predict(mylogit, newdata = test, type= response)



Hope this helps,


Rui Barradas

Em 26-11-2012 01:42, somnath bandyopadhyay escreveu:



 Hi,

 I am trying some basic logistic regression analysis using glm. I just have 
 one dependent variable (Outcome) which is binary in nature and one 
 independent variable (Weight). I fit a model using a training data set 
 (train) which has 85 observations and try to apply it on an independent 
 dataset (test) which has 55 observations. When I apply the predict function 
 on the fitted model for the new dataset, I get the following warning Warning 
 message: 'newdata' had 55 rows but variable(s) found have 85 rows and the 
 predict works on the training observations and not on the test observations.



 Following is he session info, code and the training and test datasets I am 
 using.



 What am I doing wrong? Any help would be greatly appreciated.



 Thanks,

 S.



 train - read.table(train_data.txt, header=T, row.names=1, sep=\t)

 test- read.table(test_data.txt, header=T, row.names=1, sep=\t)

 mylogit - glm(train$Outcome ~ train$Weight, data=train, family = 
 binomial(logit))

 predictions - predict(mylogit, newdata = test, type= response)

 Warning message:

 'newdata' had 55 rows but variable(s) found have 85 rows





 sessionInfo()

 R version 2.15.0 (2012-03-30)

 Platform: x86_64-pc-mingw32/x64 (64-bit)



 locale:

 [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 
 LC_MONETARY=English_United States.1252

 [4] LC_NUMERIC=C LC_TIME=English_United States.1252



 attached base packages:

 [1] stats graphics grDevices utils datasets methods base









 train

 Outcome Weight

 AB256939_21 0 0.331

 AB257076_21 0 0.308

 AB257079_21 0 0.453

 AB415508_21 0 0.303

 AB700497_21 0 0.354

 AB904508_21 0 0.336

 AC048719_21 0 0.420

 AC185939_21 0 0.249

 AC185940_21 0 1.525

 AC445840_21 0 0.261

 E7490523_21 0 0.269

 E7490524_21 0 0.213

 E7659579_21 0 0.360

 E7661528_21 0 0.271

 E7781094_21 0 0.156

 E7781095_21 0 0.221

 E7781096_21 0 0.098

 E7969081_21 0 0.430

 E8117594_21 0 0.321

 E8133295_21 0 0.166

 E8161578_22 0 0.269

 E8483037_21 0 0.162

 E8559720_21 0 0.226

 L1065550_18 0 0.396

 L1065607_17 0 0.541

 L1065944_24 0 0.131

 L1066017_20 0 0.421

 L1069261_12 0 0.357

 L1069262_14 0 0.309

 L1069263_27 0 0.283

 L1069297_24 0 0.620

 L1081528_21 0 0.561

 L1084066_21 0 0.564

 L1086090_21 0 0.649

 L1104280_17 0 0.181

 L362_22 0 0.199

 L1118063_15 0 0.369

 L1133550_21 0 0.302

 L1144201_14 0 0.249

 L1155023_7 0 0.257

 L1158386_21 0 0.470

 L1163051_4 0 0.446

 ...

 ...

 ...





 test

 Weight

 AB256870_21 0.364

 AB256873_21 0.329

 AB415518_21 0.219

 AB460669_21 0.481

 AB609036_21 0.313

 AB609038_21 0.196

 AB700495_21 0.402

 AB700498_21 0.343

 AC112834_21 0.372

 AC185937_21 0.270

 AC269527_21 0.285

 E7352023_21 0.358

 E7661554_21 0.471

 E7750502_21 0.437

 E7845183_21 0.232

 E7854155_21 0.474

 E7854156_21 0.121

 E7924877_21 0.312

 E7969079_21 0.423

 E8139256_21 0.329

 E8161577_22 1.060

 E8161580_21 0.157

 E8364473_21 0.227

 E8364474_21 0.069

 L1065940_14 0.256

 L1065946_10 0.184

 L1066018_25 0.282

 L1069260_15 1.094

 

 











__

[hidden email] mailing list

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












If you reply to this email, your message will be added to the 
discussion below:


Re: [R] puzzling RODBC error

2012-11-26 Thread Bart Joosen
It seems that your sqlTables also give no results.
So there must be something wrong with the ODBC connect.

I didn't use odbcConnectAccess, but made an ODBC connection, and then used
ODBCconnect to connect to our database.
Maybe you can define a user DSN and try it this way?


Bart



--
View this message in context: 
http://r.789695.n4.nabble.com/puzzling-RODBC-error-tp4650837p4650840.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] error in plot(table(c('a','a')))

2012-11-26 Thread Ludo Pagie
Hi all,

there appears to be something strange with the plotting of tables of 1
dimension; if I attempt to make a plot of a table of characters with only
1 value I get an error (Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' and 'y' lengths differ). With more than one value I don't get
errors, neither with integers (even if only 1 value):

tbl.char1 - table(c('a','a'))
tbl.char2 - table(c('a','a','b'))
tbl.int1 - table(c(1,1))

# error:
plot(tbl.char1)

# no errors:
plot(tbl.char2)
plot(tbl.int1)


sessionInfo()


R version 2.14.0 (2011-10-31)
Platform: i686-pc-linux-gnu (32-bit)

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

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



Thanks, Ludo

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

2012-11-26 Thread KitKat
I am following instructions online for cluster analysis using the mclust
package, and keep getting errors.
http://www.statmethods.net/advstats/cluster.html

These are the instructions (there is no sample dataset unfortunately):
# Model Based Clustering
library(mclust)
fit - Mclust(mydata)
plot(fit, mydata) # plot results 
print(fit) # display the best model 

This is what I did and the error I get:
 library(mclust)
 fit - Mclust(mydat)
 plot(fit, mydat) #plot results
Error in match.arg(what, c(BIC, classification, uncertainty,
density),  : 
  'arg' must be NULL or a character vector

My data is arranged so I have each row representing one individual with 9
values for morphological data. I want to see if they will group into 2
clusters, representing gender. 

I have tried using the instructions from the cran-r website, but they didn't
work either

Any help would be great, thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/cluster-analysis-error-mclust-package-tp4650842.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] some help

2012-11-26 Thread dattel_palme
Hey

The code need some corrections and I would kindly ask for help.

Say:
I have a table with two columns:
col1=LST and col2=NDVI
i would like to sort all data by NDVI. 
in reality the NDVI ranges between 0 and 1 (although some values might be
minus also).
I want to sort by NDVI values and then make 100 intervals of 0.01 ndvi.
therefore the first inerval is 0.01-0.02, the second 0.02-0.03 and so on..
for each interval I would like to get the highest (max) and lowest (min)
value of LST. 
It would be very helpful if this values can be written in a seperate
table/file. 

Thanks you very much for help!
Stefan



--
View this message in context: 
http://r.789695.n4.nabble.com/some-help-tp4648316p4650844.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to count the number of different elements in a column

2012-11-26 Thread chuck.01
My apologies.
I still do not understand the difference; good luck. 


Hard Core wrote
 this is wrong because with the command unique it counts the only values
 that are unique ..
 
 in my column, for instance, 1 and 4 are not unique so the formula doesn't
 work in my case





--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650848.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] wrong data interpretation in R

2012-11-26 Thread EcoFranc
Hi,

maybe somebody would be kind enough to help a bloody and unprofessional
beginner like me (and I hope I did not overlook the answer to my question on
the website). I've imported a csv data frame into R, but I can't run a
regression because R interprets 4 out of 5 variables as factors (rather than
numeric vectors). I tried the as.numeric() command, but R says it is invalid
to change the storage mode of a factor. Is there any way to change the mode
of a factor into numeric.

I am very grateful for help. Thank you very much, Robert.



--
View this message in context: 
http://r.789695.n4.nabble.com/wrong-data-interpretation-in-R-tp4650849.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help in splitting the records

2012-11-26 Thread Sarah Goslee
You state that you want $$$ as the separator, but your example has
$$ and $ so  I'm assuming an indeterminate number of consecutive
$.

x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
x - strsplit(x, \\$+)
x - do.call(rbind, x)
x - data.frame(x, stringsAsFactors = FALSE)
x$X2 - as.numeric(x$X2)

I've also made some assumptions about what you want the output to be
like, since you didn't specify, and broken it into as many steps as
possible so that you can look at what functions I used and read the
help files.

Sarah

On Mon, Nov 26, 2012 at 5:51 AM, arunkumar akpbond...@gmail.com wrote:
 Hi

 I have set of records seperated by a separator say $$$ i want to get the
 values in a dataframe.

 eq

 qwer$$12$$qwre
 ewrtr$7789$ewwe

 I want the output as\

 V1   V2V3
 qwer 12 qwre
 ewrtr  7789 ewwwe



 Please help me




--
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Sarah Goslee
 x - c(1, 2, 3, 1, 6, 7, 8, 3, 4, 4)
 length(unique(x))
[1] 7

On Mon, Nov 26, 2012 at 5:20 AM, Hard Core gi...@hotmail.it wrote:
 Hello,
 Suppose that i have a dataframe
 a - read.dta(banca_impresa.dta)

 i have a column with 17900 obs like

 1
 2
 3
 1
 6
 7
 8
 3
 4
 4

 and i want to know the number of the different values so in this case it
 would be 7
 How can i do?
 Thank you



--
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] wrong data interpretation in R

2012-11-26 Thread Sarah Goslee
Most likely there's something amiss in your csv file: R won't convert
numeric data to factors unless there are non-numeric characters
included.

First check your csv file for errors. If that doesn't solve your
problem, please provide a reproducible example.
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Sarah

On Mon, Nov 26, 2012 at 10:59 AM, EcoFranc rob...@gmx.de wrote:
 Hi,

 maybe somebody would be kind enough to help a bloody and unprofessional
 beginner like me (and I hope I did not overlook the answer to my question on
 the website). I've imported a csv data frame into R, but I can't run a
 regression because R interprets 4 out of 5 variables as factors (rather than
 numeric vectors). I tried the as.numeric() command, but R says it is invalid
 to change the storage mode of a factor. Is there any way to change the mode
 of a factor into numeric.

 I am very grateful for help. Thank you very much, Robert.




--
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] How to count the number of different elements in a column

2012-11-26 Thread Jose Iparraguirre
Hi,

Imagine the column is named XX. 

Type:

 nrow(table(banca_impresa$XX))

and you'll get how many different categories there are in that column.

(If you type 
 table(banca_impresa$XX)
you'll get the frequencies).

José


José Iparraguirre
Chief Economist
Age UK

T 020 303 31482
E jose.iparragui...@ageuk.org.uk


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Hard Core
Sent: 26 November 2012 10:20
To: r-help@r-project.org
Subject: [R] How to count the number of different elements in a column

Hello,
Suppose that i have a dataframe
a - read.dta(banca_impresa.dta)

i have a column with 17900 obs like 

1
2
3
1
6
7
8
3
4
4

and i want to know the number of the different values so in this case it
would be 7 
How can i do? 
Thank you



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825.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.

A Star for Christmas

Kick start the festive season by attending one of Age UK’s Carol Concerts, A 
Star for Christmas. Taking place at Manchester Cathedral on Saturday 1 December 
and London’s St Pancras Church (opposite Euston Station) on Thursday 6 
December, they will feature special musical performances, readings by your 
favourite celebrities and carols, followed by mince pies and wine.
Tickets are priced at £20 full price/ £10 concessions. For more information, 
please visit http://www.ageuk.org.uk/astarforchristmas  or contact the 
Fundraising Events Team on
020 303 31725.

Age UK  Improving later life
www.ageuk.org.uk

 

---
Age UK is a registered charity and company limited by guarantee, (registered 
charity number 1128267, registered company number 6825798). 
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed 
Representative of Age UK Enterprises Limited, Age UK is an Introducer 
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth 
Access for the purposes of introducing potential annuity and health 
cash plans customers respectively.  Age UK Enterprises Limited, JLT Benefit 
Solutions Limited and Simplyhealth Access are all authorised and 
regulated by the Financial Services Authority. 
--

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are 
addressed. If you receive a message in error, please advise the sender and 
delete immediately.

Except where this email is sent in the usual course of our business, any 
opinions expressed in this email are those of the author and do not 
necessarily reflect the opinions of Age UK or its subsidiaries and associated 
companies. Age UK monitors all e-mail transmissions passing 
through its network and may block or modify mails which are deemed to be 
unsuitable.

Age Concern England (charity number 261794) and Help the Aged (charity number 
272786) and their trading and other associated companies merged 
on 1st April 2009.  Together they have formed the Age UK Group, dedicated to 
improving the lives of people in later life.  The three national 
Age Concerns in Scotland, Northern Ireland and Wales have also merged with Help 
the Aged in these nations to form three registered charities: 
Age Scotland, Age NI, Age Cymru.










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

2012-11-26 Thread David Winsemius


On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:


this overcomes the summary generation, but not printing:

--8---cut here---start-8---
summary.difftime - function (v, ...) {
 s - summary(as.numeric(v), ...)
 r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
 names(r) - c(string)
 r[[units(v)]] - s
 class(r) - c(data.frame,summary.difftime)
 r
}
print.summary.difftime - function (sd) print.data.frame(sd)
--8---cut here---end---8---

summary(infl), where infl$delay is a difftime vector, prints

...

   delay
string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13  
hrs, 6.98 days)
secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,  
602949.7)




instead of something like

  delay
  Min.:492 ms
  1st Qu.: 18.08 min

c

so, how do I arrange for a proper printing of difftime summary as a  
part

of the data frame summary?


If you like a particular format from an existing print method then why  
not look it up and copy the code?


methods(print)

--
David.


* David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-25 00:50:51  
-0800]:


On Nov 24, 2012, at 7:48 PM, Sam Steingold wrote:


* David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-23 13:14:17
-0800]:


See 
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-should-I-write-summary-methods_003f


--8---cut here---start-8---
summary.difftime - function (v) {
s - summary(as.numeric(v))
r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
names(r) - c(string)
r[[units(v)]] - s
class(r) - c(data.frame,summary.difftime)
r
}
print.summary.difftime - function (sd) print.data.frame(sd)
--8---cut here---end---8---

it appears to work for a single vector:

--8---cut here---start-8---

r1 - summary(infl$delay)
r1

 string secs
Min.492.00 ms  0.5
1st Qu. 18.08 min   1085.0
Median   1.77 hrs   6370.0
Mean 8.20 hrs  29530.0
3rd Qu.  8.12 hrs  29250.0
Max.6.98 days 602900.0

str(r1)

Classes 'summary.difftime' and 'data.frame':6 obs. of  2 variables:
$ string: chr  492.00 ms 18.08 min 1.77 hrs 8.20 hrs ...
$ secs  :Classes 'summaryDefault', 'table'  num [1:6] 4.92e-01
1.08e+03 6.37e+03 2.95e+04 2.92e+04 ...
--8---cut here---end---8---

but not as a part of data frame:

--8---cut here---start-8---

a - summary(infl)

Error in summary.difftime(X[[22L]], ...) :
unused argument(s) (maxsum = 7, digits = 12)
--8---cut here---end---8---

I guess I should somehow accept a list of options in
summary.difftime()
and pass them on to the inner call to summary() (or should it be
explicitly summary.numeric()?)



In the usual way. If you know that the function will be called with
arguments from the summary.data.frame function then you should  
allow the
argument list to accept them. You can ignore them or provide  
provisions
for them. You just can't define your function to have only one  
argument

if you expect (as you should since you passes summary a dataframe
object) that it might be called within summary.data.frame.

This is the argument list for summary.data.frame:


 summary.data.frame

function (object, maxsum = 7, digits = max(3, getOption(digits) -
   3), ...)


how do I do that?


summary.difftime - function (v, ... ) { 

There are many asked and answered questions on rhelp about how to  
deal

with the dots arguments.


--
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X  
11.0.11103000

http://www.childpsy.net/ http://www.memritv.org http://memri.org
http://honestreporting.com http://dhimmi.com http://openvotingconsortium.org
People with a good taste are especially appreciated by cannibals.


David Winsemius, MD
Alameda, CA, USA

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


Re: [R] Connect R with SQLSERVER

2012-11-26 Thread Marc Schwartz
On Nov 26, 2012, at 3:53 AM, R_Antony antony.akk...@ge.com wrote:

 Hi,
 Here im not able to connect with MS-SQLSERVER database with *.R-File. 
 
 Previously i was able to do in R in different machine and configuration was
 R Ver-2.11.1
 Package Installed : RODBC_1.3-2
 
 And now where im doinig now there the same code im trying to execute but its
 not connecting.
 configuration is,
 R Ver-2.12
 Package Installed : RODBC_1.3-2 - here iam trying to install (RODBC_1.3-6)
 which will support for R 2.12. But getting error while do installation.
 
 ERROR I
 GETTING==
 C:\Documents and Settings\mduserR CMD INSTALL C:\Program
 Files\R\R-2.12.0\bin\
 RODBC_1.3-6.tar.gz
 * installing to library 'C:/PROGRA~1/R/R-212~1.0/library'
 * installing *source* package 'RODBC' ...
 ** libs
 gcc -IC:/PROGRA~1/R/R-212~1.0/include -I.-O3 -Wall  -std=gnu99 -c
 RODB
 C.c -o RODBC.o
 gcc: not found
 make: *** [RODBC.o] Error 127
 ERROR: compilation failed for package 'RODBC'
 * removing 'C:/PROGRA~1/R/R-212~1.0/library/RODBC'
 ==
 
 
 - Could anyone please help me ?
 
 Thanks
 Antony


First, DB related posts should go to R-SIG-DB:

 https://stat.ethz.ch/mailman/listinfo/r-sig-db

Please use that in the future, not R-Help.

Second, why are you trying to install the *source* version of RODBC when there 
are pre-compiled binary versions of the package available for Windows? 

Just use:

  install.packages(RODBC)

within an R session.

Finally, R version 2.12.0 is now over two years old. 2.15.2 is the current 
version, so you should also be updating your R installation.

Regards,

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] How to count the number of different elements in a column

2012-11-26 Thread Rui Barradas

Hello,

You're wrong, unique doesn't count unique returns a vector without 
repetitions.


unique(a)  # includes 1 and 4
[1] 1 2 3 6 7 8 4
length(unique(a))
[1] 7


Hope this helps,

Rui Barradas
Em 26-11-2012 14:55, Hard Core escreveu:

this is wrong because with the command unique it counts the only values
that are unique ..

in my column, for instance, 1 and 4 are not unique so the formula doesn't
work in my case



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650843.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] wrong data interpretation in R

2012-11-26 Thread Don McKenzie
Robert -- it may be that some of your factor variables cannot be  
coerced to numeric because they have non-numeric elements.
This is why we ask for a reproducible example when posting.  I  
suspect just a few lines from the data frame would tell the story.


On 26-Nov-12, at 7:59 AM, EcoFranc wrote:


Hi,

maybe somebody would be kind enough to help a bloody and  
unprofessional
beginner like me (and I hope I did not overlook the answer to my  
question on

the website). I've imported a csv data frame into R, but I can't run a
regression because R interprets 4 out of 5 variables as factors  
(rather than
numeric vectors). I tried the as.numeric() command, but R says it  
is invalid
to change the storage mode of a factor. Is there any way to change  
the mode

of a factor into numeric.

I am very grateful for help. Thank you very much, Robert.



--
View this message in context: http://r.789695.n4.nabble.com/wrong- 
data-interpretation-in-R-tp4650849.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.






Don McKenzie, Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service
phone: 206-732-7824

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington

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

2012-11-26 Thread Marcio Pupin Mello

Lorenzo,
	I'd suggest posting such questions to the R-sig-geo list, which seems 
more suitable.
	The book Applied Spatial Data Analysis with R written by Roger 
Bivand, Edzer Pebesma and Virgilio Gómez-Rubio has exactly what you want.

http://www.amazon.com/Applied-Spatial-Data-Analysis-Use/dp/0387781706
Package classInt can help with colouring;
	and about the legend: The location may also be specified by setting x 
to a single keyword from the list bottomright, bottom, bottomleft, 
left, topleft, top, topright, right and center. This places 
the legend on the inside of the plot frame at the given location. 
Partial argument matching is used. The optional inset argument specifies 
how far the legend is inset from the plot margins. If a single value is 
given, it is used for both margins; if two values are given, the first 
is used for x- distance, the second for y-distance.

Good luck!

Marcio
www.dsr.inpe.br/~mello


On 8/13/12 11:33 PM, Lorenzo Isella wrote:

Dear All,
Please see the short script at the end of the email, which I assembled
looking for bits and pieces on the web.
It essentially does what I need: it plots several countries as a
color-coded map.
I just would like to fine-tune a bit the final image, in particular

(1) Select my own colors for painting the countries (i.e. associate
manually a color to every level)
(2) Be able to control the position of the legend and the size of the
character used in the legend itself.

Any suggestion is welcome.
Cheers

Lorenzo

à

## you will need the sp-package
library('sp')

## load a file from GADM (you just have to specify the countries
special part of the file name, like ARG for Argentina. Optionally
you can specify which level you want to have
loadGADM - function (fileName, level = 0, ...) {
 load(url(paste(http://gadm.org/data/rda/;, fileName, _adm,
level, .RData, sep = )))
 gadm
}

## the maps objects get a prefix (like ARG_ for Argentina)
changeGADMPrefix - function (GADM, prefix) {
 GADM - spChFIDs(GADM, paste(prefix, row.names(GADM), sep = _))
 GADM
}

## load file and change prefix
loadChangePrefix - function (fileName, level = 0, ...) {
 theFile - loadGADM(fileName, level)
 theFile - changeGADMPrefix(theFile, fileName)
 theFile
}

## this function creates a SpatialPolygonsDataFrame that contains all
maps you specify in fileNames.
## E.g.:
## spdf - getCountries(c(ARG,BOL,CHL))
## plot(spdf) # should draw a map with Brasil, Argentina and Chile on it.
getCountries - function (fileNames, level = 0, ...) {
 polygon - sapply(fileNames, loadChangePrefix, level)
 polyMap - do.call(rbind, polygon)
 polyMap
}

spdf - getCountries(c(ITA,CHE,FRA, DEU,BEL, LUX))

AP - c(SLS,SLS, NWS, NSLS, NSLS, NWS)

spdf$AP - as.factor(AP)

png(many-countries.png)
## print(spplot(spdf, NAME_ENGLI))
print(spplot(spdf, AP))
## plot(spdf)
dev.off()

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


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

2012-11-26 Thread jim holtman
Also when reading a CSV file, if you do not want characters columns
converted to factors, use 'as.is = TRUE' as one of the parameters.  If
you have a column that is a factor, to convert it to numeric you have
to do the following:

as.numeric(as.character(factorColumn))

notice that you have to convert it to character first; otherwise you
will get the numeric value of the factor which is probably not what
you want.

On Mon, Nov 26, 2012 at 12:02 PM, Sarah Goslee sarah.gos...@gmail.com wrote:
 Most likely there's something amiss in your csv file: R won't convert
 numeric data to factors unless there are non-numeric characters
 included.

 First check your csv file for errors. If that doesn't solve your
 problem, please provide a reproducible example.
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 Sarah

 On Mon, Nov 26, 2012 at 10:59 AM, EcoFranc rob...@gmx.de wrote:
 Hi,

 maybe somebody would be kind enough to help a bloody and unprofessional
 beginner like me (and I hope I did not overlook the answer to my question on
 the website). I've imported a csv data frame into R, but I can't run a
 regression because R interprets 4 out of 5 variables as factors (rather than
 numeric vectors). I tried the as.numeric() command, but R says it is invalid
 to change the storage mode of a factor. Is there any way to change the mode
 of a factor into numeric.

 I am very grateful for help. Thank you very much, Robert.




 --
 Sarah Goslee
 http://www.functionaldiversity.org

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



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

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

2012-11-26 Thread Richard M. Heiberger
EcoFranc,

di you remember to use the argument
header=TRUE
?

If not, the variable name is interpreted as data and will flip you into
factor rather than numeric.

On Mon, Nov 26, 2012 at 12:15 PM, jim holtman jholt...@gmail.com wrote:

 Also when reading a CSV file, if you do not want characters columns
 converted to factors, use 'as.is = TRUE' as one of the parameters.  If
 you have a column that is a factor, to convert it to numeric you have
 to do the following:

 as.numeric(as.character(factorColumn))

 notice that you have to convert it to character first; otherwise you
 will get the numeric value of the factor which is probably not what
 you want.

 On Mon, Nov 26, 2012 at 12:02 PM, Sarah Goslee sarah.gos...@gmail.com
 wrote:
  Most likely there's something amiss in your csv file: R won't convert
  numeric data to factors unless there are non-numeric characters
  included.
 
  First check your csv file for errors. If that doesn't solve your
  problem, please provide a reproducible example.
 
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 
  Sarah
 
  On Mon, Nov 26, 2012 at 10:59 AM, EcoFranc rob...@gmx.de wrote:
  Hi,
 
  maybe somebody would be kind enough to help a bloody and unprofessional
  beginner like me (and I hope I did not overlook the answer to my
 question on
  the website). I've imported a csv data frame into R, but I can't run a
  regression because R interprets 4 out of 5 variables as factors (rather
 than
  numeric vectors). I tried the as.numeric() command, but R says it is
 invalid
  to change the storage mode of a factor. Is there any way to change the
 mode
  of a factor into numeric.
 
  I am very grateful for help. Thank you very much, Robert.
 
 
 
 
  --
  Sarah Goslee
  http://www.functionaldiversity.org
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?
 Tell me what you want to do, not how you want to do it.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] merging two specific rows in a DF

2012-11-26 Thread Rui Barradas

Hello,

Try the following.


x - read.table(text=
C1 C2 TYPE
10 20 A
33 44 B
66 80 A
111 140 B
144 220 B
300 340 A
380 449 A
455 500 B
510 520 A
540 580 B
, header = TRUE)
x


fun - function(x){
mn - which.min(x$C1)
mx - which.max(x$C2)
c(C1 = x$C1[mn], C2 = x$C2[mx], TYPE = x$TYPE[1])
}

idx - seq_len(nrow(x))[-1]
idx2 - cumsum(c(FALSE, x$TYPE[idx - 1] != x$TYPE[idx]))
y - do.call(rbind, lapply(split(x, idx2), fun))
rownames(y) - seq_len(nrow(y))
y


Hope this helps,

Rui Barradas
Em 26-11-2012 10:24, karthicklakshman escreveu:

Hello members,

I have this data frame with 3 columns,
C1  C2  TYPE
10  20  A
33  44  B
66  80  A
111 140 B
144 220 B
300 340 A
380 449 A
455 500 B
510 520 A
540 580 B

Here,  the rows 4 , 5 has type B and similarly 6,7 has A . I need to
merge these rows in a way to get the output with unique type, something like
below, where the lowest value from DF$C1 and  highest value from DF$C2
corresponding to rows 4,5 are picked.

C1  C2  TYPE
10  20  A
33  44  B
66  80  A
111 220 B
300 449 A
455 500 B
510 520 A
540 580 B

I Request your kind help..
Regards,
karthick




--
View this message in context: 
http://r.789695.n4.nabble.com/merging-two-specific-rows-in-a-DF-tp4650826.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] merging two specific rows in a DF

2012-11-26 Thread jim holtman
try this:

 x - read.table(text = C1  C2  TYPE
+ 10  20  A
+ 33  44  B
+ 66  80  A
+ 111 140 B
+ 144 220 B
+ 300 340 A
+ 380 449 A
+ 455 500 B
+ 510 520 A
+ 540 580 B, header = TRUE, as.is = TRUE)
 # mark successive rows that are different
 x$diff - c(TRUE, head(x$TYPE, -1) != tail(x$TYPE, -1))
 # create groups where adjacent rows are the same
 x$group - cumsum(x$diff)
 # now process each group to get min/max
 result - lapply(split(x, x$group), function(.same){
+ c1Min - min(.same$C1)
+ c2Max - max(.same$C2)
+ # put result back into first row and just return its value
+ .same$C1[1L] - c1Min
+ .same$C2[1L] - c2Max
+ .same[1,1:3]  # return value drop off the extra columns we added
+ })
 # combine back together
 do.call(rbind, result)
   C1  C2 TYPE
1  10  20A
2  33  44B
3  66  80A
4 111 220B
5 300 449A
6 455 500B
7 510 520A
8 540 580B





On Mon, Nov 26, 2012 at 5:24 AM, karthicklakshman
karthick.laksh...@gmail.com wrote:
 Hello members,

 I have this data frame with 3 columns,
 C1  C2  TYPE
 10  20  A
 33  44  B
 66  80  A
 111 140 B
 144 220 B
 300 340 A
 380 449 A
 455 500 B
 510 520 A
 540 580 B

 Here,  the rows 4 , 5 has type B and similarly 6,7 has A . I need to
 merge these rows in a way to get the output with unique type, something like
 below, where the lowest value from DF$C1 and  highest value from DF$C2
 corresponding to rows 4,5 are picked.

 C1  C2  TYPE
 10  20  A
 33  44  B
 66  80  A
 111 220 B
 300 449 A
 455 500 B
 510 520 A
 540 580 B

 I Request your kind help..
 Regards,
 karthick




 --
 View this message in context: 
 http://r.789695.n4.nabble.com/merging-two-specific-rows-in-a-DF-tp4650826.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

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


[R] Fwd: prediction problem

2012-11-26 Thread Catarina Maia
-- Forwarded message --
From: Catarina Maia catarinaramosm...@gmail.com
Date: 2012/11/22
Subject: prediction problem
To: r-help@r-project.org


Hello,



I am using the mda package and in particular the fda routine to
classify/predict in terms of color to a set of 20 samples for which i don´t
know the color.

I preformed a flexible discriminant analysis (FDA) using a set of 147
samples for which i know all the information.



My script and data follow in attachment.



 A total of 23 predictors were considered. 20 of the predictors are
numeric and 3 are discrete/categorical.



The resulting FDA rule was applied to the matrix and for the same
predictors in order to predict the color. However a consistent error is
occuring:



Error in mindist[l] - ndist[l] :

**NAs are not allowed in subscripted assignments



It is possible the problem being related with the 2 predictors that are
discrete/categorical variables?



There is already available some rotine to perform a discriminant analysis
considering continuous and discrete/categorical variables?



If someone can help, would be very grateful.



cheers,



Catarina
n   Codecolor   GROUP_N Licenca_N   type1_W type2_W type3_W type4_W 
type5_W type6_W type7_W type8_W type9_W type1_V type2_V type3_V type4_V type5_V 
type7_V type8_V type9_V type10_Vtype11_Vtotal
1   PRT0026940473   verde   A8  B7  0,558416119 0   
0   0   0,152231706 0,243598713 0   0   0,005176997 
0,483991231 0   0   0   0,375554726 0,092127884 0   
0   0   0,011391047 714,7
2   PRT0026940480   verde   A8  B7  0,431011386 0   
0   0   0,090087073 0,389819156 0   0   0   
0,27662459  0   0   0   0,329209955 0,254047865 0   
0   0   0   597,2
3   PRT0026940500   verde   A8  B7  0,349034749 0   
0,013127413 0   0,362162162 0,197297297 0   0   0   
0,166132511 0   0,005179074 0   0,647152728 0,095422917 
0   0   0   0   259
4   PRT0026940507   verde   A8  B7  0,38562904  0   
0   0   0,235952263 0,245400298 0   0   0   
0,195929366 0   0   0   0,561989935 0,149391253 0   
0   0   0   402,2
6   PRT0042540249   verde   A9  B7  0,160142349 0   
0   0,0113879   0   0,098932384 0   0   0   
0,071878686 0   0   0,017455771 0   0,127177759 0   
0   0   0   140,5
7   PRT0042540358   verde   A9  B7  0,258287293 0   
0   0   0,04558011  0,165745856 0   0   0   
0,308268994 0   0   0   0,147252993 0,073850285 0   
0   0   0   72,4
9   PRT0042540498   verde   A9  B7  0,535232384 0   
0   0   0,230384808 0,143428286 0   0   0   
0,220279346 0   0   0   0,50482587  0,113254862 
0,089373366 0   0   0   200,1
10  PRT0042540507   verde   A9  B7  0,631288766 0   
0   0,029634735 0,188146106 0   0   0   0   
0,187408732 0   0   0,033825063 0,637267173 0   0   
0   0   0   145,1
11  PRT0042540527   verde   A9  B7  0,775214835 0   
0   0,014925373 0,03256445  0,054726368 0   0   0   
0,610476668 0   0   0,031623122 0,225502758 0,110096002 
0   0   0   0   221,1
12  PRT0112140260   amarelo A7  B5  0   0   
0,009701493 0,664925373 0   0,017164179 0,042537313 
0,023880597 0   0   0   0,011007463 0,617276119 0   
0,004626866 0   0,120279851 0,012649254 0   134
13  PRT0112140305   azulA7  B5  0   0   0   
0   0   0   0,095049505 0   0   0   0   0   
0   0   0   0,080972426 0,567469139 0   0   101
14  PRT0112140366   azulA7  B5  0   0   
0,014857143 0,102857143 0,040,014857143 0,011428571 
0,217142857 0   0   0   0,005893035 0,125398294 
0,16692363  0,013019495 0   0,024394422 0,152328091 0   
87,5
15  PRT0112140373   azulA7  B5  0   0   
0,019488429 0,052375152 0   0,017052375 0,052375152 0   
0   0   0   0,020974032 0,041306002 0   0,007062684 
0   0,2152573   0   0   82,1
16  PRT0112140382   azulA7  B5  0 

Re: [R] some help

2012-11-26 Thread jim holtman
try this:  (provide sample data next time)

 # create some test data
 x - data.frame(LST = runif(1000), NDVI = runif(1000, 0, 1))
 head(x,10)  # show some data
  LST   NDVI
1  0.86542839 0.95129647
2  0.88910058 0.75971649
3  0.44086718 0.86532140
4  0.99879370 0.05511501
5  0.02401490 0.92282834
6  0.56026534 0.80915721
7  0.65051596 0.03606430
8  0.25897388 0.61624609
9  0.07873261 0.85179368
10 0.09829056 0.91198307
 # create partition values
 partition - seq(0, 1, .01)
 # add column to the data to define the partition
 x$part - cut(x$NDVI, partition)
 head(x)
LST   NDVIpart
1 0.8654284 0.95129647 (0.95,0.96]
2 0.8891006 0.75971649 (0.75,0.76]
3 0.4408672 0.86532140 (0.86,0.87]
4 0.9987937 0.05511501 (0.05,0.06]
5 0.0240149 0.92282834 (0.92,0.93]
6 0.5602653 0.80915721  (0.8,0.81]
 # now compute range (min/mx) for the data
 xRange - tapply(x$LST, x$part, range)
 head(xRange, 10)
$`(0,0.01]`
[1] 0.01945995 0.83500402

$`(0.01,0.02]`
[1] 0.02267906 0.69770971

$`(0.02,0.03]`
[1] 0.01287795 0.75275416

$`(0.03,0.04]`
[1] 0.1402162 0.9960408

$`(0.04,0.05]`
[1] 0.007688249 0.691519845

$`(0.05,0.06]`
[1] 0.1047314 0.9987937

$`(0.06,0.07]`
[1] 0.002181767 0.990990999

$`(0.07,0.08]`
[1] 0.08271319 0.87609409

$`(0.08,0.09]`
[1] 0.1174585 0.8931750

$`(0.09,0.1]`
[1] 0.2331289 0.8485212



On Mon, Nov 26, 2012 at 9:56 AM, dattel_palme dattel_pa...@yahoo.de wrote:
 Hey

 The code need some corrections and I would kindly ask for help.

 Say:
 I have a table with two columns:
 col1=LST and col2=NDVI
 i would like to sort all data by NDVI.
 in reality the NDVI ranges between 0 and 1 (although some values might be
 minus also).
 I want to sort by NDVI values and then make 100 intervals of 0.01 ndvi.
 therefore the first inerval is 0.01-0.02, the second 0.02-0.03 and so on..
 for each interval I would like to get the highest (max) and lowest (min)
 value of LST.
 It would be very helpful if this values can be written in a seperate
 table/file.

 Thanks you very much for help!
 Stefan



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/some-help-tp4648316p4650844.html
 Sent from the R help mailing list archive at Nabble.com.

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



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

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

2012-11-26 Thread arun
Hi, 
You could do this: 
Lines-qwer$$12$$qwre 
ewrtr$7789$ewwe 
 
res-unlist(strsplit(Lines,split=\\$|\n)) 
 as.data.frame(matrix(res[res!=],nrow=2,byrow=TRUE),stringsAsFactors=FALSE)   
   V1   V2   V3 
#1  qwer   12 qwre 
#2 ewrtr 7789 ewwe 

A.K. 



- Original Message -
From: arunkumar akpbond...@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Monday, November 26, 2012 5:51 AM
Subject: [R] Help in splitting the records

Hi

I have set of records seperated by a separator say $$$ i want to get the
values in a dataframe.

eq

qwer$$12$$qwre
ewrtr$7789$ewwe

I want the output as\

V1       V2    V3
qwer 12 qwre
ewrtr  7789 ewwwe



Please help me






-
Thanks in Advance
        Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/Help-in-splitting-the-records-tp4650827.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] DF grouping

2012-11-26 Thread karthicklakshman
Hello Petr Savicky, hello all,

I have a situation similar to the previous one,
I need to group a data.frame in a specific way,

col1 col2   score
2873  3192   319
4268  4451   183
5389  5534   145
6622 10622  4000
12631 17853  5222
20408 20615   207
21595 21838   243
23121 2313918

the out put should be like,

[1] 
2873  3192   4268  4451   5389  5534  6622 10622 
[2] 
10622  12631
[3] 
17853 20408 20615  21595 21838   23121 23139 

Basically the split should be based on the DF$score  500, and all the col1
and col2 values should be aggregated. but  DF[i, col2] != DF[i+1, col1]

Your inputs will be very helpful
Thank you
Karthick




--
View this message in context: 
http://r.789695.n4.nabble.com/DF-grouping-tp4381310p4650865.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help in splitting the records

2012-11-26 Thread Mark Lamias
In the example below, I don't see any $$$ separators.  Are you sure this is 
supposed to be the separate or just a single dollar sign?  If this is the case, 
you don't specify what is to happen when multiple separators appear next to 
each other.  From your example, it appears that two separators are to be 
treated as one?  




 From: arunkumar akpbond...@gmail.com
To: r-help@r-project.org 
Sent: Monday, November 26, 2012 5:51 AM
Subject: [R] Help in splitting the records

Hi

I have set of records seperated by a separator say $$$ i want to get the
values in a dataframe.

eq

qwer$$12$$qwre
ewrtr$7789$ewwe

I want the output as\

V1       V2    V3
qwer 12 qwre
ewrtr  7789 ewwwe



Please help me






-
Thanks in Advance
        Arun
--
View this message in context: 
http://r.789695.n4.nabble.com/Help-in-splitting-the-records-tp4650827.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] cacheSweave problem

2012-11-26 Thread annihination
I noticed the following problem with cacheSweave. 

If I want to print the result of a list object, with cache=TRUE option, if I
just use summary(x), the output would not appear in the tex file. If I use
print(summary(x)) instead, the output would appear.

With cache=FALSE option, however, summary(x) and print(summary(x)) both have
the output.

Is this a bug for cacheSweave package?

%This chunk would not have output
eval=T,echo=T,results=verbatim,cache=TRUE=
x=NULL
x[[1]]=rnorm(100)
x[[2]]=rnorm(100)
x[[3]]=rnorm(100)
summary(x)
@ 

%This chunk would have output
eval=T,echo=T,results=verbatim,cache=TRUE=
print(summary(x))
@ 

%This chunk would also have output
eval=T,echo=T,results=verbatim,cache=FALSE=
summary(x)
@ 





--
View this message in context: 
http://r.789695.n4.nabble.com/cacheSweave-problem-tp4650868.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] cosine curve fit

2012-11-26 Thread dysonsphere
does anybody have a suggestion as to how to use R to fit some date to a
cosine function and then have some output statistics that will evaluate the
fit?  



--
View this message in context: 
http://r.789695.n4.nabble.com/cosine-curve-fit-tp4650866.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] wavelet Variance Error

2012-11-26 Thread AidenJohnson
The message is referring to the format of your input data. The package needs
a matrix or vector format.
I suggest using this: 
xm- as.matrix(x)
return.modwt-modwt(xm, filter=la8, n.levels=5, boundary=periodic,
fast=TRUE) 




--
View this message in context: 
http://r.789695.n4.nabble.com/wavelet-Variance-Error-tp4301149p4650871.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] ncvreg question

2012-11-26 Thread Jiayi Hou
To whom It May Concern,

I am working on a dimensional reduction problem using Smoothly Clipped
Asolute Deviation (SCAD) Penalty according to Variable Selection via
Nonconcave Penalized Likelihood and its Oracle Properties, J.Fan and R. Li,
JASA, Dec 2001. I found an R package named *ncvreg* which is capable
to perform this variable selection procedure. I noctice, in
function*ncvreg(x, y),
* an intercept is automatically added to the model fitting step. I wonder,
is there anyway to remove the intercept, something similar to
*lars()*where you can specify the option and let
*intercept=FALSE.* Or, does intercept has to be included for SCAD
penalized regression?

Could someone give a clue? Thanks,

-Jiayi

-- 
Jiayi Hou
Ph.D Candidate
Department of Biostatistics
School of Medicine
Virginia Commonwealth University
Tel:(804)-828-2879(office)
   (804)-274-8757(cell)

[[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 count the number of different elements in a column

2012-11-26 Thread Hard Core
Yes, I'm sorry ... i was checking for another column so i made a mistake.
Thank you people  ;)



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-count-the-number-of-different-elements-in-a-column-tp4650825p4650875.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] Plot(x,y) help

2012-11-26 Thread YAddo
Dear All:

I would any appreciate any help with this plot I am struggling with.

I have 4 estimates (95% CIs) I want to plot. I want the CI lines to be
horizontal on each plotted point. I was trying to tweak some old codes  (was
for a vertical CI  lines) into horizontal but not much dice. 

Many thanks in advance for your help.

YA


My working codes:

x=c(1,1,1,1.1,1.1,1.1,2,2,2,2.1,2.1,2.1)
y=c(1.73,1.30,2.30, 1.83,1.36,2.45,1.46,1.07,2.00,1.58,1.15,2.17)

ptidx = seq(1,12,by=3)
lciidx = seq(2,12,by=3)
uciidx = seq(3,12,by=3)

plot(x,y, type=n,axes=F, xlab=PR(95% CI),ylab= )

points(x[ptidx],y[ptidx],pch=19,cex=4.5)
points(x[lciidx],y[lciidx],pch=_,cex=4.5)
points(x[uciidx],y[uciidx],pch=_,cex=4.5)
box()

for(i in 1:4)
{
 
lines(c(x[lciidx[i]],x[uciidx[i]]),c(y[lciidx[i]],y[uciidx[i]],lwd=4,cex=4.5))
  
}






--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-x-y-help-tp4650874.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] reclassification function

2012-11-26 Thread Joele
Hi everyone, 

I have tried to produce a table with reclassification (continuous NRI, p
value) using the reclassification() function in the PredictABEL package.  My
problem is that I can only get the results printed on the screen, rather
than stored in an object (as when doing a regular regression), and thus need
to do a lot of manual copy-paste. Also, it seems that I end up with 0 when
the p-value is more significant than 10^-6. 

copied from screen: NRI(Continuous) [95% CI]: 0.3487 [ 0.2701 - 0.4274 ] ;
p-value: 0 

Any piece of advise would be highly appreciated. 

Thanks!

/Joel



--
View this message in context: 
http://r.789695.n4.nabble.com/reclassification-function-tp4650851.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help in splitting the records

2012-11-26 Thread Bert Gunter
Sarah:

You may not agree, but the following avoids the IMHO ugly rbind() and
separate conversion to numeric by using scan():

## first, as before..

x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
x - strsplit(x, \\$+)

## Then, instead ...

x.convert - data.frame(scan(textConnection(unlist(x)),wh=list(a,0,a)))

## You'll need to replace with suitable column names, of course

Cheers,
Bert


On Mon, Nov 26, 2012 at 9:00 AM, Sarah Goslee sarah.gos...@gmail.comwrote:

 You state that you want $$$ as the separator, but your example has
 $$ and $ so  I'm assuming an indeterminate number of consecutive
 $.

 x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
 x - strsplit(x, \\$+)
 x - do.call(rbind, x)
 x - data.frame(x, stringsAsFactors = FALSE)
 x$X2 - as.numeric(x$X2)

 I've also made some assumptions about what you want the output to be
 like, since you didn't specify, and broken it into as many steps as
 possible so that you can look at what functions I used and read the
 help files.

 Sarah

 On Mon, Nov 26, 2012 at 5:51 AM, arunkumar akpbond...@gmail.com
 wrote:
  Hi
 
  I have set of records seperated by a separator say $$$ i want to get
 the
  values in a dataframe.
 
  eq
 
  qwer$$12$$qwre
  ewrtr$7789$ewwe
 
  I want the output as\
 
  V1   V2V3
  qwer 12 qwre
  ewrtr  7789 ewwwe
 
 
 
  Please help me
 
 


 --
 Sarah Goslee
 http://www.functionaldiversity.org

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




-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[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] Savitzky-Golay filtering with missing data

2012-11-26 Thread Ryan Hope
I have a timeseries with some missing data points that I need smoothed
using a Savitzky-Golay. Right now I am using the sgolayfilt function
in the signal package. It fails if I have NA values in the timeseries.
If I replace NA with NULL sgolayfilt does not fail but it drops the
NULL values which is not really a valid solution. Is there anything I
can do about this?

-- 
Ryan Hope, M.S.
CogWorks Lab
Cognitive Science Department
Rensselaer Polytechnic Institute

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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(x,y) help

2012-11-26 Thread jim holtman
Try this code that uses segments to draw in the bars

# put data into a nicer form
y=c(1.73,1.30,2.30, 1.83,1.36,2.45,1.46,1.07,2.00,1.58,1.15,2.17)
ym - matrix(y
, ncol = 3
, byrow = TRUE
, dimnames = list(NULL, c(Val, Lower, Upper))
)
ym - cbind(ym, x = 1:4)  # add the x-coord
barWidth - .1
# plot the data points
plot(ym[, 'x']
, ym[, 'Val']
, pch = 19
, cex = 2
, ylim = range(ym[, Upper], ym[, Lower])
)
# draw the CI values as segments
# three sets of coords - top bar, bottom bar, connecting line
segments(c(ym[, 'x'] - barWidth, ym[, 'x'] - barWidth, ym[, 'x'])
  , c(ym[, 'Upper'], ym[, 'Lower'], ym[, 'Upper'])
  , c(ym[, 'x'] + barWidth, ym[, 'x'] + barWidth, ym[, 'x'])
  , c(ym[, 'Upper'], ym[, 'Lower'], ym[, 'Lower'])
  )



On Mon, Nov 26, 2012 at 1:31 PM, YAddo link...@gmail.com wrote:
 y=c(1.73,1.30,2.30, 1.83,1.36,2.45,1.46,1.07,2.00,1.58,1.15,2.17)



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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(x,y) help

2012-11-26 Thread Rui Barradas

Hello,

You had a typo in the lines() instruction, the parenthesis didn't close 
after c(y...).
Anyway, I'm not sure I understand but to have horizontal lines, just 
reverse the roles of x and y. (And change pch = _ to pch = |).


plot(y, x, type=n,axes=F, xlab=PR(95% CI),ylab= )

points(y[ptidx],x[ptidx], pch=19,cex=4.5)
points(y[lciidx],x[lciidx], pch=|,cex=4.5)
points(y[uciidx],x[uciidx], pch=|,cex=4.5)
box()

for(i in 1:4){
lines(c(y[lciidx[i]], y[uciidx[i]]),
c(x[lciidx[i]], x[uciidx[i]]), lwd=4,cex=4.5)
}


Hope this helps,

Rui Barradas
Em 26-11-2012 18:31, YAddo escreveu:

Dear All:

I would any appreciate any help with this plot I am struggling with.

I have 4 estimates (95% CIs) I want to plot. I want the CI lines to be
horizontal on each plotted point. I was trying to tweak some old codes  (was
for a vertical CI  lines) into horizontal but not much dice.

Many thanks in advance for your help.

YA


My working codes:

x=c(1,1,1,1.1,1.1,1.1,2,2,2,2.1,2.1,2.1)
y=c(1.73,1.30,2.30, 1.83,1.36,2.45,1.46,1.07,2.00,1.58,1.15,2.17)

ptidx = seq(1,12,by=3)
lciidx = seq(2,12,by=3)
uciidx = seq(3,12,by=3)

plot(x,y, type=n,axes=F, xlab=PR(95% CI),ylab= )

points(x[ptidx],y[ptidx],pch=19,cex=4.5)
points(x[lciidx],y[lciidx],pch=_,cex=4.5)
points(x[uciidx],y[uciidx],pch=_,cex=4.5)
box()

for(i in 1:4)
{
  
lines(c(x[lciidx[i]],x[uciidx[i]]),c(y[lciidx[i]],y[uciidx[i]],lwd=4,cex=4.5))
   
}







--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-x-y-help-tp4650874.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Help in splitting the records

2012-11-26 Thread David L Carlson
Another approach is to use gsub() followed by read.table():

 x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
 x - gsub(\\$+, \\$, x)
 x - read.table(text=x, sep=$, stringsAsFactors=FALSE)
 x
 V1   V2   V3
1  qwer   12 qwre
2 ewrtr 7789 ewwe

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Bert Gunter
 Sent: Monday, November 26, 2012 1:00 PM
 To: Sarah Goslee
 Cc: r-help
 Subject: Re: [R] Help in splitting the records
 
 Sarah:
 
 You may not agree, but the following avoids the IMHO ugly rbind() and
 separate conversion to numeric by using scan():
 
 ## first, as before..
 
 x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
 x - strsplit(x, \\$+)
 
 ## Then, instead ...
 
 x.convert -
 data.frame(scan(textConnection(unlist(x)),wh=list(a,0,a)))
 
 ## You'll need to replace with suitable column names, of course
 
 Cheers,
 Bert
 
 
 On Mon, Nov 26, 2012 at 9:00 AM, Sarah Goslee
 sarah.gos...@gmail.comwrote:
 
  You state that you want $$$ as the separator, but your example has
  $$ and $ so  I'm assuming an indeterminate number of consecutive
  $.
 
  x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
  x - strsplit(x, \\$+)
  x - do.call(rbind, x)
  x - data.frame(x, stringsAsFactors = FALSE)
  x$X2 - as.numeric(x$X2)
 
  I've also made some assumptions about what you want the output to be
  like, since you didn't specify, and broken it into as many steps as
  possible so that you can look at what functions I used and read the
  help files.
 
  Sarah
 
  On Mon, Nov 26, 2012 at 5:51 AM, arunkumar akpbond...@gmail.com
  wrote:
   Hi
  
   I have set of records seperated by a separator say $$$ i want to
 get
  the
   values in a dataframe.
  
   eq
  
   qwer$$12$$qwre
   ewrtr$7789$ewwe
  
   I want the output as\
  
   V1   V2V3
   qwer 12 qwre
   ewrtr  7789 ewwwe
  
  
  
   Please help me
  
  
 
 
  --
  Sarah Goslee
  http://www.functionaldiversity.org
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 --
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 
 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-
 biostatistics/pdb-ncb-home.htm
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] remote connection to an Oracle database - using RODBC - RMySQL..?

2012-11-26 Thread Raffaello Vardavas

Thank you Marc,

I will study the material you sent and follow up on this at R-SIG-DB - should I 
still have problems.

I'm using a Mac OS X 10.6.8

Thanks.
Raff.

 Subject: Re: [R] remote connection to an Oracle database - using RODBC -  
 RMySQL..?
 From: marc_schwa...@me.com
 Date: Wed, 21 Nov 2012 14:16:15 -0600
 CC: r-help@r-project.org
 To: r_varda...@hotmail.com
 
 
 On Nov 21, 2012, at 1:52 PM, Raffaello Vardavas r_varda...@hotmail.com 
 wrote:
 
  
  Dear users,
  
  I can access an database oracle database using sql developer. This was done 
  by importing an xml file that contains the login details - username, 
  password and specifies that it uses the KERBEROS_AUTHENTICATION.
  
  I'm trying to connect R -  so that it can access this database - do sql 
  queries and convert the resulting tables into dataframes. 
  
  I am a novice in SQL and database access - but a friend provided me with 
  the following approach:
  
  
  library(DBI)
  library(RMySQL)
  drvr-dbDriver(MySQL) #Or another driver, say from the RODBC package?
  acon-dbConnect(drvr, user=ENTER_USERID, dbname=ENTER_NAME, 
  host=ENTER_HOST,
 port=1521,password=NULL) #password maybe non-null?
  cmds-dbSendQuery(acon,statement=YOUR SQL QUERY HERE)
  yourdata-fetch(cmds, n=-1) #Collects all rows and columns of data 
  requested query.
  
  I have provided this info changing the relevant info in the dbConnect 
  command and provided the password. However this doesn't work. I suspect 
  because in this command there is not specification of the encryption of the 
  password (i.e., KERBEROS_AUTHENTICATION)
  
  
  When I look at the details of the connection in SQL developer - what is 
  specified is the follow:
  
  connection name, username, password (that I cannot see), hostname, port and 
  the SID.
  
  Note that although the password here cannot be seen - 
  I believe it is computed by the longer password displaced the the xml file 
  I use to set up the connection with sql developer using the 
  KERBEROS_AUTHENTICATION.
  
  Any ideas on how to proceed.
  
  Please help.
  
  Thank you.
  
  Raff.
 
 
 Several comments:
 
 1. Future posts on this subject should be made to R-SIG-DB, not here. More 
 info:
 
   https://stat.ethz.ch/mailman/listinfo/r-sig-db
 
 2. Why would you expect to use an R package and driver for MySQL when 
 attempting to access an Oracle server?
 
 3. There is a good starting point on this subject generally in the R Data 
 Import/Export manual:
 
   
 http://cran.r-project.org/doc/manuals/r-release/R-data.html#Relational-databases
 
 4. I would recommend using RODBC, which is what I use. You will of course 
 need to have an ODBC driver for Oracle installed on your system and properly 
 configured. You may need to get that from Oracle or other parties depending 
 upon your OS which is unstated here. You may also need to get assistance with 
 that process from your SysAdmin or DBAdmin.
 
 5. If you use RODBC, there is additional, quite good information in the 
 package vignette, which is accessible by using:
 
   vignette(RODBC)
 
 post package installation.
 
 6. I don't have any experience using Kerberos authentication on my Oracle 
 server here, so you may have to follow up on the R-SIG-DB list on that point. 
 A search of the archives did not reveal anything material on that point.
 
 7. Alternatives to RODBC would include ROracle and RJDBC via CRAN.
 
 Regards,
 
 Marc Schwartz
 
  
[[alternative HTML version deleted]]

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


Re: [R] Help in splitting the records

2012-11-26 Thread arun
Hi,

Just a modification:
 x1-gsub([$], ,x)
read.table(text=x1,sep=,header=FALSE,stringsAsFactors=FALSE)
  #   V1   V2   V3
#1  qwer   12 qwre
#2 ewrtr 7789 ewwe
A.K.




- Original Message -
From: David L Carlson dcarl...@tamu.edu
To: 'Bert Gunter' gunter.ber...@gene.com; 'Sarah Goslee' 
sarah.gos...@gmail.com
Cc: 'r-help' r-help@r-project.org
Sent: Monday, November 26, 2012 2:33 PM
Subject: Re: [R] Help in splitting the records

Another approach is to use gsub() followed by read.table():

 x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
 x - gsub(\\$+, \\$, x)
 x - read.table(text=x, sep=$, stringsAsFactors=FALSE)
 x
     V1   V2   V3
1  qwer   12 qwre
2 ewrtr 7789 ewwe

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Bert Gunter
 Sent: Monday, November 26, 2012 1:00 PM
 To: Sarah Goslee
 Cc: r-help
 Subject: Re: [R] Help in splitting the records
 
 Sarah:
 
 You may not agree, but the following avoids the IMHO ugly rbind() and
 separate conversion to numeric by using scan():
 
 ## first, as before..
 
 x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
 x - strsplit(x, \\$+)
 
 ## Then, instead ...
 
 x.convert -
 data.frame(scan(textConnection(unlist(x)),wh=list(a,0,a)))
 
 ## You'll need to replace with suitable column names, of course
 
 Cheers,
 Bert
 
 
 On Mon, Nov 26, 2012 at 9:00 AM, Sarah Goslee
 sarah.gos...@gmail.comwrote:
 
  You state that you want $$$ as the separator, but your example has
  $$ and $ so  I'm assuming an indeterminate number of consecutive
  $.
 
  x - c(qwer$$12$$qwre, ewrtr$7789$ewwe)
  x - strsplit(x, \\$+)
  x - do.call(rbind, x)
  x - data.frame(x, stringsAsFactors = FALSE)
  x$X2 - as.numeric(x$X2)
 
  I've also made some assumptions about what you want the output to be
  like, since you didn't specify, and broken it into as many steps as
  possible so that you can look at what functions I used and read the
  help files.
 
  Sarah
 
  On Mon, Nov 26, 2012 at 5:51 AM, arunkumar akpbond...@gmail.com
  wrote:
   Hi
  
   I have set of records seperated by a separator say $$$ i want to
 get
  the
   values in a dataframe.
  
   eq
  
   qwer$$12$$qwre
   ewrtr$7789$ewwe
  
   I want the output as\
  
   V1       V2    V3
   qwer 12 qwre
   ewrtr  7789 ewwwe
  
  
  
   Please help me
  
  
 
 
  --
  Sarah Goslee
  http://www.functionaldiversity.org
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 --
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 
 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-
 biostatistics/pdb-ncb-home.htm
 
     [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] remote connection to an Oracle database - using RODBC - RMySQL..?

2012-11-26 Thread Marc Schwartz

On Nov 26, 2012, at 1:47 PM, Raffaello Vardavas r_varda...@hotmail.com wrote:

 Thank you Marc,
 
 I will study the material you sent and follow up on this at R-SIG-DB - should 
 I still have problems.
 
 I'm using a Mac OS X 10.6.8
 
 Thanks.
 Raff.


In that case, if you use RODBC, you will want to get the Oracle ODBC driver for 
OSX from Actual Technologies, which is also what I use on 10.8.2. More info 
here:

  http://www.actualtech.com/product_oracle.php

Note that it is not free ($34.95 US) and Oracle does not provide OSX ODBC 
drivers. This is covered in the RODBC vignette.

The good news is that it makes it fairly easy to set up the DSN connection to 
Oracle, as you don't have to worry about a lot of the low level configuration 
issues. You can download an eval version of the driver for free. The limitation 
of the free version is that a query will only return the first 3 rows. You 
would then need to pay for a fully functional license.

Regards,

Marc


  Subject: Re: [R] remote connection to an Oracle database - using RODBC -
  RMySQL..?
  From: marc_schwa...@me.com
  Date: Wed, 21 Nov 2012 14:16:15 -0600
  CC: r-help@r-project.org
  To: r_varda...@hotmail.com
  
  
  On Nov 21, 2012, at 1:52 PM, Raffaello Vardavas r_varda...@hotmail.com 
  wrote:
  
   
   Dear users,
   
   I can access an database oracle database using sql developer. This was 
   done by importing an xml file that contains the login details - username, 
   password and specifies that it uses the KERBEROS_AUTHENTICATION.
   
   I'm trying to connect R - so that it can access this database - do sql 
   queries and convert the resulting tables into dataframes. 
   
   I am a novice in SQL and database access - but a friend provided me with 
   the following approach:
   
   
   library(DBI)
   library(RMySQL)
   drvr-dbDriver(MySQL) #Or another driver, say from the RODBC package?
   acon-dbConnect(drvr, user=ENTER_USERID, dbname=ENTER_NAME, 
   host=ENTER_HOST,
   port=1521,password=NULL) #password maybe non-null?
   cmds-dbSendQuery(acon,statement=YOUR SQL QUERY HERE)
   yourdata-fetch(cmds, n=-1) #Collects all rows and columns of data 
   requested query.
   
   I have provided this info changing the relevant info in the dbConnect 
   command and provided the password. However this doesn't work. I suspect 
   because in this command there is not specification of the encryption of 
   the password (i.e., KERBEROS_AUTHENTICATION)
   
   
   When I look at the details of the connection in SQL developer - what is 
   specified is the follow:
   
   connection name, username, password (that I cannot see), hostname, port 
   and the SID.
   
   Note that although the password here cannot be seen - 
   I believe it is computed by the longer password displaced the the xml 
   file I use to set up the connection with sql developer using the 
   KERBEROS_AUTHENTICATION.
   
   Any ideas on how to proceed.
   
   Please help.
   
   Thank you.
   
   Raff.
  
  
  Several comments:
  
  1. Future posts on this subject should be made to R-SIG-DB, not here. More 
  info:
  
  https://stat.ethz.ch/mailman/listinfo/r-sig-db
  
  2. Why would you expect to use an R package and driver for MySQL when 
  attempting to access an Oracle server?
  
  3. There is a good starting point on this subject generally in the R Data 
  Import/Export manual:
  
  http://cran.r-project.org/doc/manuals/r-release/R-data.html#Relational-databases
  
  4. I would recommend using RODBC, which is what I use. You will of course 
  need to have an ODBC driver for Oracle installed on your system and 
  properly configured. You may need to get that from Oracle or other parties 
  depending upon your OS which is unstated here. You may also need to get 
  assistance with that process from your SysAdmin or DBAdmin.
  
  5. If you use RODBC, there is additional, quite good information in the 
  package vignette, which is accessible by using:
  
  vignette(RODBC)
  
  post package installation.
  
  6. I don't have any experience using Kerberos authentication on my Oracle 
  server here, so you may have to follow up on the R-SIG-DB list on that 
  point. A search of the archives did not reveal anything material on that 
  point.
  
  7. Alternatives to RODBC would include ROracle and RJDBC via CRAN.
  
  Regards,
  
  Marc Schwartz
  


[[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] aggregate() runs out of memory

2012-11-26 Thread Sam Steingold
Hi,

 * Steve Lianoglou znvyvatyvfg.ubarl...@tznvy.pbz [2012-11-19 13:30:03 
 -0800]:

 For instance, if you want the min and max of `delay` within each group
 defined by `share.id`, and let's assume `infl` is a data.frame, you
 can do something like so:

 R as.data.table(infl)
 R setkey(infl, share.id)
 R result - infl[, list(min=min(delay), max=max(delay)), by=share.id]

perfect, thanks.
alas, the resulting table does not contain the share.id column.
do I need to add something like id=unique(share.id) to the list?
also, if there is a field in the original table infl which only depends
on share.id, how do I add this unique value to the summary?
it appears that count=unique(country) in list() does what I need, but
it slows down the process.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://openvotingconsortium.org http://jihadwatch.org
http://thereligionofpeace.com http://palestinefacts.org http://dhimmi.com
Why use Windows, when there are Doors?

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

2012-11-26 Thread Andras Farkas
Dear All,
 
I could use a bit of help here, this function is hard to figure out (for me at 
least) I have the following so far:
 
PKindex-data.frame(Subject=c(1),time=c(1,2,3,4,6,10,12),conc=c(32,28,25,22,18,14,11))
Dose-200
Tinf -0.5
 
defun- function(time, y, parms) { 
 dCpdt - -parms[kel] * y[1] 
 list(dCpdt) 
 } 
modfun - function(time,kel, Vd) {  
 out - 
lsoda(((Dose/Tinf)*(1/(kel*Vd)))*(1-exp(-kel*time)),c(0,time),defun,parms=c(kel=kel,Vd=Vd),rtol=1e-3,atol=1e-5)
 
 out[-1,2]
 }
objfun - function(par) {
 out - modfun(PKindex$time, par[1], par[2])
 gift - which( PKindex$conc != 0 )
 sum((PKindex$conc[gift]-out[gift])^2)
 }    
gen-genoud(objfun,nvars=2,max=FALSE,pop.size=30,max.generations=100,wait.generations=100,starting.value=c(0.7,60),BFGS=FALSE,print.level=0,boundary.enforcement=2,Domains=matrix(c(0.01,0.01,100,100),2,2),MemoryMatrix=TRUE)
 
but get the following:
 Error in lsoda(((Dose/Tinf) * (1/(kel * Vd))) * (1 - exp(-kel * time)),  : 
  The number of derivatives returned by func() (1must equal the length of the 
initial conditions vector (7)
 
i figured that having the time parameter in the equation screws things up, 
but do not now how to fix it bc I do not understand the warning message.
 
 
your help is greatly apreciated,
 
Sincerely,
 
Andras
[[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] aggregate() runs out of memory

2012-11-26 Thread Steve Lianoglou
Hi Sam,

On Mon, Nov 26, 2012 at 3:13 PM, Sam Steingold s...@gnu.org wrote:
 Hi,

 * Steve Lianoglou znvyvatyvfg.ubarl...@tznvy.pbz [2012-11-19 13:30:03 
 -0800]:

 For instance, if you want the min and max of `delay` within each group
 defined by `share.id`, and let's assume `infl` is a data.frame, you
 can do something like so:

 R as.data.table(infl)
 R setkey(infl, share.id)
 R result - infl[, list(min=min(delay), max=max(delay)), by=share.id]

 perfect, thanks.
 alas, the resulting table does not contain the share.id column.
 do I need to add something like id=unique(share.id) to the list?
 also, if there is a field in the original table infl which only depends
 on share.id, how do I add this unique value to the summary?
 it appears that count=unique(country) in list() does what I need, but
 it slows down the process.

Hmm ... I think it should be there, but I'm having  a hard time
remember what you want.

Could you please copy paste the output of `dput(head(infl, 20))` as
well as an approximation of what the result is that you want.

It will make it easier for us to talk more concretely about how to get
what you want.

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

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

2012-11-26 Thread R. Michael Weylandt
On Mon, Nov 26, 2012 at 4:46 PM, David Winsemius dwinsem...@comcast.net wrote:

 On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:

 this overcomes the summary generation, but not printing:

 --8---cut here---start-8---
 summary.difftime - function (v, ...) {
  s - summary(as.numeric(v), ...)
  r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
  names(r) - c(string)
  r[[units(v)]] - s
  class(r) - c(data.frame,summary.difftime)

Surely reversed no? summary.difftime inherits from data.frame I would
have assumed.

  r
 }
 print.summary.difftime - function (sd) print.data.frame(sd)

What is this supposed to do exactly? If you have inheritance why have
the subclass method do nothing other than call the parent method?

Michael

 --8---cut here---end---8---

 summary(infl), where infl$delay is a difftime vector, prints

 ...

delay
 string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
 6.98 days)
 secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
 602949.7)



 instead of something like

   delay
   Min.:492 ms
   1st Qu.: 18.08 min

 c

 so, how do I arrange for a proper printing of difftime summary as a part
 of the data frame summary?


 If you like a particular format from an existing print method then why not
 look it up and copy the code?

 methods(print)

 --
 David.


 * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-25 00:50:51 -0800]:

 On Nov 24, 2012, at 7:48 PM, Sam Steingold wrote:

 * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-23 13:14:17
 -0800]:

 See
 http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-should-I-write-summary-methods_003f


 --8---cut here---start-8---
 summary.difftime - function (v) {
 s - summary(as.numeric(v))
 r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
 names(r) - c(string)
 r[[units(v)]] - s
 class(r) - c(data.frame,summary.difftime)
 r
 }
 print.summary.difftime - function (sd) print.data.frame(sd)
 --8---cut here---end---8---

 it appears to work for a single vector:

 --8---cut here---start-8---

 r1 - summary(infl$delay)
 r1

  string secs
 Min.492.00 ms  0.5
 1st Qu. 18.08 min   1085.0
 Median   1.77 hrs   6370.0
 Mean 8.20 hrs  29530.0
 3rd Qu.  8.12 hrs  29250.0
 Max.6.98 days 602900.0

 str(r1)

 Classes 'summary.difftime' and 'data.frame':6 obs. of  2 variables:
 $ string: chr  492.00 ms 18.08 min 1.77 hrs 8.20 hrs ...
 $ secs  :Classes 'summaryDefault', 'table'  num [1:6] 4.92e-01
 1.08e+03 6.37e+03 2.95e+04 2.92e+04 ...
 --8---cut here---end---8---

 but not as a part of data frame:

 --8---cut here---start-8---

 a - summary(infl)

 Error in summary.difftime(X[[22L]], ...) :
 unused argument(s) (maxsum = 7, digits = 12)
 --8---cut here---end---8---

 I guess I should somehow accept a list of options in
 summary.difftime()
 and pass them on to the inner call to summary() (or should it be
 explicitly summary.numeric()?)


 In the usual way. If you know that the function will be called with
 arguments from the summary.data.frame function then you should allow the
 argument list to accept them. You can ignore them or provide provisions
 for them. You just can't define your function to have only one argument
 if you expect (as you should since you passes summary a dataframe
 object) that it might be called within summary.data.frame.

 This is the argument list for summary.data.frame:

  summary.data.frame

 function (object, maxsum = 7, digits = max(3, getOption(digits) -
3), ...)

 how do I do that?


 summary.difftime - function (v, ... ) { 

 There are many asked and answered questions on rhelp about how to deal
 with the dots arguments.


 --
 Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X
 11.0.11103000
 http://www.childpsy.net/ http://www.memritv.org http://memri.org
 http://honestreporting.com http://dhimmi.com
 http://openvotingconsortium.org
 People with a good taste are especially appreciated by cannibals.


 David Winsemius, MD
 Alameda, CA, USA


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

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

2012-11-26 Thread R. Michael Weylandt
On Mon, Nov 26, 2012 at 10:38 AM,  alanaro...@sapo.pt wrote:
 Goodmorning,
 I'moneafazrtrbhoquhasa variablefactorcomtwoNivesCandH.Queoaatravésdlinear
 regressionrelationshipetrehaSaerifthe
 variablespthiedoseogmerparawanttheHtothatanddouCrespctinteRaficthat showsthe
 two curvesHandCLIRand
 Selecionar tudo
 Thank you
 Ana C. Rocha Rua


I think this might be offered as a very good example of why one
shouldn't send HTMangLed mail in lieu of plain text.

Michael

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 in plot(table(c('a','a')))

2012-11-26 Thread R. Michael Weylandt
On Mon, Nov 26, 2012 at 2:41 PM, Ludo Pagie l.pa...@nki.nl wrote:
 Hi all,

 there appears to be something strange with the plotting of tables of 1
 dimension; if I attempt to make a plot of a table of characters with only
 1 value I get an error (Error in xy.coords(x, y, xlabel, ylabel, log) :
   'x' and 'y' lengths differ). With more than one value I don't get
 errors, neither with integers (even if only 1 value):

 tbl.char1 - table(c('a','a'))
 tbl.char2 - table(c('a','a','b'))
 tbl.int1 - table(c(1,1))

 # error:
 plot(tbl.char1)

 # no errors:
 plot(tbl.char2)
 plot(tbl.int1)


Confirmed in current R-devel. It seems to arise from plot.table's use
of seq.int(x) when the dimnames of the table are not integers. I'm not
sure if this shouldn't be seq_along(x) instead, but I'm not sure I
totally follow the internal logic, so perhaps someone can offer second
opinion?

Michael

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] aggregate() runs out of memory

2012-11-26 Thread Sam Steingold
hi Steve,

 * Steve Lianoglou znvyvatyvfg.ubarl...@tznvy.pbz [2012-11-26 16:08:59 
 -0500]:
 On Mon, Nov 26, 2012 at 3:13 PM, Sam Steingold s...@gnu.org wrote:
 * Steve Lianoglou znvyvatyvfg.ubarl...@tznvy.pbz [2012-11-19 13:30:03 
 -0800]:

 For instance, if you want the min and max of `delay` within each group
 defined by `share.id`, and let's assume `infl` is a data.frame, you
 can do something like so:

 R as.data.table(infl)
 R setkey(infl, share.id)
 R result - infl[, list(min=min(delay), max=max(delay)), by=share.id]

 perfect, thanks.
 alas, the resulting table does not contain the share.id column.
 do I need to add something like id=unique(share.id) to the list?
 also, if there is a field in the original table infl which only depends
 on share.id, how do I add this unique value to the summary?
 it appears that count=unique(country) in list() does what I need, but
 it slows down the process.

 Hmm ... I think it should be there, but I'm having  a hard time
 remember what you want.

 Could you please copy paste the output of `(head(infl, 20))` as
 well as an approximation of what the result is that you want.

this prints all the levels for all the factor columns and takes
megabytes.

--8---cut here---start-8---
 f - data.frame(id=rep(1:3,4),country=rep(6:8,4),delay=1:12)
 f
   id country delay
1   1   6 1
2   2   7 2
3   3   8 3
4   1   6 4
5   2   7 5
6   3   8 6
7   1   6 7
8   2   7 8
9   3   8 9
10  1   610
11  2   711
12  3   812
 f - as.data.table(f)
 setkey(f,id)
 delays - 
 f[,list(min=min(delay),max=max(delay),count=.N,country=unique(country)),by=id]
 delays
   id min max count country
1:  1   1  10 4   6
2:  2   2  11 4   7
3:  3   3  12 4   8
--8---cut here---end---8---

this is still too slow, apparently because of unique.
how do I speed it up?

Thanks.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://iris.org.il
http://ffii.org http://pmw.org.il http://mideasttruth.com
Programming is like sex: one mistake and you have to support it for a lifetime.

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

2012-11-26 Thread Sam Steingold
 * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-26 08:46:35 -0800]:

 On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:

 summary(infl), where infl$delay is a difftime vector, prints

 ...

delay
 string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
 6.98 days)
 secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
 602949.7)



 instead of something like

   delay
   Min.:492 ms
   1st Qu.: 18.08 min

 c

 so, how do I arrange for a proper printing of difftime summary as a
 part
 of the data frame summary?

 If you like a particular format from an existing print method then why
 not look it up and copy the code?

 methods(print)

the problem is that I cannot figure out which function prints this:

delay
 string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
 6.98 days)
 secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
 602949.7)

I added cat()s to print.summary.difftime and I do not see them, so it
appears that I have no direct control over how a summary.difftime is
printed as a part of a summary of a data.frame.


--8---cut here---start-8---
summary.difftime - function (v, ...) {
  s - summary(as.numeric(v), ...)
  r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
  names(r) - c(string)
  r[[units(v)]] - s
  class(r) - c(summary.difftime,data.frame)
  invisible(r)
}
print.summary.difftime - function (sd, ...) {
  cat([[[print.summary.difftime]]]\n)
  print(list(...))
  print.data.frame(sd, ...)
}
--8---cut here---end---8---

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://palestinefacts.org http://think-israel.org
http://www.memritv.org http://openvotingconsortium.org http://mideasttruth.com
The force of gravity doubles when acting on a body on a couch.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] aggregate() runs out of memory

2012-11-26 Thread Steve Lianoglou
Hi,

On Mon, Nov 26, 2012 at 4:57 PM, Sam Steingold s...@gnu.org wrote:
[snip]
 Could you please copy paste the output of `(head(infl, 20))` as
 well as an approximation of what the result is that you want.

Don't know how dput got clipped in your reply from the quoted text I
wrote, but I actually asked for `dput(head(infl, 20))`

The dput makes a world of difference because I can easily copy/paste
the output into R and get a working table.

 this prints all the levels for all the factor columns and takes
 megabytes.

Try using droplevels, eg:

R dput(droplevels(head(infl, 20)))


 --8---cut here---start-8---
 f - data.frame(id=rep(1:3,4),country=rep(6:8,4),delay=1:12)
 f
id country delay
 1   1   6 1
 2   2   7 2
 3   3   8 3
 4   1   6 4
 5   2   7 5
 6   3   8 6
 7   1   6 7
 8   2   7 8
 9   3   8 9
 10  1   610
 11  2   711
 12  3   812
 f - as.data.table(f)
 setkey(f,id)
 delays - 
 f[,list(min=min(delay),max=max(delay),count=.N,country=unique(country)),by=id]
 delays
id min max count country
 1:  1   1  10 4   6
 2:  2   2  11 4   7
 3:  3   3  12 4   8
 --8---cut here---end---8---

 this is still too slow, apparently because of unique.
 how do I speed it up?

I think I'm missing something.

Your call to `min(delay)` and `max(delay)` will return the minimum and
maximum delays within the particular id you are grouping by. I guess
there must be several values for country within each id group --
do you really want the same min and max values to be replicated as
many times as there are unique countrys?

Do you perhaps want to iterate over a combo of id and country?

Anyway: if you don't use `unique` inside your calculation, I guess it
goes significantly faster, like so:

R result - f[, list(min=min(delay), max=max(delay),
count=.N,country=country[1L]), by=share.id]

If that's bearable, and you really want the way you suggest (or, at
least, what I'm interpreting), I wonder if this two-step would be
faster?

R setkeyv(f, c('share.id', 'country'))
R r1 - f[, list(min=min(delay), max=max(delay), count=.N), by='share.id']
R result - unique(f)[r1]  ## I think

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] aggregate() runs out of memory

2012-11-26 Thread Sam Steingold
Hi,

 * Steve Lianoglou znvyvatyvfg.ubarl...@tznvy.pbz [2012-11-26 17:32:21 
 -0500]:

 --8---cut here---start-8---
 f - data.frame(id=rep(1:3,4),country=rep(6:8,4),delay=1:12)
 f
id country delay
 1   1   6 1
 2   2   7 2
 3   3   8 3
 4   1   6 4
 5   2   7 5
 6   3   8 6
 7   1   6 7
 8   2   7 8
 9   3   8 9
 10  1   610
 11  2   711
 12  3   812
 f - as.data.table(f)
 setkey(f,id)
 delays - 
 f[,list(min=min(delay),max=max(delay),count=.N,country=unique(country)),by=id]
 delays
id min max count country
 1:  1   1  10 4   6
 2:  2   2  11 4   7
 3:  3   3  12 4   8
 --8---cut here---end---8---

 this is still too slow, apparently because of unique.
 how do I speed it up?

 I think I'm missing something.

 Your call to `min(delay)` and `max(delay)` will return the minimum and
 maximum delays within the particular id you are grouping by. I guess
 there must be several values for country within each id group --
 do you really want the same min and max values to be replicated as
 many times as there are unique countrys?

there is precisely one country for each id.
i.e., unique(country) is the same as country[1].
thanks a lot for the suggestion!

 R result - f[, list(min=min(delay), max=max(delay),
 count=.N,country=country[1L]), by=share.id]

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://thereligionofpeace.com http://pmw.org.il
http://honestreporting.com http://americancensorship.org
Why do you never call me back after I scream that I will never talk to you 
again?!

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

2012-11-26 Thread William Dunlap
It looks like summary.data.frame(d) calls format(d[[i]]) for i in 
seq_len(ncol(d))
and pastes the results together into a table object for printing.  Hence, 
write
a format.summary.difftime if you want objects of class summary.difftime (which
I assume summary.difftime produces) to be formatted as you wish when a
difftime object is in a data.frame.  Once you've written it, have your 
print.summary.difftime
call it too.

E.g., with the following methods
summary.difftime - function(x, ...) {
 ret - quantile(x, p=(0:2)/2, na.rm=TRUE)
 class(ret) - c(summary.difftime, class(ret))
 ret
}
format.summary.difftime - function(x, ...) c(Min.Med.Max = 
paste(collapse=..., NextMethod(format)))
print.summary.difftime - function(x, ...){ print(format(x), quote=FALSE) ; 
invisible(x) }

I get
 d - data.frame(Num=1:5, Date=as.Date(2012-11-26)+(0:4), 
 Delta=diff(as.Date(2012-11-26)+2^(0:5)))
 summary(d)
  Num DateDelta
 Min.   :1   Min.   :2012-11-26   Min.Med.Max: 1 days... 4 days...16 days
 1st Qu.:2   1st Qu.:2012-11-27
 Median :3   Median :2012-11-28
 Mean   :3   Mean   :2012-11-28
 3rd Qu.:4   3rd Qu.:2012-11-29
 Max.   :5   Max.   :2012-11-30
 summary(d$Delta)
Min.Med.Max
 1 days... 4 days...16 days

My summary.difftime inherits from difftime so the format method is not really
needed, as format.difftime does a reasonable job (except that it does not copy
the input names to its output).  I put it in to show how it gets called.


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Sam Steingold
 Sent: Monday, November 26, 2012 2:20 PM
 To: r-help@r-project.org; David Winsemius
 Subject: Re: [R] printing difftime summary
 
  * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-26 08:46:35 -0800]:
 
  On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:
 
  summary(infl), where infl$delay is a difftime vector, prints
 
  ...
 
 delay
  string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
  6.98 days)
  secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
  602949.7)
 
 
 
  instead of something like
 
delay
Min.:492 ms
1st Qu.: 18.08 min
 
  c
 
  so, how do I arrange for a proper printing of difftime summary as a
  part
  of the data frame summary?
 
  If you like a particular format from an existing print method then why
  not look it up and copy the code?
 
  methods(print)
 
 the problem is that I cannot figure out which function prints this:
 
 delay
  string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
  6.98 days)
  secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
  602949.7)
 
 I added cat()s to print.summary.difftime and I do not see them, so it
 appears that I have no direct control over how a summary.difftime is
 printed as a part of a summary of a data.frame.
 
 
 --8---cut here---start-8---
 summary.difftime - function (v, ...) {
   s - summary(as.numeric(v), ...)
   r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
   names(r) - c(string)
   r[[units(v)]] - s
   class(r) - c(summary.difftime,data.frame)
   invisible(r)
 }
 print.summary.difftime - function (sd, ...) {
   cat([[[print.summary.difftime]]]\n)
   print(list(...))
   print.data.frame(sd, ...)
 }
 --8---cut here---end---8---
 
 --
 Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 
 11.0.11103000
 http://www.childpsy.net/ http://palestinefacts.org http://think-israel.org
 http://www.memritv.org http://openvotingconsortium.org http://mideasttruth.com
 The force of gravity doubles when acting on a body on a couch.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] error in plot(table(c('a','a')))

2012-11-26 Thread Rui Barradas

Hello,

Also gives an error in R 2.15.2 on Windows 7. I'd change when the 
dimnames of the table are not integers  to not numeric as that's what 
the code for plot.table tests. And it seems to come from seq.int, since 
with table value of 2, seq.int produces a vector of length 2 but the 
table length is 1:


 seq.int(tbl.char1)
[1] 1 2
 seq_along(tbl.char1)
[1] 1


So the plot command will have 2 values for the x axis but just one for 
the y axis.

seq_along seems to solve the matter.

Hope this helps,

Rui Barradas
Em 26-11-2012 21:39, R. Michael Weylandt escreveu:

On Mon, Nov 26, 2012 at 2:41 PM, Ludo Pagie l.pa...@nki.nl wrote:

Hi all,

there appears to be something strange with the plotting of tables of 1
dimension; if I attempt to make a plot of a table of characters with only
1 value I get an error (Error in xy.coords(x, y, xlabel, ylabel, log) :
   'x' and 'y' lengths differ). With more than one value I don't get
errors, neither with integers (even if only 1 value):

tbl.char1 - table(c('a','a'))
tbl.char2 - table(c('a','a','b'))
tbl.int1 - table(c(1,1))

# error:
plot(tbl.char1)

# no errors:
plot(tbl.char2)
plot(tbl.int1)


Confirmed in current R-devel. It seems to arise from plot.table's use
of seq.int(x) when the dimnames of the table are not integers. I'm not
sure if this shouldn't be seq_along(x) instead, but I'm not sure I
totally follow the internal logic, so perhaps someone can offer second
opinion?

Michael

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

2012-11-26 Thread Sam Steingold
Thanks a lot - almost there!

--8---cut here---start-8---
format.summary.difftime - function(sd, ...) {
  t - matrix(sd$string)
  rownames(t) - rownames(sd)
  print(t)
  format(as.table(t))
}
print.summary.difftime - function (sd, ...) {
  print(format(sd), quote=FALSE)
  invisible(sd)
}
--8---cut here---end---8---

this almost works:

--8---cut here---start-8---
 summary(delays)
 share.id min  max   
 12cf12372b87cce9:  1   NULL:492.00 ms   NULL:492.00 ms  
 12cf36060bdb9581:  1   NULL:3.70 minNULL:21.80 min  
 12d2665c906bb232:  1   NULL:20.32 min   NULL:3.26 hrs   
 12d2802f1435b4cd:  1   NULL:5.52 hrsNULL:13.78 hrs  
 12d292988f5f8422:  1   NULL:2.81 hrsNULL:16.20 hrs  
 12d29dd2894e2790:  1   NULL:6.95 days   NULL:6.98 days  
--8---cut here---end---8---

why do I see NULLs?!

--8---cut here---start-8---
 t - matrix(sd$string)
 rownames(t) - rownames(sd)
 t
[,1]   
Min.492.00 ms
1st Qu. 3.70 min 
Median  20.32 min
Mean5.52 hrs 
3rd Qu. 2.81 hrs 
Max.6.95 days
 as.table(t)
A
Min.492.00 ms
1st Qu. 3.70 min 
Median  20.32 min
Mean5.52 hrs 
3rd Qu. 2.81 hrs 
Max.6.95 days
 format(as.table(t))
A  
Min.492.00 ms
1st Qu. 3.70 min 
Median  20.32 min
Mean5.52 hrs 
3rd Qu. 2.81 hrs 
Max.6.95 days
 --8---cut here---end---8---


 * William Dunlap jqha...@gvopb.pbz [2012-11-26 23:02:48 +]:

 It looks like summary.data.frame(d) calls format(d[[i]]) for i in 
 seq_len(ncol(d))
 and pastes the results together into a table object for printing.  Hence, 
 write
 a format.summary.difftime if you want objects of class summary.difftime 
 (which
 I assume summary.difftime produces) to be formatted as you wish when a
 difftime object is in a data.frame.  Once you've written it, have your 
 print.summary.difftime
 call it too.

 E.g., with the following methods
 summary.difftime - function(x, ...) {
  ret - quantile(x, p=(0:2)/2, na.rm=TRUE)
  class(ret) - c(summary.difftime, class(ret))
  ret
 }
 format.summary.difftime - function(x, ...) c(Min.Med.Max =
 paste(collapse=..., NextMethod(format)))
 print.summary.difftime - function(x, ...){ print(format(x), quote=FALSE) ; 
 invisible(x) }

 I get
 d - data.frame(Num=1:5, Date=as.Date(2012-11-26)+(0:4),
 Delta=diff(as.Date(2012-11-26)+2^(0:5)))
 summary(d)
   Num DateDelta
  Min.   :1   Min.   :2012-11-26   Min.Med.Max: 1 days... 4 days...16 days
  1st Qu.:2   1st Qu.:2012-11-27
  Median :3   Median :2012-11-28
  Mean   :3   Mean   :2012-11-28
  3rd Qu.:4   3rd Qu.:2012-11-29
  Max.   :5   Max.   :2012-11-30
 summary(d$Delta)
 Min.Med.Max
  1 days... 4 days...16 days

 My summary.difftime inherits from difftime so the format method is not really
 needed, as format.difftime does a reasonable job (except that it does not copy
 the input names to its output).  I put it in to show how it gets called.


 Bill Dunlap
 Spotfire, TIBCO Software
 wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Sam Steingold
 Sent: Monday, November 26, 2012 2:20 PM
 To: r-help@r-project.org; David Winsemius
 Subject: Re: [R] printing difftime summary
 
  * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-26 08:46:35 -0800]:
 
  On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:
 
  summary(infl), where infl$delay is a difftime vector, prints
 
  ...
 
 delay
  string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
  6.98 days)
  secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
  602949.7)
 
 
 
  instead of something like
 
delay
Min.:492 ms
1st Qu.: 18.08 min
 
  c
 
  so, how do I arrange for a proper printing of difftime summary as a
  part
  of the data frame summary?
 
  If you like a particular format from an existing print method then why
  not look it up and copy the code?
 
  methods(print)
 
 the problem is that I cannot figure out which function prints this:
 
 delay
  string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
  6.98 days)
  secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
  602949.7)
 
 I added cat()s to print.summary.difftime and I do not see them, so it
 appears that I have no direct control over how a summary.difftime is
 printed as a part of a summary of a data.frame.
 
 
 --8---cut here---start-8---
 summary.difftime - function (v, ...) {
   s - summary(as.numeric(v), ...)
   r - as.data.frame(sapply(s,difftime2string),stringsAsFactors=FALSE)
   names(r) - c(string)
   r[[units(v)]] - s
   class(r) - c(summary.difftime,data.frame)
   invisible(r)
 }
 

Re: [R] Adding a new variable to each element of a list

2012-11-26 Thread Stephen Politzer-Ahles
Thanks, Arun! This pretty much does what I was looking for. Looks like I
should get more familiar with the apply functions, it seems like they can
solve a lot of these problems!

Best,
Steve

On Sun, Nov 25, 2012 at 8:09 PM, arun smartpink...@yahoo.com wrote:

 HI Steve,

 You could try this:
 ylist-lapply(y,function(x) x)
  res-lapply(mapply(c,result,Thing=ylist,SIMPLIFY=FALSE),function(x)
 do.call(cbind,x))
  res
 #$`Error: subject`
  # Df Sum Sq Mean Sq F value Pr(F) Thing
 #Residuals  4   12.4 3.1  NA NA   0.5

 #$`Error: subject:myfactor`
  # Df   Sum Sq  Mean Sq  F value  Pr(F) Thing
 #myfactor   2 14.9 7.47 13.57576 0.002682772 0.7724138
 #Residuals  8  4.4 0.55   NA  NA 0.7724138

 #But, it removes the *, which BTW gets removed by individually inserting
 as you showed.

 A.K.







 
 From: Stephen Politzer-Ahles politzerahl...@gmail.com
 To: arun smartpink...@yahoo.com
 Cc: R help r-help@r-project.org
 Sent: Sunday, November 25, 2012 8:35 PM
 Subject: Re: [R] Adding a new variable to each element of a list


 Hi Arun,

 Thanks a lot for the help. I think I didn't make my request clear, though;
 sorry about that. What your example does is applies the values of y to each
 element in the list result. However, what I'm actually trying to do is
 apply the nth element of y to the nth element of result. In other words,
 I'm trying to find a way in one command to do the equivalent of the
 following:

 result[[1]][[1]]$Thing - y[1]
 result[[2]][[1]]$Thing - y[2]
 ...etc.

 Is this even possible? (Granted, for my purpose result is not a very
 long list, so it would not be difficult to just do those commands one at a
 time or in a for loop. At this point I'm just curious to figure out a more
 straightforward way to do it just for the sake of trying to learn more
 about how R works!)

 If it helps put things into context, in my example the list result is a
 summary of an aov object, and each element in the list is one of the ANOVA
 effects; y is a vector of the partial eta squareds I calculated
 corresponding to each effect, and I'm trying to figure out a way to add
 those into the result object so it shows up when my colleague looks at
 the summary.

 Best,
 Steve


 On Sat, Nov 24, 2012 at 5:22 PM, arun smartpink...@yahoo.com wrote:

 HI,
 
 The example data you gave have only one row for the 1st element of list.
 So, it would be better to add it as:
  lapply(result,function(x) {x[[2]]-y
  return(x)})
 #$`Error: subject`
 #Component 1 :
  # Df Sum Sq Mean Sq F value Pr(F)
 #Residuals  4   12.4 3.1
 #
 #Component 2 :
 #[1] 0.500 0.7724138
 -
 You can also do:
  lapply(result,function(x) {x[[1]][6]-y[1]
  x[[1]][7]-y[2]
  return(x)})
 #$`Error: subject`
  # Df Sum Sq Mean Sq F value Pr(F)  V6 V7
 #Residuals  4   12.4 3.10.5 0.7724
 
 #$`Error: subject:myfactor`
  # Df Sum Sq Mean Sq F value   Pr(F)  V6 V7
 #myfactor   2  14.93   7.467   13.58 0.002683 0.5 0.7724
 #Residuals  8   4.40   0.550  0.5 0.7724#Here it got
 repeated
 
 May be there are better methods
 
 A.K.
 
 
 
 
 
 
 - Original Message -
 From: Stephen Politzer-Ahles politzerahl...@gmail.com
 To: r-help@r-project.org
 Cc:
 Sent: Saturday, November 24, 2012 5:33 PM
 Subject: [R] Adding a new variable to each element of a list
 
 Hello,
 
 I have a list of data with multiple elements, and each element in the list
 has multiple variables in it. Here's an example:
 
 ### Make the fake data
 dv - c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6)
 subject - factor(c(s1,s1,s1,s2,s2,s2,s3,s3,s3,
 s4,s4,s4,s5,s5,s5))
 myfactor - factor(c(f1,f2,f3,f1,f2,f3,f1,f2,f3,
 f1,f2,f3,f1,f2,f3))
 mydata - data.frame(dv, subject, myfactor)
 
 ### Do the anova and store the summary in result
 mydata.aov - aov( dv ~ myfactor + Error(subject/myfactor), mydata )
 ( result - summary( mydata.aov ) ) # see the anova
 
 str(result)
 
 List of 2
 $ Error: subject :List of 1
   ..$ :Classes ‘anova’ and 'data.frame':1 obs. of  5 variables:
   .. ..$ Df : num 4
   .. ..$ Sum Sq : num 12.4
   .. ..$ Mean Sq: num 3.1
   .. ..$ F value: num NA
   .. ..$ Pr(F) : num NA
   ..- attr(*, class)= chr [1:2] summary.aov listof
 $ Error: subject:myfactor:List of 1
   ..$ :Classes ‘anova’ and 'data.frame':2 obs. of  5 variables:
   .. ..$ Df : num [1:2] 2 8
   .. ..$ Sum Sq : num [1:2] 14.9 4.4
   .. ..$ Mean Sq: num [1:2] 7.47 0.55
   .. ..$ F value: num [1:2] 13.6 NA
   .. ..$ Pr(F) : num [1:2] 0.00268 NA
   ..- attr(*, class)= chr [1:2] summary.aov listof
 
 As you can see, each element in result has several variables (Df, Sum
 Sq,
 Mean Sq, F value, Pr(F)):
 str( result[[2]][[1]] )
 Classes ‘anova’ and 'data.frame':   2 obs. of  5 variables:
 $ Df : num  2 8
 $ Sum Sq : num  14.9 4.4
 $ Mean Sq: num  7.47 0.55
 $ F value: num  13.6 NA
 $ 

Re: [R] printing difftime summary

2012-11-26 Thread William Dunlap
 why do I see NULLs?!

because

  ... format.difftime does a reasonable job (except that it does not copy
  the input names to its output).

Replace your call of the form
  format(difftimeObject)
with
  structure(format(difftimeObject), names=names(difftimeObject))
to work around this.


Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: Sam Steingold [mailto:sam.steing...@gmail.com] On Behalf Of Sam 
 Steingold
 Sent: Monday, November 26, 2012 4:09 PM
 To: William Dunlap
 Cc: r-help@r-project.org; David Winsemius
 Subject: Re: [R] printing difftime summary
 
 Thanks a lot - almost there!
 
 --8---cut here---start-8---
 format.summary.difftime - function(sd, ...) {
   t - matrix(sd$string)
   rownames(t) - rownames(sd)
   print(t)
   format(as.table(t))
 }
 print.summary.difftime - function (sd, ...) {
   print(format(sd), quote=FALSE)
   invisible(sd)
 }
 --8---cut here---end---8---
 
 this almost works:
 
 --8---cut here---start-8---
  summary(delays)
  share.id min  max
  12cf12372b87cce9:  1   NULL:492.00 ms   NULL:492.00 ms
  12cf36060bdb9581:  1   NULL:3.70 minNULL:21.80 min
  12d2665c906bb232:  1   NULL:20.32 min   NULL:3.26 hrs
  12d2802f1435b4cd:  1   NULL:5.52 hrsNULL:13.78 hrs
  12d292988f5f8422:  1   NULL:2.81 hrsNULL:16.20 hrs
  12d29dd2894e2790:  1   NULL:6.95 days   NULL:6.98 days
 --8---cut here---end---8---
 
 why do I see NULLs?!
 
 --8---cut here---start-8---
  t - matrix(sd$string)
  rownames(t) - rownames(sd)
  t
 [,1]
 Min.492.00 ms
 1st Qu. 3.70 min
 Median  20.32 min
 Mean5.52 hrs
 3rd Qu. 2.81 hrs
 Max.6.95 days
  as.table(t)
 A
 Min.492.00 ms
 1st Qu. 3.70 min
 Median  20.32 min
 Mean5.52 hrs
 3rd Qu. 2.81 hrs
 Max.6.95 days
  format(as.table(t))
 A
 Min.492.00 ms
 1st Qu. 3.70 min 
 Median  20.32 min
 Mean5.52 hrs 
 3rd Qu. 2.81 hrs 
 Max.6.95 days
  --8---cut here---end---8---
 
 
  * William Dunlap jqha...@gvopb.pbz [2012-11-26 23:02:48 +]:
 
  It looks like summary.data.frame(d) calls format(d[[i]]) for i in 
  seq_len(ncol(d))
  and pastes the results together into a table object for printing.  Hence, 
  write
  a format.summary.difftime if you want objects of class summary.difftime 
  (which
  I assume summary.difftime produces) to be formatted as you wish when a
  difftime object is in a data.frame.  Once you've written it, have your
 print.summary.difftime
  call it too.
 
  E.g., with the following methods
  summary.difftime - function(x, ...) {
   ret - quantile(x, p=(0:2)/2, na.rm=TRUE)
   class(ret) - c(summary.difftime, class(ret))
   ret
  }
  format.summary.difftime - function(x, ...) c(Min.Med.Max =
  paste(collapse=..., NextMethod(format)))
  print.summary.difftime - function(x, ...){ print(format(x), quote=FALSE) ; 
  invisible(x) }
 
  I get
  d - data.frame(Num=1:5, Date=as.Date(2012-11-26)+(0:4),
  Delta=diff(as.Date(2012-11-26)+2^(0:5)))
  summary(d)
Num DateDelta
   Min.   :1   Min.   :2012-11-26   Min.Med.Max: 1 days... 4 days...16 days
   1st Qu.:2   1st Qu.:2012-11-27
   Median :3   Median :2012-11-28
   Mean   :3   Mean   :2012-11-28
   3rd Qu.:4   3rd Qu.:2012-11-29
   Max.   :5   Max.   :2012-11-30
  summary(d$Delta)
  Min.Med.Max
   1 days... 4 days...16 days
 
  My summary.difftime inherits from difftime so the format method is not 
  really
  needed, as format.difftime does a reasonable job (except that it does not 
  copy
  the input names to its output).  I put it in to show how it gets called.
 
 
  Bill Dunlap
  Spotfire, TIBCO Software
  wdunlap tibco.com
 
 
  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf
  Of Sam Steingold
  Sent: Monday, November 26, 2012 2:20 PM
  To: r-help@r-project.org; David Winsemius
  Subject: Re: [R] printing difftime summary
 
   * David Winsemius qjvafrz...@pbzpnfg.arg [2012-11-26 08:46:35 -0800]:
  
   On Nov 26, 2012, at 7:14 AM, Sam Steingold wrote:
  
   summary(infl), where infl$delay is a difftime vector, prints
  
   ...
  
  delay
   string:c(492.00 ms, 18.08 min, 1.77 hrs, 8.20 hrs, 8.13 hrs,
   6.98 days)
   secs  :c( 0.5,   1085.1,   6370.2,  29534.4,  29254.0,
   602949.7)
  
  
  
   instead of something like
  
 delay
 Min.:492 ms
 1st Qu.: 18.08 min
  
   c
  
   so, how do I arrange for a proper printing of difftime summary as a
   part
   of the data frame summary?
  
   If you like a particular format from an existing print method then why
   not look it up and copy the code?
  
   methods(print)
 
  the problem is that I cannot figure out which 

Re: [R] aggregate() runs out of memory

2012-11-26 Thread Steve Lianoglou
On Monday, November 26, 2012, Sam Steingold wrote:
[snip]


 there is precisely one country for each id.
 i.e., unique(country) is the same as country[1].
 thanks a lot for the suggestion!

  R result - f[, list(min=min(delay), max=max(delay),
  count=.N,country=country[1L]), by=share.id]


And is it performant?

It just occurred to me that this is even better:

R setkeyv(f, c(share.id, delay))
R result - f[,  list(min=delay[1L], max=delay[.N], count=.N,
country=country[1L]), by=share.id]



 --
 Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X
 11.0.11103000
 http://www.childpsy.net/ http://thereligionofpeace.com http://pmw.org.il
 http://honestreporting.com http://americancensorship.org
 Why do you never call me back after I scream that I will never talk to you
 again?!



-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

[[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] Psych package: fa.diagram, how to re-arrange layout so numbers do not over-write each other

2012-11-26 Thread Brent Caldwell
Dear R help
I have conducted a fa() analysis,  and  I want to use fa.diagram to assess the 
extent to which the 11 latent factors predict the 37 items in a psychological 
battery.  However, the display on the screen has very large font size for the 
coefficients of the relationship between the 11 factors and the 37 items, so 
the numbers overlap and are therefore illegible.  When I output this to a pdf 
the problem is exacerbated even further (see attachments).  I tried to use 
cex=0.8 and cex=0.4 in the pdf argument but it made no difference - what can I 
do?
The code I used is:
fa.diagram(fa.11factors.rawdata)
# Start PDF device driver to save output to fa_diagram.pdf
pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram.pdf, height=10, width=5)
fa.diagram(fa.11factors.rawdata)
#box() # Create box around plot
dev.off() # Turn off device driver (to flush output to PDF)

pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram_cex.pdf, height=8, width=5)
fa.diagram(fa.11factors.rawdata,cex=0.8)
#box() # Create box around plot
dev.off() # Turn off device driver (to flush output to PDF)
Thank you so much for your time
Yours sincerely
Brent Caldwell



fa_diagram_cex.pdf
Description: fa_diagram_cex.pdf


fa_diagram.pdf
Description: fa_diagram.pdf
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Psych package: fa.diagram, how to re-arrange layout so numbers do not over-write each other

2012-11-26 Thread Brent Caldwell
Dear Bill
Wow!  Thank you so much for your rapid reply - you are such a kind person, 
thank you!
I'll try fa.rgraph - thanks
Thanks
Best wishes
Brent

-Original Message-
From: William R Revelle [mailto:reve...@northwestern.edu] 
Sent: Tuesday, 27 November 2012 5:54 p.m.
To: Brent Caldwell
Cc: r-help@R-project.org
Subject: Re: [R] Psych package: fa.diagram, how to re-arrange layout so numbers 
do not over-write each other

Brent,
  No, cex doesn't work (as you have discovered).  That is a bug.
I will work on it.

In the meantime, try Rgraphviz called from fa.rgaph or use the output from 
fa.graph which produces a dot file for processing with any graphic package 
(including graphviz) which handles the dot language.

 

Bill

On Nov 26, 2012, at 10:08 PM, Brent Caldwell brent.caldw...@otago.ac.nz wrote:

 Dear R help
 I have conducted a fa() analysis,  and  I want to use fa.diagram to assess 
 the extent to which the 11 latent factors predict the 37 items in a 
 psychological battery.  However, the display on the screen has very large 
 font size for the coefficients of the relationship between the 11 factors and 
 the 37 items, so the numbers overlap and are therefore illegible.  When I 
 output this to a pdf the problem is exacerbated even further (see 
 attachments).  I tried to use cex=0.8 and cex=0.4 in the pdf argument but it 
 made no difference - what can I do?
 The code I used is:
 fa.diagram(fa.11factors.rawdata)
 # Start PDF device driver to save output to fa_diagram.pdf 
 pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram.pdf, height=10, width=5)
   fa.diagram(fa.11factors.rawdata)
   #box() # Create box around plot
   dev.off() # Turn off device driver (to flush output to PDF)
 
 pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram_cex.pdf, height=8, 
 width=5)
   fa.diagram(fa.11factors.rawdata,cex=0.8)
   #box() # Create box around plot
   dev.off() # Turn off device driver (to flush output to PDF) Thank you 
 so much for your time Yours sincerely Brent Caldwell
 
 fa_diagram_cex.pdffa_diagram.pdf__
 
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

William Revellehttp://personality-project.org/revelle.html
Professor  http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern Universityhttp://www.northwestern.edu/
Use R for psychology http://personality-project.org/r
It is 5 minutes to midnighthttp://www.thebulletin.org

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


Re: [R] Problem with glm, gaussian family with log-link

2012-11-26 Thread ilai
On Mon, Nov 26, 2012 at 5:33 AM, Florian Weiler fweile...@jhubc.it wrote:

 Dear all,

 I am using the book Generalized Linera Models and Extension by Hardin and
 Hilbe (second edition, 2007) at the moment. The authors suggest that
 instead of OLS models, the log link is generally used for response data
 that take only positive values on the continuous scale.


snip

 specifying *family=gaussian(link=log) *I
 am asked to provide starting values. When I set them all equal to zero, I
 always get the message that the algorithm did not converge. Picking other
 values the message is sometimes the same, but more often I get:
 *
 *
 *Error in glm.fit(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  :
 *
 *  NA/NaN/Inf in 'x' *
 *
 *
 As I said, in STATA I can run these models without setting starting values
 and without errors. I tried many different models, and different datasets,


And yet you've failed to provide even one of them together with your code
as a reproducible example ...

# This works without starting values:
set.seed(2341)
x - rep(1:10,3) ; y - jitter(rpois(30,5+x))
plot(x,y)
(gausslog - glm(y~x,family=gaussian(link='log')))
exp(coef(gausslog))

# This works only with starting values
set.seed(2341)
x - rep(1:10,3) ; y - jitter(rpois(30,x))
plot(x,y) ; summary(y)  # yes,yes, some y 0, just trying to reproduce the
error...
(gausslog - glm(y~x,family=gaussian(link='log')))
(gausslog - glm(y~x,family=gaussian(link='log'),start=c(0,0)))

# also
set.seed(2341)
x - rep(1:10,3) ; y - rnorm(30,0+0.1*x)
plot(x,y) ; summary(y)
(gausslog - glm(y~x,family=gaussian(link='log'),start=c(0,0)))

So really this is a non issue without the offending data set and code.

but the problem is always the same (unless I only include one single
 independent variable).


Oh, more information... way to build up the suspense

set.seed(2341)
x - rep(1:10,3) ; xx - rep(seq(20,50,l=5),6) ; y - rnorm(30,5+3*x-2*xx)
(gausslog - glm(y~x+xx,family=gaussian(link='log'),start=c(0,0,0)))

No joy. Still fits.


 Could anyone tell me why this is the case, or what I
 do wrong,


No


 or why the suggested models from the book might not be
 appropriate? I'd appreciate any help!

 Personally I don't care for reproducing some results from STATA and have
no comment on the validity of the above but maybe someone in the list would
have a better answer if you repost.





 Best,
 Florian


Also this:

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] Factor function for coded numerical values

2012-11-26 Thread maths123
The question says that there is an experiement to investigate the effect on
breathing rate when doing different types of exercise with wearing more
clothes or less clothes (factor A, coded 1,2). 
The duration of exercise was 10min, 20min, 30min (factor B, coded 1,2,3).

Could you give m anymore help? I tried using your R code but I couldn't get
it to run.



--
View this message in context: 
http://r.789695.n4.nabble.com/Factor-function-for-coded-numerical-values-tp4650483p4650883.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] creation of an high frequency series

2012-11-26 Thread billycorg
Thank you Paul,

It works.

Now I will study for repeating the same code for different days.

Regards,
Vincent 





--
View this message in context: 
http://r.789695.n4.nabble.com/creation-of-an-high-frequency-series-tp4650850p4650898.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] merging two specific rows in a DF

2012-11-26 Thread arun
HI,
Just a modification of Rui's solution:
x1-within(x,TYPE-as.character(TYPE))
group-cumsum(c(TRUE,x1$TYPE[-1]!=x1$TYPE[-length(x1$TYPE)]))

 res-as.data.frame(do.call(rbind,lapply(split(x1,group),function(x) 
c(C1=min(x[,1]),C2=max(x[,2]),TYPE=x[,3][1]))),stringsAsFactors=FALSE)
res[,-3]-sapply(res[,-3],as.numeric)
res
#   C1  C2 TYPE
#1  10  20    A
#2  33  44    B
#3  66  80    A
#4 111 220    B
#5 300 449    A
#6 455 500    B
#7 510 520    A
#8 540 580    B
A.K. 




- Original Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: karthicklakshman karthick.laksh...@gmail.com
Cc: r-help@r-project.org
Sent: Monday, November 26, 2012 12:37 PM
Subject: Re: [R] merging two specific rows in a DF

Hello,

Try the following.


x - read.table(text=
C1 C2 TYPE
10 20 A
33 44 B
66 80 A
111 140 B
144 220 B
300 340 A
380 449 A
455 500 B
510 520 A
540 580 B
, header = TRUE)
x


fun - function(x){
     mn - which.min(x$C1)
     mx - which.max(x$C2)
     c(C1 = x$C1[mn], C2 = x$C2[mx], TYPE = x$TYPE[1])
}

idx - seq_len(nrow(x))[-1]
idx2 - cumsum(c(FALSE, x$TYPE[idx - 1] != x$TYPE[idx]))
y - do.call(rbind, lapply(split(x, idx2), fun))
rownames(y) - seq_len(nrow(y))
y


Hope this helps,

Rui Barradas
Em 26-11-2012 10:24, karthicklakshman escreveu:
 Hello members,

 I have this data frame with 3 columns,
 C1    C2    TYPE
 10    20    A
 33    44    B
 66    80    A
 111    140    B
 144    220    B
 300    340    A
 380    449    A
 455    500    B
 510    520    A
 540    580    B

 Here,  the rows 4 , 5 has type B and similarly 6,7 has A . I need to
 merge these rows in a way to get the output with unique type, something like
 below, where the lowest value from DF$C1 and  highest value from DF$C2
 corresponding to rows 4,5 are picked.

 C1    C2    TYPE
 10    20    A
 33    44    B
 66    80    A
 111    220    B
 300    449    A
 455    500    B
 510    520    A
 540    580    B

 I Request your kind help..
 Regards,
 karthick




 --
 View this message in context: 
 http://r.789695.n4.nabble.com/merging-two-specific-rows-in-a-DF-tp4650826.html
 Sent from the R help mailing list archive at Nabble.com.

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

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


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 strange behaviour when building huge concatenation

2012-11-26 Thread angeloimm
Any idea on the reason why the instruction 
p1x-c(2, 1, 0, 0, 0, 7, 1, 0, 2, 0, 5, 0, 0, 0, 0, 0, 10, 1, 3, 0, 2, 0, 0,
0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 12, 0, 0,
1, 0, 0, 0, 0, 0, 0, 2, 1, 0, 1, 0, 4, 0, 1, 0, 0, 0, 2, 0, 0, 3, 0, 0, 1,
0, 1, 0, 0, 0, 3, 0, 0, 1, 0, 0, 0, 7, 0, 10, 0, 0, 1, 6, 0, 0, 0, 0, 0, 2,
4, 1, 5, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0,
0, 1, 0, 0, 0, 4, 3, 0, 1, 2, 0, 1, 2, 0, 2, 1, 1, 0, 5, 2, 7, 2, 0, 4, 13,
0, 4, 4, 0, 0, 1, 0, 1, 29, 0, 3, 0, 0, 1, 0, 10, 0, 0, 13, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 6, 8, 0, 0, 0, 1, 0, 4, 0, 2, 3, 3, 0, 0, 0, 0, 0, 6, 0, 1,
0, 0, 2, 0, 2, 2, 0, 0, 1, 0, 1, 0, 0, 7, 0, 0, 0, 2, 0, 4, 0, 1, 1, 0, 0,
0, 0, 0, 2, 0, 1, 1, 2, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 5, 0, 0, 2,
0, 1, 2, 0, 0, 1, 0, 1, 0, 5, 0, 0, 1, 2, 0, 1, 0, 0, 1, 2, 1, 0, 1, 0, 1,
0, 3, 1, 13, 0, 0, 0, 0, 0, 3, 3, 1, 0, 0, 3, 0, 5, 0, 2, 1, 0, 1, 0, 0, 1,
1, 0, 0, 0, 3, 1, 1, 0, 1, 0, 0, 0, 4, 0, 2, 0, 3, 0, 0, 1, 0, 1, 0, 2, 0,
1, 3, 25, 0, 0, 0, 0, 5, 0, 2, 0, 0, 0, 5, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0,
1, 0, 2, 1, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 2, 4, 0, 0, 1, 3, 0, 1, 0, 0,
0, 0, 0, 1, 1, 1, 0, 0, 0, 11, 0, 0, 4, 0, 0, 1, 2, 0, 0, 0, 0, 1, 1, 0, 3,
1, 0, 0, 2, 0, 8, 1, 0, 2, 1, 0, 0, 1, 0, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2,
2, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 2, 4, 0, 0, 2, 0, 6, 0,
1, 0, 1, 1, 1, 2, 1, 0, 7, 4, 0, 0, 0, 7, 0, 1, 1, 0, 2, 1, 0, 4, 0, 1, 0,
0, 2, 0, 0, 4, 0, 0, 2, 1, 0, 1, 0, 11, 0, 4, 0, 0, 0, 4, 0, 3, 0, 1, 1, 0,
0, 6, 3, 0, 0, 0, 0, 2, 0, 2, 0, 18, 0, 1, 0, 1, 0, 0, 0, 5, 0, 1, 0, 6, 0,
2, 0, 0, 2, 0, 1, 1, 0, 0, 1, 0, 1, 2, 0, 0, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0,
1, 10, 0, 1, 3, 3, 0, 2, 0, 0, 12, 0, 1, 2, 2, 0, 0, 0, 0, 5, 0, 0, 2, 0, 5,
0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 7, 0, 0, 2, 0,
0, 2, 0, 4, 0, 0, 3, 0, 1, 0, 2, 2, 0, 1, 1, 2, 0, 0, 0, 0, 2, 0, 0, 1, 0,
1, 0, 3, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0,
2, 1, 1, 0, 0, 0, 0, 5, 1, 0, 0, 1, 2, 1, 0, 0, 0, 0, 1, 0, 8, 1, 0, 6, 1,
2, 0, 3, 6, 0, 1, 0, 2, 5, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 13, 0, 0, 1, 3,
0, 5, 0, 2, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 4, 6, 1, 2, 0, 0, 2, 0, 7, 0, 0,
0, 0, 0, 3, 0, 5, 0, 2, 1, 3, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2, 0, 1,
0, 0, 1, 10, 0, 0, 0, 0, 3, 3, 0, 0, 2, 5, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 1, 1, 3, 1, 0, 0, 0, 0, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 0, 1, 0,
2, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 1, 13, 7, 0, 0, 3, 0, 1, 0, 1, 1,
2, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 2, 1, 0, 0, 1, 19, 2, 2, 0, 2, 2, 0,
0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 7, 0, 0, 0, 0, 0,
1, 0, 0, 1, 1, 0, 0, 2, 0, 1, 1, 0, 0, 4, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 5,
1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 7, 2, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0,
0, 0, 0, 0, 0, 1, 0, 4, 0, 1, 1, 0, 1, 0, 1, 2, 0, 1, 0, 0, 0, 2, 0, 4, 0,
1, 7, 1, 0, 1, 0, 0, 4, 0, 1, 0, 0, 0, 0, 1, 0, 7, 1, 0, 6, 0, 5, 0, 2, 0,
1, 0, 6, 0, 2, 0, 0, 0, 2, 2, 0, 0, 6, 0, 0, 1, 0, 1, 0, 0, 0, 2, 0, 0, 0,
0, 1, 4, 0, 0, 1, 0, 1, 0, 0, 1, 0, 5, 2, 0, 0, 0, 3, 0, 12, 1, 0, 0, 2, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 1, 0, 0, 3, 0, 1, 0, 1, 0,
0, 0, 0, 4, 0, 0, 2, 0, 5, 0, 3, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
0, 0, 2, 3, 0, 0, 0, 0, 11, 0, 0, 2, 0, 1, 0, 7, 0, 0, 1, 0, 3, 0, 2, 0, 1,
0, 4, 2, 2, 1, 0, 0, 0, 0, 0, 1, 3, 0, 0, 1, 1, 6, 0, 0, 4, 0, 0, 1, 0, 2,
0, 1, 3, 7, 2, 0, 5, 0, 0, 0, 0, 5, 0, 12, 1, 0, 1, 0, 1, 0, 0, 0, 0, 3, 0,
0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 4, 0, 1, 0, 1, 0, 3,
0, 0, 0, 0, 0, 1, 0, 0, 3, 0, 3, 4, 1, 0, 2, 1, 2, 1, 0, 0, 2, 1, 0, 0, 0,
1, 7, 0, 6, 0, 6, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 3, 0, 0, 3, 0, 3, 0, 8, 0, 1, 0, 0, 2, 0, 0, 11, 0, 1, 8, 0, 1,
0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 3, 1, 0, 1, 6, 0, 2, 1, 1, 0, 1, 1, 0, 3, 2,
0, 0, 0, 2, 1, 1, 0, 0, 0, 0, 3, 2, 0, 3, 0, 0, 1, 4, 0, 6, 0, 1, 1, 4, 0,
2, 0, 4, 0, 0, 0, 0, 2, 0, 1, 0, 1, 2, 0, 0, 1, 0, 0, 2, 1, 0, 0, 3, 0, 0,
0, 0, 0, 0, 1, 1, 3, 2, 0, 0, 0, 1, 0, 0, 0, 4, 0, 1, 3, 0, 0, 0, 0, 0, 0,
3, 1, 0, 1, 1, 2, 0, 2, 0, 0, 0, 3, 0, 1, 0, 1, 0, 9, 0, 0, 4, 0, 2, 0, 5,
0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 0, 0, 0, 4, 1, 0, 0, 1, 5, 0, 0, 0, 1, 0,
1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 3, 0, 0, 2, 0, 14, 4, 0, 0, 0, 0, 0, 0, 2, 0,
0, 2, 0, 3, 0, 2, 0, 0, 1, 1, 6, 1, 6, 0, 1, 2, 0, 0, 2, 1, 0, 2, 1, 0, 1,
0, 2, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0, 1, 0, 0, 5, 0, 2, 0, 1, 0,
5, 0, 1, 2, 0, 2, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 3, 0, 4,
0, 1, 0, 0, 3, 1, 0, 2, 0, 2, 1, 0, 0, 0, 4, 0, 0, 0, 26, 1, 6, 0, 0, 1, 0,
0, 0, 2, 0, 0, 0, 2, 0, 0, 1, 2, 0, 1, 0, 0, 0, 14, 0, 1, 0, 2, 4, 0, 1, 6,
0, 0, 1, 3, 1, 0, 0, 0, 0, 1, 1, 0, 8, 0, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 3,
0, 1, 1, 1, 1, 0, 1, 9, 0, 0, 3, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 0, 4,
1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 1, 1, 0, 3, 2, 0, 2, 5, 0, 1, 0, 0, 1, 1, 0,
0, 0, 0, 1, 0, 5, 1, 0, 1, 0, 4, 0, 0, 0, 0, 0, 4, 3, 0, 

[R] A problem subsetting a data frame

2012-11-26 Thread Aki Hoji
Hi all, 

I have this microarray large microarray data set (ALL)  from which I would like 
to subset or extract  a set of data based on a factor ($mol.biol).I looked 
up some example of subsetting in, picked up two commands  and tried both  but I 
got error messages as follows

 testset - subset(ALL, ALL$mol.biol %in% c(BCR/ABL,ALL1/AF4)) 

 Error in c(BCR/ABL, ALL1/AF4) : unused argument(s) (ALL1/AF4)


 testset - ALL[ALL$mol.biol %in% c(BCR/ABL,NEG), ] 
 Error in ALL[ALL$mol.biol %in% c(BCR/ABL, NEG), ] : 
 
   error in evaluating the argument 'i' in selecting a method for function 
 '[': Error in c(BCR/ABL, NEG) : unused argument(s) (NEG)

At this point, I really appreciate any inputs to move forward. ….

  str(ALL)
 Formal class 'ExpressionSet' [package Biobase] with 7 slots
   ..@ experimentData   :Formal class 'MIAME' [package Biobase] with 13 slots
   .. .. ..@ name : chr Chiaretti et al.
   .. .. ..@ lab  : chr Department of Medical Oncology, 
 Dana-Farber Cancer Institute, Department of Medicine, Brigham and Women's 
 Hospital, Harvard Med| __truncated__
   .. .. ..@ contact  : chr 
   .. .. ..@ title: chr Gene expression profile of adult T-cell 
 acute lymphocytic leukemia identifies distinct subsets of patients with 
 different respo| __truncated__
   .. .. ..@ abstract : chr Gene expression profiles were examined in 
 33 adult patients with T-cell acute lymphocytic leukemia (T-ALL). Nonspecific 
 filteri| __truncated__
   .. .. ..@ url  : chr 
   .. .. ..@ pubMedIds: chr [1:2] 14684422 16243790
   .. .. ..@ samples  : list()
   .. .. ..@ hybridizations   : list()
   .. .. ..@ normControls : list()
   .. .. ..@ preprocessing: list()
   .. .. ..@ other: list()
   .. .. ..@ .__classVersion__:Formal class 'Versions' [package Biobase] 
 with 1 slots
   .. .. .. .. ..@ .Data:List of 1
   .. .. .. .. .. ..$ : int [1:3] 1 0 0
   ..@ assayData:environment: 0x1078636e8 
   ..@ phenoData:Formal class 'AnnotatedDataFrame' [package Biobase] 
 with 4 slots
   .. .. ..@ varMetadata  :'data.frame':   21 obs. of  1 variable:
   .. .. .. ..$ labelDescription: chr [1:21]  Patient ID  Date of 
 diagnosis  Gender of the patient  Age of the patient at entry ...
   .. .. ..@ data :'data.frame':   128 obs. of  21 variables:
   .. .. .. ..$ cod   : chr [1:128] 1005 1010 3002 4006 ...
   .. .. .. ..$ diagnosis : chr [1:128] 5/21/1997 3/29/2000 
 6/24/1998 7/17/1997 ...
   .. .. .. ..$ sex   : Factor w/ 2 levels F,M: 2 2 1 2 2 2 1 2 2 
 2 ...
   .. .. .. ..$ age   : int [1:128] 53 19 52 38 57 17 18 16 15 40 ...
   .. .. .. ..$ BT: Factor w/ 10 levels B,B1,B2,..: 3 3 5 2 
 3 2 2 2 3 3 ...
   .. .. .. ..$ remission : Factor w/ 2 levels CR,REF: 1 1 1 1 1 1 1 1 
 1 1 ...
   .. .. .. ..$ CR: chr [1:128] CR CR CR CR ...
   .. .. .. ..$ date.cr   : chr [1:128] 8/6/1997 6/27/2000 8/17/1998 
 9/8/1997 ...
   .. .. .. ..$ t(4;11)   : logi [1:128] FALSE FALSE NA TRUE FALSE FALSE 
 ...
   .. .. .. ..$ t(9;22)   : logi [1:128] TRUE FALSE NA FALSE FALSE FALSE 
 ...
   .. .. .. ..$ cyto.normal   : logi [1:128] FALSE FALSE NA FALSE FALSE FALSE 
 ...
   .. .. .. ..$ citog : chr [1:128] t(9;22) simple alt. NA 
 t(4;11) ...
   .. .. .. ..$ mol.biol  : Factor w/ 6 levels ALL1/AF4,BCR/ABL,..: 2 
 4 2 1 4 4 4 4 4 2 ...
   .. .. .. ..$ fusion protein: Factor w/ 3 levels p190,p190/p210,..: 3 NA 
 1 NA NA NA NA NA NA 1 ...
   .. .. .. ..$ mdr   : Factor w/ 2 levels NEG,POS: 1 2 1 1 1 1 2 
 1 1 1 ...
   .. .. .. ..$ kinet : Factor w/ 2 levels dyploid,hyperd.: 1 1 1 
 1 1 2 2 1 1 NA ...
   .. .. .. ..$ ccr   : logi [1:128] FALSE FALSE FALSE FALSE FALSE 
 FALSE ...
   .. .. .. ..$ relapse   : logi [1:128] FALSE TRUE TRUE TRUE TRUE TRUE ...
   .. .. .. ..$ transplant: logi [1:128] TRUE FALSE FALSE FALSE FALSE 
 FALSE ...
   .. .. .. ..$ f.u   : chr [1:128] BMT / DEATH IN CR REL REL 
 REL ...
   .. .. .. ..$ date last seen: chr [1:128] NA 8/28/2000 10/15/1999 
 1/23/1998 ...
   .. .. ..@ dimLabels: chr [1:2] sampleNames sampleColumns
   .. .. ..@ .__classVersion__:Formal class 'Versions' [package Biobase] 
 with 1 slots
   .. .. .. .. ..@ .Data:List of 1
   .. .. .. .. .. ..$ : int [1:3] 1 1 0
   ..@ featureData  :Formal class 'AnnotatedDataFrame' [package Biobase] 
 with 4 slots
   .. .. ..@ varMetadata  :'data.frame':   0 obs. of  1 variable:
   .. .. .. ..$ labelDescription: logi(0) 
   .. .. ..@ data :'data.frame':   12625 obs. of  0 variables
   .. .. ..@ dimLabels: chr [1:2] featureNames featureColumns
   .. .. ..@ .__classVersion__:Formal class 'Versions' [package Biobase] 
 with 1 slots
   .. .. .. .. ..@ .Data:List of 1
   .. .. .. .. .. ..$ : int [1:3] 1 1 0
   ..@ annotation   : chr hgu95av2
   ..@ protocolData :Formal class 

[R] Help with graphics in gamm4 library

2012-11-26 Thread MurphFL
My problem is relatively straight forward, but I cannot seem to find a way to
make it work. 

I have a RCBD with repeated measurements over time. I have created a fit
using the gamm4 package. My model is: 

fit4a - gamm4(Rate ~ s(Time,by=trt,bs=cr)+trt,data=qual.11.dat, 
  random=~(1|block),correlation=corARH1()) 

What I would like to create is plots with the X-axis being time, the Y-axis
being the fitted Rates for each individual treatment with the smoothed
curves overlayed on the plot. 

Every idea I have had to do this has resulted in some errors, and I have
reached my wits end. Can anyone steer me in the right direction?



--
View this message in context: 
http://r.789695.n4.nabble.com/Help-with-graphics-in-gamm4-library-tp4650908.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] Plot(x,y) help

2012-11-26 Thread YAddo
Thanks Jim and Rui.



--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-x-y-help-tp4650874p4650906.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] Problem with cbind() and arguments

2012-11-26 Thread parlor9
Yeah, I meant 3 instead of 5.
This was just an example, it's not what Im really doing.
I am using a 'arules' package for data mining, and I have to pass and
'arg[]' element and use it as the new column name of a data.frame. 

It's a bit complicated, so I used this example, and I would like to use
'args[1]' as 'c', in a new column name using cbind..



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-cbind-and-arguments-tp4650808p4650912.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] Problem with cbind() and arguments

2012-11-26 Thread parlor9
In this case, instead of naming the column 'c', it names it 'args[1]' as a
string, not a variable.



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-cbind-and-arguments-tp4650808p4650913.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] glm convergence warning

2012-11-26 Thread Anne Schaefer
Hello,

When I run the following glm model:

modelresult=glm(CID~WS+SS+DV+DS, data=kimu, family=binomial)

I get the following warning messages:

1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred

What I am trying to do is model my response variable (CID: correct bird
identification) as a function of the predictor variables weather state
(WS), sea state (SS), distance from the vessel (DV) and duration of the
sighting (DS). I defined both sea state and weather state as factors with
three levels (0, 1, or 2). Distance of the vessel values are 100, 80, 60,
40, and 20. Duration of the sighting ranges from 0 to 58 seconds.

The output R is giving me is:

Deviance Residuals:
   Min  1Q  Median  3Q Max
-3.562e-05  -2.100e-08   2.100e-08   2.100e-08   3.632e-05

Coefficients:
  Estimate Std. Error z value Pr(|z|)
(Intercept) -2.000e+02  1.067e+06   0.0001.000
WSf1 7.744e+01  9.086e+04   0.0010.999
WSf2 1.285e+01  6.199e+04   0.0001.000
SSf1-1.042e+02  1.683e+05  -0.0011.000
SSf2-1.859e+02  1.432e+05  -0.0010.999
DV   6.770e-01  9.394e+03   0.0001.000
DS   9.822e+00  1.884e+04   0.0011.000


What do the warning messages mean? Can I still use coefficient estimates
and standard error values?

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] Class Not found execption

2012-11-26 Thread sheenmaria
I am trying to call a r file named es.r which have lotes of R functions. 
These R functions are internally calling java functions by using .jnew()
and .jcall(). I have added 
necessary jar's to the Classpath and I am able to run es.r from command
prompt . 


 But when I tried to call it from anoter r file using source()
getting Exception 
Error in .jnew(com/algoTree/ClientElasticSearch/ElasticSearchLoader) : 
 java.lang.ClassNotFoundException 

How can I solve this ? 
How can i execute the file from r-console. ? 

Anybody can help me.. 
Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/Class-Not-found-execption-tp4650916.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] Psych package: fa.diagram, how to re-arrange layout so numbers do not over-write each other

2012-11-26 Thread William R Revelle
Brent,
  No, cex doesn't work (as you have discovered).  That is a bug.
I will work on it.

In the meantime, try Rgraphviz called from fa.rgaph or
use the output from fa.graph which produces a dot file for processing with any 
graphic package (including graphviz) which handles the dot language.

 

Bill

On Nov 26, 2012, at 10:08 PM, Brent Caldwell brent.caldw...@otago.ac.nz wrote:

 Dear R help
 I have conducted a fa() analysis,  and  I want to use fa.diagram to assess 
 the extent to which the 11 latent factors predict the 37 items in a 
 psychological battery.  However, the display on the screen has very large 
 font size for the coefficients of the relationship between the 11 factors and 
 the 37 items, so the numbers overlap and are therefore illegible.  When I 
 output this to a pdf the problem is exacerbated even further (see 
 attachments).  I tried to use cex=0.8 and cex=0.4 in the pdf argument but it 
 made no difference - what can I do?
 The code I used is:
 fa.diagram(fa.11factors.rawdata)
 # Start PDF device driver to save output to fa_diagram.pdf
 pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram.pdf, height=10, width=5)
   fa.diagram(fa.11factors.rawdata)
   #box() # Create box around plot
   dev.off() # Turn off device driver (to flush output to PDF)
 
 pdf(file=I:\\ZAPi\\Tables-of-R-output\\fa_diagram_cex.pdf, height=8, 
 width=5)
   fa.diagram(fa.11factors.rawdata,cex=0.8)
   #box() # Create box around plot
   dev.off() # Turn off device driver (to flush output to PDF)
 Thank you so much for your time
 Yours sincerely
 Brent Caldwell
 
 fa_diagram_cex.pdffa_diagram.pdf__
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

William Revellehttp://personality-project.org/revelle.html
Professor  http://personality-project.org
Department of Psychology   http://www.wcas.northwestern.edu/psych/
Northwestern Universityhttp://www.northwestern.edu/
Use R for psychology http://personality-project.org/r
It is 5 minutes to midnighthttp://www.thebulletin.org

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


  1   2   >