Re: [R] convert real valued matrix to binary matrix

2014-01-10 Thread Jim Lemon

On 01/10/2014 06:56 AM, email wrote:

Hi:

I am trying to analyze an yeast gene expression data

http://arep.med.harvard.edu/biclustering/yeast.matrix

I need to convert the real-valued data matrix to a binary (0,1)
matrix. Is there any package available? How can it be done?


Hi John,
It looks like you have been told to perform dichotomous clustering on 
the yeast data from Tavazoie et al. 1999. You should probably look more 
closely at the cutoff expression level you are to use and think about 
creating a new matrix of logical (0,1) values using a logical condition. 
This may be as much help as you will get on the list for this sort of 
request.


Jim

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


Re: [R] locate pattern in matrix

2014-01-10 Thread Koushik Saha
you can find it by use of indexing with setting 1=T and 0=False in your
global environment of R.


On Fri, Jan 10, 2014 at 12:32 PM, email email8...@gmail.com wrote:

 Dear all,

 I have a binary matrix

 0 0 0 0 0
 1 1 1 0 0
 1 1 1 0 0
 0 0 0 0 0
 0 0 0 1 1
 0 0 0 1 1

 I want to find the location of all the square and rectangular 1 blocks,
 like

 First block in row=2, col=1 to row=3, col=3.
 Second block in row=5, col=4, to row=6, col=5.

 How can I find such blocks of 1?

 Thanks:
 John

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] using lapply to get function values

2014-01-10 Thread David Winsemius


On Jan 10, 2014, at 2:04 AM, Long Vo wrote:


Hi R users,
I need to apply a function on a list of vectors. This is simple when  
I use

functions that returns only one numerical value such as 'mean' or
'variance'. Things get complex when I use functions returning a list  
of

value, such as 'acf'.
In the following example I first create a list of vectors with equal  
length
10.  Then I try to get the first order autocorrelation coefficient  
of each

vector using lapply:

#
library(stats)
X=rnorm(1:100)
Y=split(X,as.numeric(gl(length(X),10,length(X# to divide X into 10
sub-vectors
app=lapply(Y,FUN=acf,lag.max=1,plot=F)
app
#

I need to know how to display other values of the function e.g.  
'type',

'lag' not just 'acf'. Because using

app=lapply(Y,FUN=acf$type,lag.max=1,plot=F)




acf$type is not a function. The $ function is a wrapper for [[ so  
try:


lapply(app, [[, 'type')

To do it in one step, try:

lapply(Y, function(x) acf(x)$type)

--
David.


prompts the error object of type 'closure' is not subsettable


Note that this is only an illustrative example. The function I am  
studying
is not 'acf', but it also return a list of values and I need to call  
out

specific values.

Helps and comments are welcome.

Long



--
View this message in context: 
http://r.789695.n4.nabble.com/using-lapply-to-get-function-values-tp4683373.html
Sent from the R help mailing list archive at Nabble.com.

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


David Winsemius, MD
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] barchar and box on the same figure! is it possible

2014-01-10 Thread Adel ESSAFI
Hello list

I have this data frame which represent values grouped by algorithm.
remark that for each algorithm, we have the same value in V3 but differnt
values in V4.
I want to make a plot with algorithms in axes, and for each algorithm I
draw a bar (for V3) and a bwplot for V4.
is thart possible.
Thanks for any entry.



 t[t[,2]3,]
  V1 V2   V3   V4
1HEFT-AC  1 402499.9 460543.4
2HEFT-AC  2 402499.9 470316.8
31  HEFT-ACU  1 420814.2 433203.7
32  HEFT-ACU  2 420814.2 453475.8
60   LPT  1 402499.9 460543.4
61   LPT  2 402499.9 470316.8
90   SPT  1 453262.3 459070.3
91   SPT  2 453262.3 483893.6
119  MIN-MIN  1 447286.4 477632.5
120  MIN-MIN  2 447286.4 488146.3
149  MAX-MIN  1 457122.6 498265.2
150  MAX-MIN  2 457122.6 491143.3



-- 


*PhD in Computer ScienceAddress   *



*Avenue Taha Hussein Montfleury, 1008 Tunistél : +216 71 49 60 66 fax: +216
71 39 11 66*

[[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] Fwd: barchar and box on the same figure! is it possible

2014-01-10 Thread Adel ESSAFI
Hello list

I have this data frame which represent values grouped by algorithm.
remark that for each algorithm, we have the same value in V3 but differnt
values in V4.
I want to make a plot with algorithms in axes, and for each algorithm I
draw a bar (for V3) and a bwplot for V4.
is thart possible.
Thanks for any entry.



 t[t[,2]3,]
  V1 V2   V3   V4
1HEFT-AC  1 402499.9 460543.4
2HEFT-AC  2 402499.9 470316.8
31  HEFT-ACU  1 420814.2 433203.7
32  HEFT-ACU  2 420814.2 453475.8
60   LPT  1 402499.9 460543.4
61   LPT  2 402499.9 470316.8
90   SPT  1 453262.3 459070.3
91   SPT  2 453262.3 483893.6
119  MIN-MIN  1 447286.4 477632.5
120  MIN-MIN  2 447286.4 488146.3
149  MAX-MIN  1 457122.6 498265.2
150  MAX-MIN  2 457122.6 491143.3



-- 


*PhD in Computer ScienceAddress   *



*Avenue Taha Hussein Montfleury, 1008 Tunis tél : +216 71 49 60 66
%2B216%2071%2049%2060%2066 fax: +216 71 39 11 66
%2B216%2071%2039%2011%2066*



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[alternative HTML version deleted]]

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


[R] How to determine the order of a time series object

2014-01-10 Thread Charles Thuo
I have monthly claims data from 2009 to end of 2013 and would like to
forecast for  2014. How is this done in R.

Charles.

[[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] Fwd: barchar and box on the same figure! is it possible

2014-01-10 Thread Jim Lemon

On 01/10/2014 09:46 PM, Adel ESSAFI wrote:

Hello list

I have this data frame which represent values grouped by algorithm.
remark that for each algorithm, we have the same value in V3 but differnt
values in V4.
I want to make a plot with algorithms in axes, and for each algorithm I
draw a bar (for V3) and a bwplot for V4.
is thart possible.
Thanks for any entry.




t[t[,2]3,]

   V1 V2   V3   V4
1HEFT-AC  1 402499.9 460543.4
2HEFT-AC  2 402499.9 470316.8
31  HEFT-ACU  1 420814.2 433203.7
32  HEFT-ACU  2 420814.2 453475.8
60   LPT  1 402499.9 460543.4
61   LPT  2 402499.9 470316.8
90   SPT  1 453262.3 459070.3
91   SPT  2 453262.3 483893.6
119  MIN-MIN  1 447286.4 477632.5
120  MIN-MIN  2 447286.4 488146.3
149  MAX-MIN  1 457122.6 498265.2
150  MAX-MIN  2 457122.6 491143.3


Hi Adel,
Try this. I have used barp in plotrix as your algorithm labels need 
staggering.


aedf-read.table(text=V1 V2   V3   V4
 HEFT-AC  1 402499.9 460543.4
 HEFT-AC  2 402499.9 470316.8
 HEFT-ACU  1 420814.2 433203.7
 HEFT-ACU  2 420814.2 453475.8
 LPT  1 402499.9 460543.4
 LPT  2 402499.9 470316.8
 SPT  1 453262.3 459070.3
 SPT  2 453262.3 483893.6
 MIN-MIN  1 447286.4 477632.5
 MIN-MIN  2 447286.4 488146.3
 MAX-MIN  1 457122.6 498265.2
 MAX-MIN  2 457122.6 491143.3,
 header=TRUE)
library(plotrix)
barp(aedf$V3[!duplicated(aedf$V1)],ylim=c(0,60),
 names.arg=unique(aedf$V1),staxx=TRUE)
boxat-1
for(alg in unique(aedf$V1)) {
 boxplot(aedf$V4[aedf$V1==alg],range=0,at=boxat,add=TRUE)
 boxat-boxat+1
}

Jim

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

2014-01-10 Thread thomasfoxley
Dear list, 

I'm using MuMIn for model averaging and I had a question about the
z-test that MuMIn performs when using the summary call. e.g.:

 model.1 - subset(model.sel(model.1.glmm.list, rank = AICc), delta3)
 summary(model.avg(model.1))
 
 ...
 
 Model-averaged coefficients: 
   Estimate Std. Error Adjusted SE z value Pr(|z|)
 0|1   0.094832   0.3586490.360952   0.263 0.792760
 1|2   1.193099   0.3667610.369124   3.232 0.001228 ** 
 age   1.163131   0.4167350.419355   2.774 0.005544 ** 
 distribution  0.063250   0.3210250.323071   0.196 0.844784
 left  0.158854   0.2478160.249294   0.637 0.523985
 right-1.317514   0.3281740.330271   3.989 6.63e-05 ***
 income 0.705691   0.1906890.191843   3.678 0.000235 
***
 population   -1.026989   0.3199140.321969   3.190 0.001424 ** 
 weight   -0.178042   0.1359620.136761   1.302 0.192967
 
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 
‘ ’ 1 


What exactly is the z-test testing? I read a post saying that p0.05 means 
the confidence intervalsdon't span zero, however you can get the confidence 
intervals usingthe confint() call. What is the z-test telling me that the   
 confidence intervals are not?

Also - the MuMIn vignette says that the p-value assumes a normalerror 
distribution. A normal distribution of what? The models usedin model 
averaging? Or the original data?

Any clarification would be much appreciated. 

Tom

 
[[alternative HTML version deleted]]

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


Re: [R] R riddle

2014-01-10 Thread arun
Hi,
Use ?reshape()
dat1- read.table(text=V1 V2   V3 V4 V5
1 210505  ARS    B  A
1 210505  BFGL   A  B
1 210505  NGS    B  B
1 210506 ARS B  B
1 210506 BFGL    A  A
1 210506 NGS B  B
1 210507  ARS    B  B
1 210507 BFGL    A  B
1 210507 NGS A  B,sep=,header=TRUE,stringsAsFactors=FALSE) 


 res - reshape(dat1[,-1],timevar=V2,idvar=V3,direction=wide)
colnames(res)[-1] -gsub(.*\\.,,colnames(res)[-1])
 res
#    V3 210505 210505 210506 210506 210507 210507
#1  ARS  B  A  B  B  B  B
#2 BFGL  A  B  A  A  A  B
#3  NGS  B  B  B  B  A  B


A.K.


Dear R users I have a question. 

I have example file: 

V1 V2       V3     V4 V5 
1 210505  ARS    B  A 
1 210505  BFGL   A  B 
1 210505  NGS    B  B 
1 210506 ARS     B  B 
1 210506 BFGL    A  A 
1 210506 NGS     B  B 
1 210507  ARS    B  B 
1 210507 BFGL    A  B 
1 210507 NGS     A  B 

from which I want to get file which looks like this: 

V2      210505 210505   210506  210506  210507 210507 
ARS      B            A          B           B          B            B 
BFGL    A             B          A          A          A             B 
NGS     B             B          B          B          A             B 


I think this can be done with a loop but unfortunatelly I'm not experienced 
with loops. 
Thank you very much for help!

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

2014-01-10 Thread ramoss
Hi,

I am trying to use the package TM on a dataframe  get the following error:

complaints - tm_map(complaints, tolower)
Error in UseMethod(tm_map, x) : 
  no applicable method for 'tm_map' applied to an object of class
data.frame

Tm doesn't work on dataframes?  My data frame consists of 1 text variable
containing customer complaints.  What do I have to change it to in order to
use the TM package for text mining?

Thanks ahead for your help/thoughts.



--
View this message in context: 
http://r.789695.n4.nabble.com/Package-TM-dataframes-tp4683392.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] Package TM dataframes

2014-01-10 Thread David Winsemius


On Jan 10, 2014, at 10:11 AM, ramoss wrote:


Hi,

I am trying to use the package TM on a dataframe  get the following  
error:


complaints - tm_map(complaints, tolower)
Error in UseMethod(tm_map, x) :
 no applicable method for 'tm_map' applied to an object of class
data.frame

Tm doesn't work on dataframes?  My data frame consists of 1 text  
variable
containing customer complaints.  What do I have to change it to in  
order to

use the TM package for text mining?

Thanks ahead for your help/thoughts.


As the Posting Guide says: Sometimes the appropriate answer is to  
direct you to the manual. In this case ?tm::tm_map shows that the  
first argument is expected to be a corpus object.


--

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] How do you transform a dataframe to a corpus?

2014-01-10 Thread ramoss
Hi;

I have a data frame complains w/ dimensions 11335291 ( 1.13m obs 1 col)
I am trying to transform it into a corpus
using the following code: myCorpus -Corpus(VectorSource(complaints$text))
Error in .Source(readPlain, encoding, length(x), FALSE, names(x), 0, TRUE, 
: 
  vectorized sources must have positive length
Does anybody understand the error message?


Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-you-transform-a-dataframe-to-a-corpus-tp4683396.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 determine the order of a time series object

2014-01-10 Thread Jeff Newmiller
There are many ways, but this is not a statistical theory support forum for 
helping you choose among them. Your question becomes more appropriate when you 
ask something along the lines of how do I regress data using AR model with R? 
(Though reading the Time Series Task View on CRAN would be even more 
appropriate than asking that question here.)
---
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
--- 
Sent from my phone. Please excuse my brevity.

Charles Thuo tcmui...@gmail.com wrote:
I have monthly claims data from 2009 to end of 2013 and would like to
forecast for  2014. How is this done in R.

Charles.

   [[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] locate pattern in matrix

2014-01-10 Thread William Dunlap
What would you like to get from the following?
  0 1 0 0 0
  1 1 1 0 0
  1 1 1 1 0
  0 0 1 1 0
  0 0 1 1 1
  0 0 0 1 1

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 email
 Sent: Thursday, January 09, 2014 11:03 PM
 To: r-help@r-project.org
 Subject: [R] locate pattern in matrix
 
 Dear all,
 
 I have a binary matrix
 
 0 0 0 0 0
 1 1 1 0 0
 1 1 1 0 0
 0 0 0 0 0
 0 0 0 1 1
 0 0 0 1 1
 
 I want to find the location of all the square and rectangular 1 blocks, like
 
 First block in row=2, col=1 to row=3, col=3.
 Second block in row=5, col=4, to row=6, col=5.
 
 How can I find such blocks of 1?
 
 Thanks:
 John
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] How do you transform a dataframe to a corpus?

2014-01-10 Thread ramoss
The column length is 4000 bytes long if that helps.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-you-transform-a-dataframe-to-a-corpus-tp4683396p4683402.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] ggplot2; svg; text point size specification

2014-01-10 Thread stephen sefick
library(ggplot2)
a - data.frame(x=rnorm(10), y=rnorm(10))

#conversion of mm to points 2.83464567
plot.demo - qplot(x, y, data=a, xlab=test.x,
ylab=test.y)+theme(panel.border=element_rect(fill=NA, size=1),
axis.title.x = element_text(size=10*2.83464567, family=Arial),
axis.title.y = element_text(size=12*2.83464567, family=Arial),
axis.text.y = element_text(size=10*2.83464567, family=Arial), axis.text.x
= element_text(size=10*2.83464567, family=Arial))

print(plot.demo)

Happy New Year Everyone!

I would like to preserve point size with different figure sizes using the
svg graphics device.

#for instance
#ggsave(~/Desktop/test2.svg, p ,height=3, width=3)
#ggsave(~/Desktop/test2.svg, p ,height=10, width=10)

#both look very different to me. What am I missing? Thank you for all of
the help in advance.

Stephen



-- 
Stephen Sefick
**
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**

Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

-K. Mullis

A big computer, a complex algorithm and a long time does not equal
science.

  -Robert Gentleman

[[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] embedd fonts in pdf generated by R

2014-01-10 Thread Adel ESSAFI
Hello list
I generated pdf files with R that I integrated
in .tex file and compiled with pdflatex.

however, all the fonts of my R figure not embadded. so the file is rejected
from EDAS web site.

Could you help please.


[adel@localhost hcw]$  pdffonts hcw.pdf
name type  encoding emb
sub uni object ID
 -  ---
--- --- -
ZIMYVR+NimbusRomNo9L-MediType 1Custom   yes
yes no   7  0
EYECKV+NimbusRomNo9L-ReguType 1Custom   yes
yes no   8  0
WKYGSZ+CMSY8 Type 1Builtin  yes
yes no   9  0
TEABSF+NimbusRomNo9L-ReguItalType 1Custom   yes
yes no  10  0
MPLOPB+NimbusRomNo9L-MediItalType 1Custom   yes
yes no  11  0
XSKVTD+CMMI10Type 1Builtin  yes
yes no  19  0
NKXZUI+CMSY10Type 1Builtin  yes
yes no  20  0
PVJEEI+CMR10 Type 1Builtin  yes
yes no  21  0
TEORRU+CMR7  Type 1Builtin  yes
yes no  22  0
NGESNP+CMMI7 Type 1Builtin  yes
yes no  23  0
ZDXXKY+CMMI5 Type 1Builtin  yes
yes no  24  0
VGZAHY+CMR5  Type 1Builtin  yes
yes no  25  0
NOPBSI+CMSY5 Type 1Builtin  yes
yes no  26  0
ZYGQZM+CMMI6 Type 1Builtin  yes
yes no  27  0
QRZPBZ+CMMI8 Type 1Builtin  yes
yes no  28  0
TZYURE+MSBM10Type 1Builtin  yes
yes no  29  0
HIBZGW+Times-Roman   Type 1C   WinAnsi  yes
yes no  37  0
QLAAJV+CMSY7 Type 1Builtin  yes
yes no  46  0
RMTRPB+CMEX10Type 1Builtin  yes
yes no  47  0
BNPUIJ+Courier   Type 1C   WinAnsi  yes
yes no  60  0
GZSZHC+Times-Roman   Type 1C   WinAnsi  yes
yes no  61  0
QBHKPM+Times-Roman   Type 1C   WinAnsi  yes
yes no  70  0
Symbol   Type 1Custom   no
no  no  81  0
ZapfDingbats Type 1Custom   no
no  yes 82  0
HelveticaType 1Standard no
no  no  83  0



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166

[[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] embedd fonts in pdf generated by R

2014-01-10 Thread Prof Brian Ripley

On 10/01/2014 19:29, Adel ESSAFI wrote:

Hello list
I generated pdf files with R that I integrated
in .tex file and compiled with pdflatex.

however, all the fonts of my R figure not embadded. so the file is rejected
from EDAS web site.

Could you help please.


If you have suitable licenses for those fonts, see ?embedFonts (surely 
an obvious thing to search for!).


Otherwise, select fonts you do have a license to embed.

And see the posting guide: a reproducible example would have helped a 
lot here.





[adel@localhost hcw]$  pdffonts hcw.pdf
name type  encoding emb
sub uni object ID
 -  ---
--- --- -
ZIMYVR+NimbusRomNo9L-MediType 1Custom   yes
yes no   7  0
EYECKV+NimbusRomNo9L-ReguType 1Custom   yes
yes no   8  0
WKYGSZ+CMSY8 Type 1Builtin  yes
yes no   9  0
TEABSF+NimbusRomNo9L-ReguItalType 1Custom   yes
yes no  10  0
MPLOPB+NimbusRomNo9L-MediItalType 1Custom   yes
yes no  11  0
XSKVTD+CMMI10Type 1Builtin  yes
yes no  19  0
NKXZUI+CMSY10Type 1Builtin  yes
yes no  20  0
PVJEEI+CMR10 Type 1Builtin  yes
yes no  21  0
TEORRU+CMR7  Type 1Builtin  yes
yes no  22  0
NGESNP+CMMI7 Type 1Builtin  yes
yes no  23  0
ZDXXKY+CMMI5 Type 1Builtin  yes
yes no  24  0
VGZAHY+CMR5  Type 1Builtin  yes
yes no  25  0
NOPBSI+CMSY5 Type 1Builtin  yes
yes no  26  0
ZYGQZM+CMMI6 Type 1Builtin  yes
yes no  27  0
QRZPBZ+CMMI8 Type 1Builtin  yes
yes no  28  0
TZYURE+MSBM10Type 1Builtin  yes
yes no  29  0
HIBZGW+Times-Roman   Type 1C   WinAnsi  yes
yes no  37  0
QLAAJV+CMSY7 Type 1Builtin  yes
yes no  46  0
RMTRPB+CMEX10Type 1Builtin  yes
yes no  47  0
BNPUIJ+Courier   Type 1C   WinAnsi  yes
yes no  60  0
GZSZHC+Times-Roman   Type 1C   WinAnsi  yes
yes no  61  0
QBHKPM+Times-Roman   Type 1C   WinAnsi  yes
yes no  70  0
Symbol   Type 1Custom   no
no  no  81  0
ZapfDingbats Type 1Custom   no
no  yes 82  0
HelveticaType 1Standard no
no  no  83  0



PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


PLEASE do.


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

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


Re: [R] Maximum of Maximum

2014-01-10 Thread arun
Hi,

May be this helps:
set.seed(42)
 vec1 - sapply(1:1000,function(x) max(rnorm(1000,0,1)))
#or
set.seed(42)
 vec2 - replicate(1000,max(rnorm(1000,0,1)))
identical(vec1,vec2)
#[1] TRUE

set.seed(598)
res - sample(vec1,100,replace=FALSE)

 max(res)
#[1] 4.408794
A.K.

Hello I need some help in programming: 

I want to after take a rnorm(1000,0,1) sample want to save the 
max of it in a vector, this was difficult to me, then I need to repeat 
this process 1000 times, so I shall have 1000 maximum from the normal of
 samples of size 1000. 
Then I want to sample from this maximum series a new sample, this time of size 
100. 

I drive a programm: 

sample-rnorm(1000,0,1) 
for(i in 1:length(sample)){ 
   maxim-vector(mode=numeric,length(sample)) 
   maxim[i]-max(sample) 
} 

then my result was a vector with n-1 zeroes and the last one 
value was a maximum. I think it took the last value, but I don't know 
how to repair it. 

I need most help, thanks 


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


[R] SE for R-squared

2014-01-10 Thread Troels Ring
In R package psychometrics an estimate of SE of R squared of /sersq - 
sqrt((4*rsq*(1-rsq)^2*(n-k-1)^2)/((n^2-1)*(n+3))) with n sample size, 
and  k number of parameters if sample size greater than 60 is found. 
Does anyone have a formula for smaller sample size or an exact formula?
I have been through sos - but only found the above?

All best wishes
Troels Ring
Denmark
/

[[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] Conditional inclusion of an element in an R object

2014-01-10 Thread Santosh
Dear Rxperts...

I would like to conditionally include an element (as a column) in a
dataframe. Please see the  sample code below:

a1 -
data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),each=5))

 lc1 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R)
 lc2 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=Ra)

a2 - subset(a1, sel=unlist(lc1)) # this works
a3 - subset(a1, sel=unlist(lc2)) # this doesn't

Is there a way to dynamically include columns in a dataframe?

Regards,
santosh

[[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] Conditional inclusion of an element in an R object

2014-01-10 Thread Santosh
Dear Rxperts...

I would like to conditionally include an element (as a column) in a
dataframe. Please see the  sample code below:

There is a correction to the earlier post.. my apologies...
a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
R=rep(c(A,B),each=5))

 lc1 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R)
 lc2 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),
C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
*The error for the above:*
Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
  replacement has length zero
In addition: Warning message:
In rep(no, length.out = length(ans)) :
  'x' is NULL so the result will be NULL

a2 - subset(a1, sel=unlist(lc1)) # this works
a3 - subset(a1, sel=unlist(lc2)) # this doesn't work

Is there a way to dynamically include columns in a dataframe?

Regards,
santosh


On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote:

 Dear Rxperts...

 I would like to conditionally include an element (as a column) in a
 dataframe. Please see the  sample code below:

 a1 -
 data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),each=5))

  lc1 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=R)
  lc2 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,NULL)),C3=Ra)

 a2 - subset(a1, sel=unlist(lc1)) # this works
 a3 - subset(a1, sel=unlist(lc2)) # this doesn't

 Is there a way to dynamically include columns in a dataframe?

 Regards,
 santosh


[[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] Conditional inclusion of an element in an R object

2014-01-10 Thread MacQueen, Don
Apologies, but all that ifelse() stuff is too hard to follow.

What I would do is compute a character vector of column names to keep,
then do

  a1[ , names.to.keep]

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:

Dear Rxperts...

I would like to conditionally include an element (as a column) in a
dataframe. Please see the  sample code below:

There is a correction to the earlier post.. my apologies...
a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
R=rep(c(A,B),each=5))

 lc1 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
NULL)),C3=R)
 lc2 - list(C1 = P,C2 =
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
NULL)),
C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
*The error for the above:*
Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
  replacement has length zero
In addition: Warning message:
In rep(no, length.out = length(ans)) :
  'x' is NULL so the result will be NULL

a2 - subset(a1, sel=unlist(lc1)) # this works
a3 - subset(a1, sel=unlist(lc2)) # this doesn't work

Is there a way to dynamically include columns in a dataframe?

Regards,
santosh


On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote:

 Dear Rxperts...

 I would like to conditionally include an element (as a column) in a
 dataframe. Please see the  sample code below:

 a1 -
 
data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),
each=5))

  lc1 - list(C1 = P,C2 =
 
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,NULL)),C3=R)
  lc2 - list(C1 = P,C2 =
 
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,NULL)),C3=Ra)

 a2 - subset(a1, sel=unlist(lc1)) # this works
 a3 - subset(a1, sel=unlist(lc2)) # this doesn't

 Is there a way to dynamically include columns in a dataframe?

 Regards,
 santosh


   [[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] Maximum of Maximum

2014-01-10 Thread Bert Gunter
It probably doesn't make much difference in this small example, but
maybe it's worth noting that **if possible** (it typically is not),
things can be speeded up by generating all the random numbers at once
then applying a vectorized operation to the entire ensemble. In this
case, this becomes:

ran - do.call(pmax,data.frame(matrix(rnorm(1e6),nr=1000)))

pmax() is the vectorized operation. The do.call(...,data.frame(..)))
construction must be used to satisfy the argument list requirements
for pmax and do.call.

Cheers,
Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Fri, Jan 10, 2014 at 12:31 PM, arun smartpink...@yahoo.com wrote:
 Hi,

 May be this helps:
 set.seed(42)
  vec1 - sapply(1:1000,function(x) max(rnorm(1000,0,1)))
 #or
 set.seed(42)
  vec2 - replicate(1000,max(rnorm(1000,0,1)))
 identical(vec1,vec2)
 #[1] TRUE

 set.seed(598)
 res - sample(vec1,100,replace=FALSE)

  max(res)
 #[1] 4.408794
 A.K.

 Hello I need some help in programming:

 I want to after take a rnorm(1000,0,1) sample want to save the
 max of it in a vector, this was difficult to me, then I need to repeat
 this process 1000 times, so I shall have 1000 maximum from the normal of
  samples of size 1000.
 Then I want to sample from this maximum series a new sample, this time of 
 size 100.

 I drive a programm:

 sample-rnorm(1000,0,1)
 for(i in 1:length(sample)){
maxim-vector(mode=numeric,length(sample))
maxim[i]-max(sample)
 }

 then my result was a vector with n-1 zeroes and the last one
 value was a maximum. I think it took the last value, but I don't know
 how to repair it.

 I need most help, thanks


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

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


Re: [R] Maximum of Maximum

2014-01-10 Thread Bert Gunter
... In fact, on my computer, the pmax construction took longer. I
would guess that's due to the data.frame construction. Nevertheless,
the comment is still germane.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Fri, Jan 10, 2014 at 1:03 PM, Bert Gunter bgun...@gene.com wrote:
 It probably doesn't make much difference in this small example, but
 maybe it's worth noting that **if possible** (it typically is not),
 things can be speeded up by generating all the random numbers at once
 then applying a vectorized operation to the entire ensemble. In this
 case, this becomes:

 ran - do.call(pmax,data.frame(matrix(rnorm(1e6),nr=1000)))

 pmax() is the vectorized operation. The do.call(...,data.frame(..)))
 construction must be used to satisfy the argument list requirements
 for pmax and do.call.

 Cheers,
 Bert


 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch




 On Fri, Jan 10, 2014 at 12:31 PM, arun smartpink...@yahoo.com wrote:
 Hi,

 May be this helps:
 set.seed(42)
  vec1 - sapply(1:1000,function(x) max(rnorm(1000,0,1)))
 #or
 set.seed(42)
  vec2 - replicate(1000,max(rnorm(1000,0,1)))
 identical(vec1,vec2)
 #[1] TRUE

 set.seed(598)
 res - sample(vec1,100,replace=FALSE)

  max(res)
 #[1] 4.408794
 A.K.

 Hello I need some help in programming:

 I want to after take a rnorm(1000,0,1) sample want to save the
 max of it in a vector, this was difficult to me, then I need to repeat
 this process 1000 times, so I shall have 1000 maximum from the normal of
  samples of size 1000.
 Then I want to sample from this maximum series a new sample, this time of 
 size 100.

 I drive a programm:

 sample-rnorm(1000,0,1)
 for(i in 1:length(sample)){
maxim-vector(mode=numeric,length(sample))
maxim[i]-max(sample)
 }

 then my result was a vector with n-1 zeroes and the last one
 value was a maximum. I think it took the last value, but I don't know
 how to repair it.

 I need most help, thanks


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

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


[R] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread Santosh
My intention is to include certain columns if they meet certain criteria.
For example, if b is one of the columns of a1, then keep otherwise don't.

HTH..
santosh


On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov wrote:

 Apologies, but all that ifelse() stuff is too hard to follow.

 What I would do is compute a character vector of column names to keep,
 then do

   a1[ , names.to.keep]

 -Don

 --
 Don MacQueen

 Lawrence Livermore National Laboratory
 7000 East Ave., L-627
 Livermore, CA 94550
 925-423-1062





 On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:

 Dear Rxperts...
 
 I would like to conditionally include an element (as a column) in a
 dataframe. Please see the  sample code below:
 
 There is a correction to the earlier post.. my apologies...
 a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
 R=rep(c(A,B),each=5))
 
  lc1 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
 NULL)),C3=R)
  lc2 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
 NULL)),
 C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
 *The error for the above:*
 Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
   replacement has length zero
 In addition: Warning message:
 In rep(no, length.out = length(ans)) :
   'x' is NULL so the result will be NULL
 
 a2 - subset(a1, sel=unlist(lc1)) # this works
 a3 - subset(a1, sel=unlist(lc2)) # this doesn't work
 
 Is there a way to dynamically include columns in a dataframe?
 
 Regards,
 santosh
 
 
 On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote:
 
  Dear Rxperts...
 
  I would like to conditionally include an element (as a column) in a
  dataframe. Please see the  sample code below:
 
  a1 -
 
 data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),
 each=5))
 
   lc1 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
 ,NULL)),C3=R)
   lc2 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
 ,NULL)),C3=Ra)
 
  a2 - subset(a1, sel=unlist(lc1)) # this works
  a3 - subset(a1, sel=unlist(lc2)) # this doesn't
 
  Is there a way to dynamically include columns in a dataframe?
 
  Regards,
  santosh
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

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


[R] Tinn-R eBook (free)

2014-01-10 Thread Jose Claudio Faria
Dear users,

An eBook (2. Ed.) of Tinn-R was published today.

Dowload (free):
- http://www.uesc.br/editora/index.php?item=conteudo_livros_digitais.php
- http://www.uesc.br/editora/livrosdigitais2/tredit.pdf
- Http://nbcgib.uesc.br/lec/software/editores/tinn-r/en # h10-ebook

All the best,
-- 
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
Jose Claudio Faria
Estatistica
UESC/DCET/Brasil
joseclaudio.faria at gmail.com
Telefones:
55(73)3680.5545 - UESC
55(73)9100.7351 - TIM
55(73)8817.6159 - OI
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\

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


Re: [R] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread Bert Gunter
Don's response seems apropos to me. Do you understanding indexing,
i.e. the [ operator? If not, you should read An Introduction to R or
other tutorial (there are many good ones on the web). If that is not
the issue, you need to explain more clearly why his answer does not
suffice.

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Fri, Jan 10, 2014 at 1:59 PM, Santosh santosh2...@gmail.com wrote:
 My intention is to include certain columns if they meet certain criteria.
 For example, if b is one of the columns of a1, then keep otherwise don't.

 HTH..
 santosh


 On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov wrote:

 Apologies, but all that ifelse() stuff is too hard to follow.

 What I would do is compute a character vector of column names to keep,
 then do

   a1[ , names.to.keep]

 -Don

 --
 Don MacQueen

 Lawrence Livermore National Laboratory
 7000 East Ave., L-627
 Livermore, CA 94550
 925-423-1062





 On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:

 Dear Rxperts...
 
 I would like to conditionally include an element (as a column) in a
 dataframe. Please see the  sample code below:
 
 There is a correction to the earlier post.. my apologies...
 a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
 R=rep(c(A,B),each=5))
 
  lc1 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
 NULL)),C3=R)
  lc2 - list(C1 = P,C2 =
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
 NULL)),
 C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
 *The error for the above:*
 Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
   replacement has length zero
 In addition: Warning message:
 In rep(no, length.out = length(ans)) :
   'x' is NULL so the result will be NULL
 
 a2 - subset(a1, sel=unlist(lc1)) # this works
 a3 - subset(a1, sel=unlist(lc2)) # this doesn't work
 
 Is there a way to dynamically include columns in a dataframe?
 
 Regards,
 santosh
 
 
 On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com wrote:
 
  Dear Rxperts...
 
  I would like to conditionally include an element (as a column) in a
  dataframe. Please see the  sample code below:
 
  a1 -
 
 data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),
 each=5))
 
   lc1 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
 ,NULL)),C3=R)
   lc2 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
 ,NULL)),C3=Ra)
 
  a2 - subset(a1, sel=unlist(lc1)) # this works
  a3 - subset(a1, sel=unlist(lc2)) # this doesn't
 
  Is there a way to dynamically include columns in a dataframe?
 
  Regards,
  santosh
 
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 [[alternative HTML version deleted]]

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

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


Re: [R] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread Santosh
I don't think apropos or indexing would help. I am open to your
suggestions/tips.

I usually get multiple versions of a dataset (even with the same column
names). In the source data, I occasionally notice inconsistencies...
formatting issues, column naming issues etc..

As shown In the a1 example,.. the values that are supposed to be in
column Qr are sometimes in column b. Such differences between versions
crop up due to various unknown reasons, e.g. when different programmers
prepare the data set or if the existing practices/processes change.

Likewise, formats of certain date-time columns (not shown in the example)
also vary, the time date format may be in %m/%d/%Y %H:%M, %d %b %Y
%H:%M or  %d%b%Y %H:%M

So, I would like use programming methods to pick the right one if available
or don't pick at all.

Besides, is there an R equivalent of %m[/][.]%d[/][,]%y
[%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]] available in Splus (?class.timeDate)
for tackling time-date format inconsistencies as mentioned above.

Thanks,
Santosh


On Fri, Jan 10, 2014 at 2:32 PM, Bert Gunter gunter.ber...@gene.com wrote:

 Don's response seems apropos to me. Do you understanding indexing,
 i.e. the [ operator? If not, you should read An Introduction to R or
 other tutorial (there are many good ones on the web). If that is not
 the issue, you need to explain more clearly why his answer does not
 suffice.

 Cheers,
 Bert

 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch




 On Fri, Jan 10, 2014 at 1:59 PM, Santosh santosh2...@gmail.com wrote:
  My intention is to include certain columns if they meet certain criteria.
  For example, if b is one of the columns of a1, then keep otherwise
 don't.
 
  HTH..
  santosh
 
 
  On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov
 wrote:
 
  Apologies, but all that ifelse() stuff is too hard to follow.
 
  What I would do is compute a character vector of column names to keep,
  then do
 
a1[ , names.to.keep]
 
  -Don
 
  --
  Don MacQueen
 
  Lawrence Livermore National Laboratory
  7000 East Ave., L-627
  Livermore, CA 94550
  925-423-1062
 
 
 
 
 
  On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:
 
  Dear Rxperts...
  
  I would like to conditionally include an element (as a column) in a
  dataframe. Please see the  sample code below:
  
  There is a correction to the earlier post.. my apologies...
  a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
  R=rep(c(A,B),each=5))
  
   lc1 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
  NULL)),C3=R)
   lc2 - list(C1 = P,C2 =
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b,
  NULL)),
  C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
  *The error for the above:*
  Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
replacement has length zero
  In addition: Warning message:
  In rep(no, length.out = length(ans)) :
'x' is NULL so the result will be NULL
  
  a2 - subset(a1, sel=unlist(lc1)) # this works
  a3 - subset(a1, sel=unlist(lc2)) # this doesn't work
  
  Is there a way to dynamically include columns in a dataframe?
  
  Regards,
  santosh
  
  
  On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com
 wrote:
  
   Dear Rxperts...
  
   I would like to conditionally include an element (as a column) in a
   dataframe. Please see the  sample code below:
  
   a1 -
  
 
 data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B),
  each=5))
  
lc1 - list(C1 = P,C2 =
  
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
  ,NULL)),C3=R)
lc2 - list(C1 = P,C2 =
  
 
 ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
  ,NULL)),C3=Ra)
  
   a2 - subset(a1, sel=unlist(lc1)) # this works
   a3 - subset(a1, sel=unlist(lc2)) # this doesn't
  
   Is there a way to dynamically include columns in a dataframe?
  
   Regards,
   santosh
  
  
 [[alternative HTML version deleted]]
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

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

Re: [R] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread MacQueen, Don
At the risk of being annoying ...

Your original question was,
 Is there a way to dynamically include columns in a dataframe?

The answer is yes. One way, and I think the simplest, is to calculate the
names of the columns you want to keep, and then use an expression like I
suggested, that is, one like
  a1[ , names.to.keep]
instead of using select().

Or calculate the names  you do not want to keep, if that is easier, and
use for example
  a1[, setdiff(names(a1),names.to.drop) ]

Based on your most recent email it seems like calculating which columns to
keep or drop may be difficult. But I would still suggest a better approach
would be to focus on calculating a character vector of column names. Maybe
you can convert your lc1 and lc2 objects to vectors of column names.

Speaking personally, nested ifelse() expressions make me want to get up
and run away. So I've very reluctant to put any effort into trying to
figure out what they produce. But that's just my preference; others may
feel differently.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 1/10/14 3:24 PM, Santosh santosh2...@gmail.com wrote:

I don't think apropos or indexing would help. I am open to your
suggestions/tips.

I usually get multiple versions of a dataset (even with the same column
names). In the source data, I occasionally notice inconsistencies...
formatting issues, column naming issues etc..

As shown In the a1 example,.. the values that are supposed to be in
column Qr are sometimes in column b. Such differences between versions
crop up due to various unknown reasons, e.g. when different programmers
prepare the data set or if the existing practices/processes change.

Likewise, formats of certain date-time columns (not shown in the example)
also vary, the time date format may be in %m/%d/%Y %H:%M, %d %b %Y
%H:%M or  %d%b%Y %H:%M

So, I would like use programming methods to pick the right one if
available
or don't pick at all.

Besides, is there an R equivalent of %m[/][.]%d[/][,]%y
[%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]] available in Splus (?class.timeDate)
for tackling time-date format inconsistencies as mentioned above.

Thanks,
Santosh


On Fri, Jan 10, 2014 at 2:32 PM, Bert Gunter gunter.ber...@gene.com
wrote:

 Don's response seems apropos to me. Do you understanding indexing,
 i.e. the [ operator? If not, you should read An Introduction to R or
 other tutorial (there are many good ones on the web). If that is not
 the issue, you need to explain more clearly why his answer does not
 suffice.

 Cheers,
 Bert

 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch




 On Fri, Jan 10, 2014 at 1:59 PM, Santosh santosh2...@gmail.com wrote:
  My intention is to include certain columns if they meet certain
criteria.
  For example, if b is one of the columns of a1, then keep otherwise
 don't.
 
  HTH..
  santosh
 
 
  On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov
 wrote:
 
  Apologies, but all that ifelse() stuff is too hard to follow.
 
  What I would do is compute a character vector of column names to
keep,
  then do
 
a1[ , names.to.keep]
 
  -Don
 
  --
  Don MacQueen
 
  Lawrence Livermore National Laboratory
  7000 East Ave., L-627
  Livermore, CA 94550
  925-423-1062
 
 
 
 
 
  On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:
 
  Dear Rxperts...
  
  I would like to conditionally include an element (as a column) in a
  dataframe. Please see the  sample code below:
  
  There is a correction to the earlier post.. my apologies...
  a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
  R=rep(c(A,B),each=5))
  
   lc1 - list(C1 = P,C2 =
 
 
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,
  NULL)),C3=R)
   lc2 - list(C1 = P,C2 =
 
 
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,
  NULL)),
  C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
  *The error for the above:*
  Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
replacement has length zero
  In addition: Warning message:
  In rep(no, length.out = length(ans)) :
'x' is NULL so the result will be NULL
  
  a2 - subset(a1, sel=unlist(lc1)) # this works
  a3 - subset(a1, sel=unlist(lc2)) # this doesn't work
  
  Is there a way to dynamically include columns in a dataframe?
  
  Regards,
  santosh
  
  
  On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com
 wrote:
  
   Dear Rxperts...
  
   I would like to conditionally include an element (as a column) in
a
   dataframe. Please see the  sample code below:
  
   a1 -
  
 
 
data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B
),
  each=5))
  
lc1 - list(C1 = P,C2 =
  
 
 
ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),
b
  ,NULL)),C3=R)
lc2 - list(C1 = P,C2 =
  
 
 

Re: [R] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread Jeff Newmiller
I agree with Don... focus on identifying the names of the columns and then use 
column name indexing to extract the columns you want. You will probably want to 
rename them to a standard set of names once you have gone to all this 
trouble... just assign the new vector of names to the names function of the 
extracted data frame.

Using nested if-else may be messy, but regardless of whether you figure out a 
better way to identify columns that works for your data, you should be able to 
using indexing by name both now and later.
---
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
--- 
Sent from my phone. Please excuse my brevity.

MacQueen, Don macque...@llnl.gov wrote:
At the risk of being annoying ...

Your original question was,
 Is there a way to dynamically include columns in a dataframe?

The answer is yes. One way, and I think the simplest, is to calculate
the
names of the columns you want to keep, and then use an expression like
I
suggested, that is, one like
  a1[ , names.to.keep]
instead of using select().

Or calculate the names  you do not want to keep, if that is easier, and
use for example
  a1[, setdiff(names(a1),names.to.drop) ]

Based on your most recent email it seems like calculating which columns
to
keep or drop may be difficult. But I would still suggest a better
approach
would be to focus on calculating a character vector of column names.
Maybe
you can convert your lc1 and lc2 objects to vectors of column names.

Speaking personally, nested ifelse() expressions make me want to get up
and run away. So I've very reluctant to put any effort into trying to
figure out what they produce. But that's just my preference; others may
feel differently.

-Don

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


Re: [R] Function inside Sweave

2014-01-10 Thread Duncan Mackay
Hi Silvano

To save you typing try paste0 (...) instead of paste(, sep = )

Just checking quickly 
In 
### code chunk number 3: Serie1

for (i in 1:7){
  aux - paste(Q, i, sep=)}

will always end up with Q7

Is the } to go elsewhere?
OR
Is it superfluous?

Duncan

-Original Message-
From: silv...@uel.br [mailto:silv...@uel.br] 
Sent: Friday, 10 January 2014 23:50
To: Duncan Mackay
Subject: Re: [R] Function inside Sweave

Dear Duncan,

I get solved the problem. This is the solution:

###
### code chunk number 1: Dados
###
rm(list=ls())

require(foreign)
require(xtable)
require(reshape)

setwd('C:/Colegiado de Veterinária/Dados/A2013/')

Geral = read.epiinfo('A2013.rec')
Professores = read.epiinfo('Professor.rec')

Dados = merge(Geral, Professores, by=c('ALUNO', 'DISCIPLINA'))


###
### code chunk number 2: Leitura
###
serie_1 = subset(Dados, SERIE=='1')
attach(serie_1)
head(serie_1)

round(100*prop.table(table(DISCIPLINA, Q1, PROFESSOR), 1), 2)

###
### code chunk number 3: Serie1
###
DISCIPLINA - serie_1$DISCIPLINA
for (i in 1:7){
  aux - paste(Q, i, sep=)}

for (i in 1:7){
  aux - paste(nome.Questao, i, sep=)
  assign(aux, paste(Nome da Questao, i))
}

nome.Questoes = c(Apresentação da proposta de programa a ser desenvolvida 
na disciplina.,
  Profundidade dos temas em relação aos objetivos da 
disciplina.,
  Aplicabilidade dos temas abordados.,
  Articulação do conteúdo da disciplina com outras e com a 
profissão.,
  Estabelecimento de critérios de avaliação claros e 
adequados.,
  Os resultados das avaliações são discutidos com os 
alunos.,
  Atendimento da disciplina às suas expectativas.)

cria.tabela - function(Questao, i){
  Questao1 - get(Questao)
  tab1 - table(DISCIPLINA, Questao1)
  tab1.prop = round(100*prop.table(tab1, 1),  2)
  capt - nome.Questoes[i]
  tab1.txt = xtable(tab1.prop, align=l|r, label=Questao, 
caption=paste(capt))
  print(tab1.txt, format.args=list(big.mark = ., decimal.mark = ,), 
caption.placement='top', table.placement='H')
  cat(\n\n\n)
}

Discip - function(){
  for (i in 1:7){
x - paste(Q, i, sep=)
cria.tabela(x, i)
}
}

Discip()



Thanks a lot.

Silvano.




-Mensagem Original- 
From: Duncan Mackay
Sent: Friday, January 10, 2014 12:18 AM
To: silv...@uel.br
Cc: R
Subject: RE: [R] Function inside Sweave

Hi Silvano

I am not sure exactly what you want as I am not sure of the structure and
format going into xtable
but the structure after you have formed the table is apparently the same
structure.

This is what I suggested before (modified)

for(j in 1:25){
yourtable - ...
xx - xtable(yourtable)
caption(xx) - paste(Table, j)
print(xx)
if(j  25) cat(\n\n)

}

Pre xtable
If you have different colums to tabulate I suggest you use a formula or
bquote via a list to vary the columns in a loop
and these are the variables to be tabulated. You can then use this for your
column headers in xtable /latex.

durin/Post xtable

If single line header for table and formatting not needed to be changed
everything OK

otherwise inside chunk

head, echo=FALSE, results=tex=

for(j in 1:25){
  yourtable - ...

  hdx = c(\\begin{table}[h]\n,
 \\caption{\\prevt{} and their equivalent \\dcode{}}%\n,
 \\label{tab:, j }%\n,
 \\begin{tabular}{l|r}\n)   # adjust to suit
  cat(hdx)

  # header from col names or otherwise
  out - names(yourtable)
  out -
  c(,
paste(\\multicolumn{1}{c}{,
  out,
  rep(c(}  %\n, } ), c(length(out)-1, 1)), sep = ), \n
  )
  cat(out, sep = )
  # xtable
  xx - xtable(yourtable)

  xnd = c(\\end{tabular}\n,
  \\end{table}\n)
  cat(xnd)

  if(j  25) cat(\n\n)

}
@ %% end

You can add booktabs functions within tabular by cat if needed
If you have things that need to be changed they can be accessed by a
vector/list

If you have variable numbers of decimal points see an colour is black
http://tex.stackexchange.com/questions/96982/coloring-text-in-a-dcolumn-alig
ned-cell-of-a-table

Henrik Bengtsson has a package to do this sort of thing but he discontinued
it for ver 3 or 2.15 ca

Regards

Duncan

-Original Message-
From: silv...@uel.br [mailto:silv...@uel.br]
Sent: Friday, 10 January 2014 04:48
To: Duncan Mackay
Subject: Re: [R] Function inside Sweave

Dear Duncan,

I want relatioship two variables:  DISCIPLINA and Questions.

I have about 100 different disciplines (in same column) and 25 questions (25
differents columns).

Head is:

ALUNO DISCIPLINA FIELD1   DATA SERIE TURMA Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
PROFESSOR Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 Q22 Q23 Q24 Q25

Something like this:


[R] Selecting individuals to maximize the correlation of two variables

2014-01-10 Thread 汤靖
Hi,
Maybe it is not directly related to R but sine many are statistical experts so 
I post it here for help:

I have two variables (say x and y) of length n. Now the cor(x,y) is close to 0. 
I need to find the subset in {1,.. n} so that the correlation between x and y 
using the subset data is maximized. A trivial choice would be selecting 2 
individuals only so that cor(x,y) =1. As the size of the subset increases, 
cor(x,y) will go down to 0, but I am assuming the best correlation for each 
size of the subsets would not be monotonically decreasing.

Any idea of how to find the solution?

Thanks,
Jing

  
[[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] Fwd: Conditional inclusion of an element in an R object

2014-01-10 Thread Kevin Schiesser
?as.POSIXct for time-formatting. This function makes a structured list of
time data, where you specify an input time and format i.e.
as.POSIXct('2014-01-09 01:30:00', format='%Y-%m-%d %H:%M:%S')

On 1/10/14, 15:24 , Santosh santosh2...@gmail.com wrote:

I don't think apropos or indexing would help. I am open to your
suggestions/tips.

I usually get multiple versions of a dataset (even with the same column
names). In the source data, I occasionally notice inconsistencies...
formatting issues, column naming issues etc..

As shown In the a1 example,.. the values that are supposed to be in
column Qr are sometimes in column b. Such differences between versions
crop up due to various unknown reasons, e.g. when different programmers
prepare the data set or if the existing practices/processes change.

Likewise, formats of certain date-time columns (not shown in the example)
also vary, the time date format may be in %m/%d/%Y %H:%M, %d %b %Y
%H:%M or  %d%b%Y %H:%M

So, I would like use programming methods to pick the right one if available
or don't pick at all.

Besides, is there an R equivalent of %m[/][.]%d[/][,]%y
[%H[:%M[:%S[.%N]]][%p][[(]%3Z[)]]] available in Splus (?class.timeDate)
for tackling time-date format inconsistencies as mentioned above.

Thanks,
Santosh


On Fri, Jan 10, 2014 at 2:32 PM, Bert Gunter gunter.ber...@gene.com
wrote:

 Don's response seems apropos to me. Do you understanding indexing,
 i.e. the [ operator? If not, you should read An Introduction to R or
 other tutorial (there are many good ones on the web). If that is not
 the issue, you need to explain more clearly why his answer does not
 suffice.

 Cheers,
 Bert

 Bert Gunter
 Genentech Nonclinical Biostatistics
 (650) 467-7374

 Data is not information. Information is not knowledge. And knowledge
 is certainly not wisdom.
 H. Gilbert Welch




 On Fri, Jan 10, 2014 at 1:59 PM, Santosh santosh2...@gmail.com wrote:
  My intention is to include certain columns if they meet certain
criteria.
  For example, if b is one of the columns of a1, then keep otherwise
 don't.
 
  HTH..
  santosh
 
 
  On Fri, Jan 10, 2014 at 1:01 PM, MacQueen, Don macque...@llnl.gov
 wrote:
 
  Apologies, but all that ifelse() stuff is too hard to follow.
 
  What I would do is compute a character vector of column names to keep,
  then do
 
a1[ , names.to.keep]
 
  -Don
 
  --
  Don MacQueen
 
  Lawrence Livermore National Laboratory
  7000 East Ave., L-627
  Livermore, CA 94550
  925-423-1062
 
 
 
 
 
  On 1/10/14 12:53 PM, Santosh santosh2...@gmail.com wrote:
 
  Dear Rxperts...
  
  I would like to conditionally include an element (as a column) in a
  dataframe. Please see the  sample code below:
  
  There is a correction to the earlier post.. my apologies...
  a1 - data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],
  R=rep(c(A,B),each=5))
  
   lc1 - list(C1 = P,C2 =
 

ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,
  NULL)),C3=R)
   lc2 - list(C1 = P,C2 =
 

ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b
,
  NULL)),
  C3=ifelse(is.element(Ra,names(a1)),Ra,NULL))
  *The error for the above:*
  Error in ifelse(is.element(Ra, names(a1)), Ra, NULL) :
replacement has length zero
  In addition: Warning message:
  In rep(no, length.out = length(ans)) :
'x' is NULL so the result will be NULL
  
  a2 - subset(a1, sel=unlist(lc1)) # this works
  a3 - subset(a1, sel=unlist(lc2)) # this doesn't work
  
  Is there a way to dynamically include columns in a dataframe?
  
  Regards,
  santosh
  
  
  On Fri, Jan 10, 2014 at 12:45 PM, Santosh santosh2...@gmail.com
 wrote:
  
   Dear Rxperts...
  
   I would like to conditionally include an element (as a column) in a
   dataframe. Please see the  sample code below:
  
   a1 -
  
 

data.frame(P=rep(1,10),Qr=LETTERS[1:10],b=letters[1:10],R=rep(c(A,B)
,
  each=5))
  
lc1 - list(C1 = P,C2 =
  
 

ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b

  ,NULL)),C3=R)
lc2 - list(C1 = P,C2 =
  
 

ifelse(is.element(Q,names(a1)),Q,ifelse(is.element(b,names(a1)),b

  ,NULL)),C3=Ra)
  
   a2 - subset(a1, sel=unlist(lc1)) # this works
   a3 - subset(a1, sel=unlist(lc2)) # this doesn't
  
   Is there a way to dynamically include columns in a dataframe?
  
   Regards,
   santosh
  
  
 [[alternative HTML version deleted]]
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML 

[R] Species Distribution Modeling in R, with already extracted environmental values

2014-01-10 Thread Cody Schank
Hi all,

I am attempting to do SDM in R, mostly I have used the 'dismo' package.  My
problem is that all the methods call for a raster stack as the input
representing the environmental layers.  However, my processing steps leave
me with a table of extracted values for each occurrence (much like section
4.2 in the dismo vignette).  I am wondering if there is a way to feed this
type of data into these modeling methods, in dismo or any other SDM
package.

Thanks!
Cody Schank

[[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] looping through 3D array

2014-01-10 Thread apadr007
It seems like emdist does not like to compare matrices with all 0 values. I
ended up removing those from my 3D array and have ~8000 matrices instead of
13000.

I am using res2 - unlist(mclapply(seq_len(ncol(indx)),function(i) {x1 -
indx[,i]; emd2d(results[x1[1],,],results[x1[2],,]) }) )

But even with mclapply it is taking extremely long. Any way to speed this
up?

On Jan 9, 2014 4:10 PM, arun kirshna [via R] 
ml-node+s789695n4683362...@n4.nabble.com wrote:

 Hi,
 No problem.
 You can use ?lower.tri() or ?upper.tri()

 res[lower.tri(res)]
 res[lower.tri(res,diag=TRUE)]
 #Other way would be to use:
 ?combn
 indx - combn(dim(results)[1],m=2)


 res2 - sapply(seq_len(ncol(indx)),function(i) {x1 - indx[,i];
emd2d(results[x1[1],,],results[x1[2],,]) })
  identical(res[lower.tri(res)], res2)
 #[1] TRUE
 A.K.




 On Thursday, January 9, 2014 4:03 PM, alex padron [hidden email] wrote:

 Thanks. This works. I just noticed that half of the matrix repeats. For
example res[1,2] is the same as res[2,1]. any way to get half of the matrix
output (notice the diagonal 0 across the output matrix)?



 -Alex


 On Thu, Jan 9, 2014 at 12:57 PM, arun [hidden email] wrote:

 #or

 you can use ?expand.grid() and then loop over:
 indx - expand.grid(rep(list(seq(dim(results)[1])),2))
 res1 - matrix(sapply(seq_len(nrow(indx)),function(i) {x1 - indx[i,];
emd2d(results[x1[,1],,],results[x1[,2],,]) }),ncol=10)
 identical(res,res1)
 #[1] TRUE
 
 
 
 
 
 On Thursday, January 9, 2014 3:46 PM, arun [hidden email] wrote:
 Hi,
 Try:
 library(emdist)
 
 set.seed(435)
 results- array(sample(1:400,120,replace=TRUE),dim=c(10,3,4))
 res - sapply(seq(dim(results)[1]),function(i) {x1 - results[i,,]; x2
- results; sapply(seq(dim(x2)[1]),function(i) emd2d(x1,x2[i,,]))})
 dim(res)
 #[1] 10 10
 A.K.
 
 
 
 
 
 
 
 On Thursday, January 9, 2014 3:25 PM, alex padron [hidden email]
wrote:
 
 I'll try to be clearer. in your example we have: results-
array(1:120,dim=c(10,3,4))
 
 I want to do the following: compare results[1,,] with every matrix
inside results. I then want to jump to results[2,,] and compare it to all
of the other 10 matrices inside results and so on. so emd2d from
the emdist package outputs a single value when comparing matrices and since
your example has 10 matrices who are all being compared, the output should
be 100 values.
 
 Does that make sense?
 
 
 -Alex
 

 __
 [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:

http://r.789695.n4.nabble.com/looping-through-3D-array-tp4683350p4683362.html
 To unsubscribe from looping through 3D array, click here.
 NAML




--
View this message in context: 
http://r.789695.n4.nabble.com/looping-through-3D-array-tp4683350p4683403.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

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


Re: [R] Levelplots with non-continuous x-axis breaks

2014-01-10 Thread Pachapep
Sorry for bugging you again. I was wondering whether it is possible to include 
multiple different colors instead of just two. 
In the example below, the color.scale() function goes from yellow to red, but 
never passes through plain white. Would it be possible to tweak the function or 
would I have to start all over again?
Thanks for any tips.
patrick

On Jan 9, 2014, at 7:54, Pachapep pacha...@gmail.com wrote:

 
 Great, it works perfectly! Thanks so much for the awesome help!
 (Happy) patrick
 
 On Jan 9, 2014, at 7:07, Adams, Jean jvad...@usgs.gov wrote:
 
 Patrick,
 
 No error in your code, just two different ways of deriving a range of colors 
 ... heat.colors() and color.scale().  I modified the code to just use 
 color.scale().  You can tell it what two colors you want it to use for the 
 extremes, and it will work out the shades in between.
 
 Jean
 
 
 
 # fake data
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), runif(6, 
 0, 2), runif(6, 0, 2))
 
 mymatrix - fake
 dimnames(mymatrix)[[2]] - letters[1:dim(fake)[2]]
 
 # separate the first two columns from the remaining columns for simplicity
 mymatrix12 - mymatrix[, 1:2]
 mymatrix3plus - mymatrix[, -(1:2)]
 # create variables for the dimensions for easy reference later
 nrows - dim(mymatrix3plus)[1]
 ncols - dim(mymatrix3plus)[2]
 
 # to make sure that the min and max contain all of the data
 # use floor(100*...)/100 and ceiling(100*...)/100 instead of round(..., 2) 
 datalim - c(floor(100*min(mymatrix3plus)), 
 ceiling(100*max(mymatrix3plus)))/100
 # choose two colors to be the end points
 colorlim - c(yellow, red)
 # create a sequence of 10 colors across the selected range for the legend
 lut - color.scale(seq(datalim[1], datalim[2], length=10), 
 extremes=colorlim, xrange=datalim)
 # it's not clear from the help file, but the extremes= argument wants a 
 range (a vector of length 2)
 mycolors - array(color.scale(mymatrix3plus, extremes=colorlim, 
 xrange=datalim), dim=dim(mymatrix3plus))
 ycenter - seq(from=0, to=1, length=(nrows + 2))
 yheight - 1/(nrows + 2)
 
 # Plot the color key on the lower part
 ColorBar(lut=lut, min=datalim[1], max=datalim[2])
 
 # Plot the actual heatmap
 par(new=TRUE)
 # can't use title for main= argument, because title only exists inside the 
 ColorBar() function
 plot(c(mymatrix12[1, 1], mymatrix12[nrows, 2]), c(0, 1), col=White, 
 xlab=, ylab=, main=SOMETHING, axes=F)
 for(i in 1:ncols){
  RectPlotter(mymatrix12, ycenter[nrows - i + 2], yheight, mycolors[, i])
  text(mymatrix12[1,1], ycenter[nrows - i + 2], 
 colnames(mymatrix3plus)[i], pos=4)
 }
 
 
 
 On Wed, Jan 8, 2014 at 3:59 PM, Pachapep pacha...@gmail.com wrote:
 
 Hi Jean,
 Thanks for the great help. Indeed, it seems that that helps a bit. However, 
 I included a ‘control’ column made of ones.
 
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
 runif(6, 0, 2), runif(6, 0, 2), runif(6, 0, 2))
 
 However, the color doesn’t correspond to that in the key (it is red-ish in 
 the plot while the 1 corresponds to yellow-ish in the key), so I’m not sure 
 whether it is the key or the colors that are messed up. Sorry for all these 
 questions.. and thanks (again) for the help provided.
 
 
 
 
 
 
 
 On Jan 8, 2014, at 16:15, Adams, Jean jvad...@usgs.gov wrote:
 
 Patrick,
 
 Thanks for providing reproducible code!
 
 I think the main problem was that the extremes= argument in the 
 color.scale() function wants a range (a vector of length 2), and you were 
 providing with more than that, length(lut) is 10.
 
 In the process of tracking this down, I made a bunch of minor changes to 
 your code to help me see what was going on.  This is what I ended up with.
 
 Jean
 
 
 
 # fake data
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
 runif(6, 0, 2), runif(6, 0, 2), runif(6, 0, 2))
 mymatrix - fake
 dimnames(mymatrix)[[2]] - letters[1:5]
 
 # separate the first two columns from the remaining columns for simplicity
 mymatrix12 - mymatrix[, 1:2]
 mymatrix3plus - mymatrix[, -(1:2)]
 # create variables for the dimensions for easy reference later
 nrows - dim(mymatrix3plus)[1]
 ncols - dim(mymatrix3plus)[2]
 
 # prepare plotting parameters
 lut - rev(heat.colors(10))
 # to make sure that the min and max contain all of the data
 # use floor(100*...)/100 and ceiling(100*...)/100 instead of round(..., 2) 
 minimum - floor(100*min(mymatrix3plus))/100
 maximum - ceiling(100*max(mymatrix3plus))/100
 # it's not clear from the help file, but the extremes= argument wants a 
 range (a vector of length 2)
 mycolors - color.scale(mymatrix3plus, extremes=lut[c(1, length(lut))])
 ycenter - seq(from=0, to=1, length=(nrows + 2))
 yheight - 1/(nrows + 2)
 
 # Plot the color key on the lower part
 ColorBar(lut=lut, min=minimum, max=maximum)
 
 # Plot the actual heatmap
 par(new=TRUE)
 # can't use title for main= argument, because title only exists inside the 
 ColorBar() function
 plot(c(mymatrix12[1, 1], mymatrix12[nrows, 

Re: [R] How do you transform a dataframe to a corpus?

2014-01-10 Thread arun
HI,
I couldn't reproduce the error.

complaints - data.frame(text=c(Do your homework, Provide reproducible 
example,Read the R-help manual))
library(tm)
myCorpus - Corpus(VectorSource(as.character(complaints$text)))
myCorpus
#A corpus with 3 text documents
A.K.



On Friday, January 10, 2014 10:57 AM, ramoss ramine.mossad...@finra.org wrote:
Hi;

I have a data frame complains w/ dimensions 1133529    1 ( 1.13m obs 1 col)
I am trying to transform it into a corpus
using the following code: myCorpus -Corpus(VectorSource(complaints$text))
Error in .Source(readPlain, encoding, length(x), FALSE, names(x), 0, TRUE, 
: 
  vectorized sources must have positive length
Does anybody understand the error message?


Thanks



--
View this message in context: 
http://r.789695.n4.nabble.com/How-do-you-transform-a-dataframe-to-a-corpus-tp4683396.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] Time Series STL

2014-01-10 Thread Thomas Barningham
Hi,

I'm relatively new to R and need to some help in converting some of my data
into a ts object that can then be used to run an STL analysis.

My initial input file is a .csv output from some atmospheric measurement
instruments. The first column is the year fraction and extends over 2 years
with a new data point being collected roughly every 2 minutes. Lots of data
are recorded in the subsequent columns (such as met info) and
concentrations of particular atmospheric species (which I want to run STL
on).

Here's my initial code:

*#Read in file as an object, defined BHD from original file*
*BHD - read.csv(C:/Work/PhD/R_Directory/BHD_2009_2012_all_samp_cal.csv,
header=T, dec=., sep=,)*


*#Define Columns from original files (comment out if using IDL output)*
*yearfrac - BHD[,1]*
*APO - BHD[,30]*
*O2 - BHD [,29]*
*CO2 - BHD[,28]*

(end of code)

What I want to do is take the objects defined above (APO, CO2, O2) and
perform stl analyses on them, but I need to convert them to time series
objects first based on the information in the yearfrac object.

How do I go about this?!

Thanks in advance
Barney

-- 
Thomas Barningham
Centre for Ocean and Atmospheric Sciences
School of Environmental Sciences
University of East Anglia
Norwich Research Park
Norwich
NR4 7TJ

[[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] Levelplots with non-continuous x-axis breaks

2014-01-10 Thread Pachapep

ok, I think I got it. Here is the code I used. Thanks for the help guys..


fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
c(-10,-10,-10,-10,-10,-10), c(10,10,10,10,10,10), runif(6, 0, 2), runif(6, 0, 
2))
datalim - c(-0,10)
matrix3plus  - fake[,-(1:2)]
dimnames(fake)[[2]] - letters[1:dim(fake)[2]]
rbPal - colorRampPalette(c('blue', 'white','red'))
gradcol - rbPal(100)
mycolors - cbind(fake[,1:2], array(rbPal(100)[as.numeric(cut(matrix3plus, 
breaks=100))], dim=dim(matrix3plus)))

# Plot the color key on the lower part
ColorBar(lut=gradcol, min=datalim[1], max=datalim[2])
par(new=TRUE)  
plot(c(fake[1,1],fake[length(fake[,1]),2]), c(0,1), col=White, xlab=, 
ylab=, main=title, axes=F)

yheight - 1/length(ycenter)
ycenter - seq(from=0, to=1, length=(length[fake[1,]]))
trackheight - ycenter[2]
for(i in 3:length(fake[1,])){  
  RectPlotter(matrixval=fake[,c(1,2,i)], 
ycoord=ycenter[length(ycenter)-i+2-emptylines], trackheight=ycenter[2], 
mycolors=mycolors[,i])
  text(fake[1,1], ycenter[length(ycenter)-i+2-emptylines], colnames(fake)[i], 
cex=cexsize, pos=4)
}



On Jan 10, 2014, at 15:47, Pachapep pacha...@gmail.com wrote:

 Sorry for bugging you again. I was wondering whether it is possible to 
 include multiple different colors instead of just two. 
 In the example below, the color.scale() function goes from yellow to red, but 
 never passes through plain white. Would it be possible to tweak the function 
 or would I have to start all over again?
 Thanks for any tips.
 patrick
 
 On Jan 9, 2014, at 7:54, Pachapep pacha...@gmail.com wrote:
 
 
 Great, it works perfectly! Thanks so much for the awesome help!
 (Happy) patrick
 
 On Jan 9, 2014, at 7:07, Adams, Jean jvad...@usgs.gov wrote:
 
 Patrick,
 
 No error in your code, just two different ways of deriving a range of 
 colors ... heat.colors() and color.scale().  I modified the code to just 
 use color.scale().  You can tell it what two colors you want it to use for 
 the extremes, and it will work out the shades in between.
 
 Jean
 
 
 
 # fake data
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
 runif(6, 0, 2), runif(6, 0, 2))
 
 mymatrix - fake
 dimnames(mymatrix)[[2]] - letters[1:dim(fake)[2]]
 
 # separate the first two columns from the remaining columns for simplicity
 mymatrix12 - mymatrix[, 1:2]
 mymatrix3plus - mymatrix[, -(1:2)]
 # create variables for the dimensions for easy reference later
 nrows - dim(mymatrix3plus)[1]
 ncols - dim(mymatrix3plus)[2]
 
 # to make sure that the min and max contain all of the data
 # use floor(100*...)/100 and ceiling(100*...)/100 instead of round(..., 2) 
 datalim - c(floor(100*min(mymatrix3plus)), 
 ceiling(100*max(mymatrix3plus)))/100
 # choose two colors to be the end points
 colorlim - c(yellow, red)
 # create a sequence of 10 colors across the selected range for the legend
 lut - color.scale(seq(datalim[1], datalim[2], length=10), 
 extremes=colorlim, xrange=datalim)
 # it's not clear from the help file, but the extremes= argument wants a 
 range (a vector of length 2)
 mycolors - array(color.scale(mymatrix3plus, extremes=colorlim, 
 xrange=datalim), dim=dim(mymatrix3plus))
 ycenter - seq(from=0, to=1, length=(nrows + 2))
 yheight - 1/(nrows + 2)
 
 # Plot the color key on the lower part
 ColorBar(lut=lut, min=datalim[1], max=datalim[2])
 
 # Plot the actual heatmap
 par(new=TRUE)
 # can't use title for main= argument, because title only exists inside the 
 ColorBar() function
 plot(c(mymatrix12[1, 1], mymatrix12[nrows, 2]), c(0, 1), col=White, 
 xlab=, ylab=, main=SOMETHING, axes=F)
 for(i in 1:ncols){
 RectPlotter(mymatrix12, ycenter[nrows - i + 2], yheight, mycolors[, i])
 text(mymatrix12[1,1], ycenter[nrows - i + 2], 
 colnames(mymatrix3plus)[i], pos=4)
 }
 
 
 
 On Wed, Jan 8, 2014 at 3:59 PM, Pachapep pacha...@gmail.com wrote:
 
 Hi Jean,
 Thanks for the great help. Indeed, it seems that that helps a bit. However, 
 I included a ‘control’ column made of ones.
 
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
 runif(6, 0, 2), runif(6, 0, 2), runif(6, 0, 2))
 
 However, the color doesn’t correspond to that in the key (it is red-ish in 
 the plot while the 1 corresponds to yellow-ish in the key), so I’m not sure 
 whether it is the key or the colors that are messed up. Sorry for all these 
 questions.. and thanks (again) for the help provided.
 
 
 
 
 
 
 
 On Jan 8, 2014, at 16:15, Adams, Jean jvad...@usgs.gov wrote:
 
 Patrick,
 
 Thanks for providing reproducible code!
 
 I think the main problem was that the extremes= argument in the 
 color.scale() function wants a range (a vector of length 2), and you were 
 providing with more than that, length(lut) is 10.
 
 In the process of tracking this down, I made a bunch of minor changes to 
 your code to help me see what was going on.  This is what I ended up with.
 
 Jean
 
 
 
 # fake data
 fake  - cbind(c(1,2,5,8,12,19), c(2,5,8,12,19,20), c(1,1,1,1,1,1), 
 runif(6, 0, 2), 

Re: [R] embedd fonts in pdf generated by R

2014-01-10 Thread Yixuan Qiu
Hi Adel,
You may have a look at the *showtext *package (on CRAN and
https://github.com/yixuan/showtext), which could convert text into lines
and curves in the pdf file, so it doesn't rely on those fonts after the
file is created.


Best,
Yixuan


2014/1/10 Adel ESSAFI adeless...@gmail.com

 Hello list
 I generated pdf files with R that I integrated
 in .tex file and compiled with pdflatex.

 however, all the fonts of my R figure not embadded. so the file is rejected
 from EDAS web site.

 Could you help please.


 [adel@localhost hcw]$  pdffonts hcw.pdf
 name type  encoding emb
 sub uni object ID
  -  ---
 --- --- -
 ZIMYVR+NimbusRomNo9L-MediType 1Custom   yes
 yes no   7  0
 EYECKV+NimbusRomNo9L-ReguType 1Custom   yes
 yes no   8  0
 WKYGSZ+CMSY8 Type 1Builtin  yes
 yes no   9  0
 TEABSF+NimbusRomNo9L-ReguItalType 1Custom   yes
 yes no  10  0
 MPLOPB+NimbusRomNo9L-MediItalType 1Custom   yes
 yes no  11  0
 XSKVTD+CMMI10Type 1Builtin  yes
 yes no  19  0
 NKXZUI+CMSY10Type 1Builtin  yes
 yes no  20  0
 PVJEEI+CMR10 Type 1Builtin  yes
 yes no  21  0
 TEORRU+CMR7  Type 1Builtin  yes
 yes no  22  0
 NGESNP+CMMI7 Type 1Builtin  yes
 yes no  23  0
 ZDXXKY+CMMI5 Type 1Builtin  yes
 yes no  24  0
 VGZAHY+CMR5  Type 1Builtin  yes
 yes no  25  0
 NOPBSI+CMSY5 Type 1Builtin  yes
 yes no  26  0
 ZYGQZM+CMMI6 Type 1Builtin  yes
 yes no  27  0
 QRZPBZ+CMMI8 Type 1Builtin  yes
 yes no  28  0
 TZYURE+MSBM10Type 1Builtin  yes
 yes no  29  0
 HIBZGW+Times-Roman   Type 1C   WinAnsi  yes
 yes no  37  0
 QLAAJV+CMSY7 Type 1Builtin  yes
 yes no  46  0
 RMTRPB+CMEX10Type 1Builtin  yes
 yes no  47  0
 BNPUIJ+Courier   Type 1C   WinAnsi  yes
 yes no  60  0
 GZSZHC+Times-Roman   Type 1C   WinAnsi  yes
 yes no  61  0
 QBHKPM+Times-Roman   Type 1C   WinAnsi  yes
 yes no  70  0
 Symbol   Type 1Custom   no
 no  no  81  0
 ZapfDingbats Type 1Custom   no
 no  yes 82  0
 HelveticaType 1Standard no
 no  no  83  0



 --
 PhD candidate in Computer Science
 Address
 3 avenue lamine, cité ezzahra, Sousse 4000
 Tunisia
 tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
 fax: +216 71 391 166

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




-- 
Yixuan Qiu yixuan@cos.name
Department of Statistics,
Purdue University

[[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] Problem with barplot

2014-01-10 Thread Clemence Germaine
Hi

I’m using bar plot function
And I have in my data some zero, but my data are numerics and when i try to use 
bar plot i have a warning message of « NA was introduced during the automatic 
conversion » and i can’t see my bar plot.

So if somebody have an idea for that?

Thanks

clémence
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Find the package of a class given classname

2014-01-10 Thread Yuan Luo
How to find the package of a class given classname?
For example, there is a class called GAlignments, I want to do something
like
attr(GAlignments, package) that gives you the package where the class
is defined? But of course, attr(GAlignments, package) won't work...

Thanks for any help!
Yuan

[[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] Fwd: Need to delete my messages in Nabble

2014-01-10 Thread srinivasa babu
Hi,

I deleted my account. I need to delete all of  messages started by me in
here

https://stat.ethz.ch/pipermail/r-help/2009-December/221628.html

http://comments.gmane.org/gmane.comp.lang.r.general/172827

Can you please guide how to do so?

thanks,
Sri.

[[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] Fwd: Need to delete my messages in Nabble

2014-01-10 Thread Rolf Turner

On 11/01/14 16:54, srinivasa babu wrote:

Hi,

I deleted my account. I need to delete all of  messages started by me in
here

https://stat.ethz.ch/pipermail/r-help/2009-December/221628.html

http://comments.gmane.org/gmane.comp.lang.r.general/172827

Can you please guide how to do so?


You can't.  Nor should you.  It would be unethical. Think before you 
post, because once you've posted, that's it.  The moving finger writes, 
and having writ/Moves on, nor all thy piety nor wit/Shall lure it back 
to cancel half a line/Nor all thy tears wash out a word of it.


cheers,

Rolf Turner

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


Re: [R] Find the package of a class given classname

2014-01-10 Thread Bert Gunter
This probably doesn't answer your question, but, amazingly enough, try
googling the class name.
It worked for GAlignmnets.

Incidentally, there's no reason class names have to be unique among R
packages.. And they can be hidden in namespaces.

Cheers,
Bert


Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Fri, Jan 10, 2014 at 6:49 PM, Yuan Luo yuan.hypnos@gmail.com wrote:
 How to find the package of a class given classname?
 For example, there is a class called GAlignments, I want to do something
 like
 attr(GAlignments, package) that gives you the package where the class
 is defined? But of course, attr(GAlignments, package) won't work...

 Thanks for any help!
 Yuan

 [[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] Find the package of a class given classname

2014-01-10 Thread Hervé Pagès

Hi Yuan,

On 01/10/2014 06:49 PM, Yuan Luo wrote:

How to find the package of a class given classname?
For example, there is a class called GAlignments, I want to do something
like
attr(GAlignments, package) that gives you the package where the class
is defined? But of course, attr(GAlignments, package) won't work...


You didn't say whether you wanted to be able to do this
programmatically.

If that's the case maybe you're lucky and the package where the class
is defined is already attached to your session. In that case:


   attr(class(new(GAlignments)), package)
  [1] GenomicRanges

Otherwise, if the package in question is installed but not attached
you can still do:

  ??`GAlignments-class`

If the package is not installed but you have a vague idea that this
could be a Bioconductor container, then search the bioconductor
mailing list:

  http://bioconductor.org/help/mailing-list/

If that still doesn't give you the answer, then you're welcome to ask
on the list.

Cheers,
H.

PS: If you're using the current devel version of BioC (requires R devel)
the GAlignments class has moved to the new GenomicAlignments package.



Thanks for any help!
Yuan

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



--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 do you transform a dataframe to a corpus?

2014-01-10 Thread Jeff Newmiller
Not much. Columns are not normally measured in bytes.
---
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
--- 
Sent from my phone. Please excuse my brevity.

ramoss ramine.mossad...@finra.org wrote:
The column length is 4000 bytes long if that helps.



--
View this message in context:
http://r.789695.n4.nabble.com/How-do-you-transform-a-dataframe-to-a-corpus-tp4683396p4683402.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] Time Series STL

2014-01-10 Thread Jeff Newmiller
This might not seem helpful, but there really is a communication gap here. You 
need to read the Posting Guide, post in plain text so your example code is not 
mangled by the HTML, and include a bit of data that is representative of the 
data you are working with. You may find some helpful advice here: 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example,
 including how to use the dput function.
---
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
--- 
Sent from my phone. Please excuse my brevity.

Thomas Barningham stbarning...@gmail.com wrote:
Hi,

I'm relatively new to R and need to some help in converting some of my
data
into a ts object that can then be used to run an STL analysis.

My initial input file is a .csv output from some atmospheric
measurement
instruments. The first column is the year fraction and extends over 2
years
with a new data point being collected roughly every 2 minutes. Lots of
data
are recorded in the subsequent columns (such as met info) and
concentrations of particular atmospheric species (which I want to run
STL
on).

Here's my initial code:

*#Read in file as an object, defined BHD from original file*
*BHD -
read.csv(C:/Work/PhD/R_Directory/BHD_2009_2012_all_samp_cal.csv,
header=T, dec=., sep=,)*


*#Define Columns from original files (comment out if using IDL output)*
*yearfrac - BHD[,1]*
*APO - BHD[,30]*
*O2 - BHD [,29]*
*CO2 - BHD[,28]*

(end of code)

What I want to do is take the objects defined above (APO, CO2, O2) and
perform stl analyses on them, but I need to convert them to time series
objects first based on the information in the yearfrac object.

How do I go about this?!

Thanks in advance
Barney

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