Re: [R] [Rd] source(echo = TRUE) with a iso-8859-1 encoded file gives an error

2018-05-04 Thread Ista Zahn
On Fri, May 4, 2018 at 4:47 PM, Scott Kostyshak  wrote:
> I have very little knowledge about file encodings and would like to
> learn more.
>
> I've read the following pages to learn more:
>
>   http://stat.ethz.ch/R-manual/R-devel/library/base/html/Encoding.html
>   
> https://stackoverflow.com/questions/4806823/how-to-detect-the-right-encoding-for-read-csv
>   https://developer.r-project.org/Encodings_and_R.html
>
> The last one, in particular, has been very helpful. I would be
> interested in any further references that you suggest.
>
> I attach a file that reproduces the issue I would like to learn more
> about. I do not know if the file encoding will be correctly preserved
> through email, so I also provide the file (temporarily) on Dropbox here:
>
>   https://www.dropbox.com/s/3lbgebk7b5uaia7/encoding_export_issue.R?dl=0
>
> The file gives an error when using "source()" with the
> argument echo = TRUE:
>
>   > source("encoding_export_issue.R", echo = TRUE)
>   Error in nchar(dep, "c") : invalid multibyte string, element 1
>   In addition: Warning message:
>   In grepl("^[[:blank:]]*$", dep[1L]) :
> input string 1 is invalid in this locale
>
> The problem comes from the "á" character in the .R file. The file
> appears to be encoded as "iso-8859-1":
>
>   $ file --mime-encoding encoding_export_issue.R
>   encoding_export_issue.R: iso-8859-1
>
> Note that for me:
>
>   > getOption("encoding")
>   [1] "native.enc"
>
> so "native.enc" is used for the "encoding" argument of source().
>
> The following two calls succeed:
>
>   > source("encoding_export_issue.R", echo = TRUE, encoding = "unknown")
>   > source("encoding_export_issue.R", echo = TRUE, encoding = "iso-8859-1")
>
> Is this file a valid "iso-8859-1" encoded file?

The one you attached is not. The one linked to in dropbox is.

 Why does source() fail
> in the case of encoding set to "native.enc"? Is it because of the
> settings to UTF-8 in my locale (see info on my system at the bottom of
> this email).

Yes.

>
> I'm guessing it would be a bad idea to put
>
>   options(encoding = "unknown")
>
> in my .Rprofile, because it is difficult to always correctly guess the
> encoding of files?

My guess is that the issue is less about the difficulty of guessing
the encoding, and more about the time it takes to do so. That's not
particularly relevant for the "source" function, but the encoding
option is used by many of the file IO functions in R and so has
implications well beyond the behavior of "source".

 Is there a reason why setting it to "unknown" would
> lead to more problems than leaving it set to "native.enc"?

It depends on what you are actually doing. If you are on a UTF-8
locale and working exclusively with UTF-8 files, setting
options(encoding = "unknown") will just slow down your file IO by
checking for the encoding every time.
>
> I've reproduced the above behavior on R-devel (r74677) and 3.4.3. Below
> is my session info and locale info for my system with the 3.4.3 version:
>
>> sessionInfo()
> R version 3.4.3 (2017-11-30)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04.3 LTS
>
> Matrix products: default
> BLAS: /usr/lib/libblas/libblas.so.3.6.0
> LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8   LC_NAME=C
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_3.4.3
>
>> Sys.getlocale()
> [1] 
> "LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"
>
> Thanks for your time,
>
> Scott
>
> P.S. Note that I had posted this question to r-devel, which was the
> incorrect choice. For archival purposes, I reference the thread here:
>
> https://www.mail-archive.com/search?l=mid=20180501185750.445oub53vcdnyyyx%40steph
>
>
> --
> Scott Kostyshak
> Assistant Professor of Economics
> University of Florida
> https://people.clas.ufl.edu/skostyshak/
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, 

Re: [R] Discovering patterns in textual strings

2018-05-04 Thread Bert Gunter
The answer is, of course, using regular expressions and/or libraries
therefor. However, I do not think you have defined your problem
sufficiently. Some questions I have:

1. Do possible patterns to be matched always appear at the beginning
of your strings?

2. Always together between specified separators ("_"  in your
example); or one of several specified separators; or otherwise?

3. Do spaces or other nonprinting characters occur in your strings?

e.g. would

abc_something
this.is_a long stringwithabcinthemiddle

be considered matching?
There are undoubtedly other possibilities that I've missed.

You may also find it useful to check this "task view" out for possibilities:
https://cran.r-project.org/web/views/NaturalLanguageProcessing.html

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, May 4, 2018 at 3:25 PM, Jeff Reichman  wrote:
> R Help Forum
>
>
>
> Is there a R library (or a way) that I can extract unique character strings,
> or repeating patterns in textual strings.  Say for example I have the
> following records:
>
>
>
> Abc_1234_kjhksh_276
>
> Abc
>
> Abc_1234_lakdofyo_324
>
> Bce_876_skdhk_*&^%*&
>
> Bce
>
> Bce_454
>
>
>
> And I would like to see the following results
>
> Abc
>
> Abc_1234
>
> Bce
>
>
>
>
>
> Jeff Reichman
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] Discovering patterns in textual strings

2018-05-04 Thread Jeff Reichman
R Help Forum

 

Is there a R library (or a way) that I can extract unique character strings,
or repeating patterns in textual strings.  Say for example I have the
following records:

 

Abc_1234_kjhksh_276

Abc

Abc_1234_lakdofyo_324

Bce_876_skdhk_*&^%*&

Bce

Bce_454

 

And I would like to see the following results

Abc

Abc_1234

Bce

 

 

Jeff Reichman


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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] [Rd] source(echo = TRUE) with a iso-8859-1 encoded file gives an error

2018-05-04 Thread Scott Kostyshak
I have very little knowledge about file encodings and would like to
learn more.

I've read the following pages to learn more:

  http://stat.ethz.ch/R-manual/R-devel/library/base/html/Encoding.html
  
https://stackoverflow.com/questions/4806823/how-to-detect-the-right-encoding-for-read-csv
  https://developer.r-project.org/Encodings_and_R.html

The last one, in particular, has been very helpful. I would be
interested in any further references that you suggest.

I attach a file that reproduces the issue I would like to learn more
about. I do not know if the file encoding will be correctly preserved
through email, so I also provide the file (temporarily) on Dropbox here:

  https://www.dropbox.com/s/3lbgebk7b5uaia7/encoding_export_issue.R?dl=0

The file gives an error when using "source()" with the
argument echo = TRUE:

  > source("encoding_export_issue.R", echo = TRUE)
  Error in nchar(dep, "c") : invalid multibyte string, element 1
  In addition: Warning message:
  In grepl("^[[:blank:]]*$", dep[1L]) :
input string 1 is invalid in this locale

The problem comes from the "á" character in the .R file. The file
appears to be encoded as "iso-8859-1":

  $ file --mime-encoding encoding_export_issue.R 
  encoding_export_issue.R: iso-8859-1

Note that for me:

  > getOption("encoding")
  [1] "native.enc"

so "native.enc" is used for the "encoding" argument of source().

The following two calls succeed:

  > source("encoding_export_issue.R", echo = TRUE, encoding = "unknown")
  > source("encoding_export_issue.R", echo = TRUE, encoding = "iso-8859-1")

Is this file a valid "iso-8859-1" encoded file?  Why does source() fail
in the case of encoding set to "native.enc"? Is it because of the
settings to UTF-8 in my locale (see info on my system at the bottom of
this email).

I'm guessing it would be a bad idea to put

  options(encoding = "unknown")

in my .Rprofile, because it is difficult to always correctly guess the
encoding of files? Is there a reason why setting it to "unknown" would
lead to more problems than leaving it set to "native.enc"?

I've reproduced the above behavior on R-devel (r74677) and 3.4.3. Below
is my session info and locale info for my system with the 3.4.3 version:

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

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

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

loaded via a namespace (and not attached):
[1] compiler_3.4.3

> Sys.getlocale()
[1] 
"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C"

Thanks for your time,

Scott

P.S. Note that I had posted this question to r-devel, which was the
incorrect choice. For archival purposes, I reference the thread here:

https://www.mail-archive.com/search?l=mid=20180501185750.445oub53vcdnyyyx%40steph


-- 
Scott Kostyshak
Assistant Professor of Economics
University of Florida
https://people.clas.ufl.edu/skostyshak/

# Ch?vez
quantile_type <- 4

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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-es] Codificación redes neuronales, reconocimiento patrón, otras

2018-05-04 Thread Javier Marcuzzi
Estimados

Estoy pensando en una forma para acomodar datos, estos son una sola o más
de una palabra, la única palabra o asociación de estas tiene un
significado, no estaba pensando en un análisis en particular, pero sí en
algo que pueda ser procesado por redes neuronales reconociendo ciertos
patrones, pero que permita un análisis bajo otras técnicas, posiblemente en
un ejemplo se comprenda mejor.

Supongamos unas palabras como

Azul

Rojo

Verde

Amarillo

Auto

Bicicleta

Ferrari

Semáforo

Color

Vehículo



Ahora supongamos tres columnas, la cuarta es el significado, y puede haber
columnas vacías

Azul   |  |
= Color y azul

Rojo  |Verde |Amarillo=
Semáforo y color

Semáforo   |  |
= Semáforo

Auto | |
= Vehículo y auto (no bici)

Auto |Rojo|
= Ferrari  * pero también vehículo

Auto |Rojo|Vehículo   =
Vehículo * , auto, color y ferrari



Por ejemplo, está claro que los compradores de autos Ferrari posiblemente
tengan un gusto asociado al color rojo. Ese puede ser un análisis

Pero si yo quiero reconocer lo que hay según el patrón de palabras, tipo
ejemplos de redes neuronales, en el último ejemplo con tres palabras tengo
cuatro posibilidades (auto, rojo, vehículo) => vehículo, auto, color,
Ferrari, pero en el ejemplo dos (Rojo, Verde, Amarillo) => semáforo, como
color, pero el reconocimiento importante es casi únicamente semáforo.

Hay ejemplos donde se buscan patrones en una foto y se reconocen objetos,
pero en un esquema como el que describo, donde el resultado que puede ser
más de uno, también está en la entrada, esta entrada en el ejemplo son tres
columnas, pero todas tienen palabras que están en una sola lista.

¿Alguna sugerencia o ejemplo? En otras palabras, yo podría realizar una
tabla pero hay formas que quedaría afuera, porque auto, rojo, vehículo no
se me ocurriría, salvo que piense en un análisis posterior donde analizo
bicicletas rojas vs autos rojos, o pelota roja donde una pelota no es
vehículo pero en la playa por ahí prefieren las rojas o amarillas antes de
las azules. Entonces posiblemente hay una forma de codificar para luego
poder hacer análisis no pensados al momento de codificar los datos. Esta
segunda parte estaría contemplada al colocar columnas, pero se me crean
dudas para las redes neuronales.

Desde ya muchas gracias

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-04 Thread MacQueen, Don
But:

> dev.new(height=10,width=10)
> dev.size('in')
[1] 10 10

Whereas

> dev.new(length=10,width=10)
> dev.size('in')
[1] 10  7

Obviously, because height was not specified, some default calculation was used 
to set the height. And length was ignored.

And thanks to Duncan Murdoch for pointing out that the correct arguments are 
height and width, not length and width.

And, yes, please send plain text email to R-help. Sending HTML email reduces 
the likelihood anyone will actually read your email.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 5/3/18, 6:28 PM, "R-help on behalf of sunyeping via R-help" 
 wrote:

When I check the size of the plot region usingdev.size("in")a new plot 
region is produced and in the Rconsole I get[1] 5.33 5.322917If I mean to 
produce a plot region with size setting bydev.new(length=3,width=3)a plot 
region is produced, but the size is [2.281250, 5.322917], as detected by the 
de.size function. If I type:dev.new(length=10,width=10)I get a plot region of 
with the size of [7.614583, 5.322917]. It seems that the width of the new plot 
region cannot be set, and tt is always 5.322917. The length of the new plot 
region can be set, but it is always smaller that the values I set.What do I 
miss? What is the correct way of setting the dimension of the new plot region? 
I will be grateful to any help.Best regards,

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-04 Thread Rui Barradas

Hello,

Is this cross posted from StackOverflow?

https://stackoverflow.com/questions/50127476/it-there-a-up-limit-for-the-size-of-the-plot-region-produced-by-the-dev-new-func

Cross posting is discouraged by r-help. See the posting guide regarding 
this.


The question is not exactly the same, though.


Hope this helps,

Rui Barradas

On 5/4/2018 5:26 PM, David Winsemius wrote:



On May 4, 2018, at 12:04 AM, sunyeping  wrote:


--
From:David Winsemius 
Send Time:2018 May 4 (Fri) 13:25
To:孙业平 
Cc:R Help Mailing List 
Subject:Re: [R] why the length and width of a plot region produced by the 
dev.new() function cannot be correctly set?



On May 3, 2018, at 6:28 PM, sunyeping via R-help  wrote:

When I check the size of the plot region usingdev.size("in")a new plot region 
is produced and in the Rconsole I get[1] 5.33 5.322917


Your test is all mangleed together. You failed in your duty to read the list 
info and the Posting guide . NO HTML!


If I mean to produce a plot region with size setting 
bydev.new(length=3,width=3)a plot region is produced, but the size is 
[2.281250, 5.322917], as detected by the de.size function. If I 
type:dev.new(length=10,width=10)I get a plot region of with the size of 
[7.614583, 5.322917]. It seems that the width of the new plot region cannot be 
set, and tt is always 5.322917. The length of the new plot region can be set, 
but it is always smaller that the values I set.What do I miss? What is the 
correct way of setting the dimension of the new plot region? I will be grateful 
to any help.Best regards,


The size of the device is not the size of the plot region. You need to take 
into account the margins. See ?par

Thank you, David.
I have read the par() document. Clearly the size of the plot region is smaller than or 
equal to the divice size. However, if I produce a graphic device with dev.new (length, 
width) or other functions, I find the largest  width of the new device is always 5.3 
inches whatever the values I set, and the length of it is alway smaller than what I set. 
Could you tell me how to produce a graphic divice with correct size that I set? I need 
this function because the graphic divice cannot accomendate all of the graph I make with 
some of plot tools such as ggtree. In ggtree plot, part of the tree tips label are 
invisible (https://www.dropbox.com/s/87gyusx7ay1xxu8/tree.pdf?dl=0) even I set 
"par(mar=rep(0,4))". So I think I must plot the tree on a larger graphic device.


- The argument to give dev.new is 'height', not 'length'.

- There are two margins, an inner margin (controlled by `mar`) and an outer 
margin (controlled by `oma`).

- The link to the dropbox image does demonstrate that you are having problems 
with your ggplot efforts, but it wasn't a link to any test data or the code 
used to produce that tree, so I'm not in a position to do any testing to offer 
refinements. From the red/bold highlighting in the HTML copy I got directly 
(that none of the other viewers are seeing)  I can see you are frustrated, but 
you need to take responsibility for writing a message that is being mangled. We 
readers of the this plain-text-only mailing list were seeing it.

- Please read the Posting Guide about the need to information about your 
specific computer setup and the value of a reproducible example. I suggest you 
should be learning to use the png or pdf devices. Read ?Devices and ?png. (The 
default units are not inches.).



Best regards.




  [[alternative HTML version deleted]]


- It appears that your second message was also sent as HTML. I do therefore ask 
(again) that you take the time to read the Posting Guide.

\/\/\/\/A message that appears in every message sent from Rhelp's list server 
\/\/\/\/\/\/\

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

^^^

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regression model fitting

2018-05-04 Thread Bert Gunter
These is essentially a statistical question, which are generally
consider off topic here. So you may not get a satisfactory reply.

stats.stackexchange.com  is probably a better venue for your post.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, May 4, 2018 at 8:20 AM, Allaisone 1  wrote:
>
> Hi all ,
>
>
> I have a dataframe (Hypertension) with following headers :-
>
>
>> Hypertension
>
> ID   Hypertension(before drug A)  Hypertension(On drug A)On drug 
> B?  Healthy diet?
>
> 1160   90 
>   True  True
>
> 2190  140 
>  False False
>
> 3 170  
> 110 True  False
>
>
> I wanted to study whether patients on drug A + on drug B + on healthy diet 
> would have better
>
> blood pressure control (reduction) compared to patients with drug A but not 
> on drug B or not on healthy diet or not on both.
>
>
> I considered my outcome(y) variable to be hypertension measurements for all 
> patients
>
> on drug A (column 2).  Columns 1,3 and 4  are my explanatory(x) variables 
> variables(column 1 is just the baseline measurements to adjust for the effect 
> of drug A compared to the baseline) . So my regression formula using lm() 
> function in R is as follow :-
>
>
> Regression <- lm (formula= Hypertension(On drug A)~Hypertension(before drug 
> A) +
>
> (On drug B?*Healthy diet?))  , data = Hypertension)
>
>
> I expect that the result of "(On drug B?*Healthy diet?)" coefficient in the 
> model would give the correct answer to my question.
>
> Is this the best formula to answer my question or there would be better 
> methods ?.
>
>
> Regards
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Regression model fitting

2018-05-04 Thread Eivind K. Dovik

On Fri, 4 May 2018, Allaisone 1 wrote:



Hi all ,


I have a dataframe (Hypertension) with following headers :-



Hypertension


ID   Hypertension(before drug A)  Hypertension(On drug A)On drug B? 
 Healthy diet?

1160   90   
True  True

2190  140   
   False False

3 170  110  
   True  False


I wanted to study whether patients on drug A + on drug B + on healthy diet 
would have better

blood pressure control (reduction) compared to patients with drug A but not on 
drug B or not on healthy diet or not on both.


I considered my outcome(y) variable to be hypertension measurements for all 
patients

on drug A (column 2).  Columns 1,3 and 4  are my explanatory(x) variables 
variables(column 1 is just the baseline measurements to adjust for the effect 
of drug A compared to the baseline) . So my regression formula using lm() 
function in R is as follow :-


Regression <- lm (formula= Hypertension(On drug A)~Hypertension(before drug A) +

(On drug B?*Healthy diet?))  , data = Hypertension)


I expect that the result of "(On drug B?*Healthy diet?)" coefficient in the 
model would give the correct answer to my question.

Is this the best formula to answer my question or there would be better methods 
?.


Regards



Hi,

Could you provide R-code that generates your data.frame?

Eivind






[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-04 Thread David Winsemius

> On May 4, 2018, at 12:04 AM, sunyeping  wrote:
> 
> 
> --
> From:David Winsemius 
> Send Time:2018 May 4 (Fri) 13:25
> To:孙业平 
> Cc:R Help Mailing List 
> Subject:Re: [R] why the length and width of a plot region produced by the 
> dev.new() function cannot be correctly set?
> 
> 
> > On May 3, 2018, at 6:28 PM, sunyeping via R-help  
> > wrote:
> > 
> > When I check the size of the plot region usingdev.size("in")a new plot 
> > region is produced and in the Rconsole I get[1] 5.33 5.322917
> 
> Your test is all mangleed together. You failed in your duty to read the list 
> info and the Posting guide . NO HTML!
> 
> > If I mean to produce a plot region with size setting 
> > bydev.new(length=3,width=3)a plot region is produced, but the size is 
> > [2.281250, 5.322917], as detected by the de.size function. If I 
> > type:dev.new(length=10,width=10)I get a plot region of with the size of 
> > [7.614583, 5.322917]. It seems that the width of the new plot region cannot 
> > be set, and tt is always 5.322917. The length of the new plot region can be 
> > set, but it is always smaller that the values I set.What do I miss? What is 
> > the correct way of setting the dimension of the new plot region? I will be 
> > grateful to any help.Best regards,
> 
> The size of the device is not the size of the plot region. You need to take 
> into account the margins. See ?par
> 
> Thank you, David.
> I have read the par() document. Clearly the size of the plot region is 
> smaller than or equal to the divice size. However, if I produce a graphic 
> device with dev.new (length, width) or other functions, I find the largest  
> width of the new device is always 5.3 inches whatever the values I set, and 
> the length of it is alway smaller than what I set. Could you tell me how to 
> produce a graphic divice with correct size that I set? I need this function 
> because the graphic divice cannot accomendate all of the graph I make with 
> some of plot tools such as ggtree. In ggtree plot, part of the tree tips 
> label are invisible (https://www.dropbox.com/s/87gyusx7ay1xxu8/tree.pdf?dl=0) 
> even I set "par(mar=rep(0,4))". So I think I must plot the tree on a larger 
> graphic device.  

- The argument to give dev.new is 'height', not 'length'.

- There are two margins, an inner margin (controlled by `mar`) and an outer 
margin (controlled by `oma`). 

- The link to the dropbox image does demonstrate that you are having problems 
with your ggplot efforts, but it wasn't a link to any test data or the code 
used to produce that tree, so I'm not in a position to do any testing to offer 
refinements. From the red/bold highlighting in the HTML copy I got directly 
(that none of the other viewers are seeing)  I can see you are frustrated, but 
you need to take responsibility for writing a message that is being mangled. We 
readers of the this plain-text-only mailing list were seeing it. 

- Please read the Posting Guide about the need to information about your 
specific computer setup and the value of a reproducible example. I suggest you 
should be learning to use the png or pdf devices. Read ?Devices and ?png. (The 
default units are not inches.).


> Best regards. 
> 
> 
> > 
> >  [[alternative HTML version deleted]]

- It appears that your second message was also sent as HTML. I do therefore ask 
(again) that you take the time to read the Posting Guide.

\/\/\/\/A message that appears in every message sent from Rhelp's list server 
\/\/\/\/\/\/\
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
^^^

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

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


Re: [R] Converting a list to a data frame

2018-05-04 Thread Bill Poling
Oh, how funny, hence the term Novice usR. UGH!

Thank you Sir.

WHP



From: Kevin E. Thorpe [mailto:kevin.tho...@utoronto.ca]
Sent: Friday, May 04, 2018 9:08 AM
To: Bill Poling ; Huzefa Khalil 
Cc: R Help Mailing List 
Subject: Re: [R] Converting a list to a data frame

It looks like you made a copy/paste error below. Your ata.frame should
be data.frame.

Kevin

On 05/04/2018 08:18 AM, Bill Poling wrote:
> Good morning.
>
> Novice usR. Here.
>
> I am following this string, among many, learning as I go.
>
> Quick question please?
>
> I thought that perhaps ata.frame was part of the zoo pkg, b/c when I
> searched it came up in help?
>
> However, evidently not or I am not using it properly.
>
> Please advise, thank you.
>
> x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
>
> x2 <- do.call(rbind, lapply(names(x), function(z)
>
> ata.frame(type=z, dat[[z]])))
>
> #Error in ata.frame(type = z, dat[[z]]) : could not find function
> "ata.frame"
>
> ?ata.frame
>
> ??ata.frame #Looks like it's part of the zoo package?
>
> install.packages("zoo")
>
> #Typo: dat[[z]] should be x[[z]]:
>
> x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
>
> x2 <- do.call(rbind, lapply(names(x), function(z)
>
> ata.frame(type=z, x[[z]])))
>
> #Error in ata.frame(type = z, dat[[z]]) : still cannot find function
> "ata.frame"?
>
> *William H. Poling, Ph.D.*
>
> *From:* R-help [mailto:r-help-boun...@r-project.org] *On Behalf Of
> *Huzefa Khalil
> *Sent:* Wednesday, May 02, 2018 1:24 PM
> *To:* Kevin E. Thorpe 
> >
> *Cc:* R Help Mailing List >
> *Subject:* Re: [R] Converting a list to a data frame
>
> Hi Kevin,
>
> There is probably a better way, but it can be done in two steps like this
>
> temp <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
>
> temp <- lapply(names(temp), function(n, temp) {
> temp[[n]]$type <- n
> return(temp[[n]])
> }, temp = temp)
>
> do.call(rbind, temp)
>
>
>
> On Wed, May 2, 2018 at 1:11 PM, Kevin E. Thorpe
>  >>
> wrote:
>
> > I suspect this is pretty easy, but I'm having trouble figuring it out.
> > Basically, I have a list of data frames such as the following example:
> >
> > list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
> >
> > I would like to turn this into data frame where the list elements are
> > essentially rbind'ed together and the element name becomes a new
> variable.
> > For example, I would like to turn the list above into a data frame that
> > looks like this:
> >
> > data.frame(type=c("A","A","B","B"),x=c(1:2,5:6),y=c(3:4,7:8))
> >
> > Appreciate any pointers.
> >
> > Kevin
> >
> > --
> > Kevin E. Thorpe
> > Head of Biostatistics, Applied Health Research Centre (AHRC)
> > Li Ka Shing Knowledge Institute of St. Michael's Hospital
> > Assistant Professor, Dalla Lana School of Public Health
> > University of Toronto
> > email: kevin.tho...@utoronto.ca 
> > 
> Tel: 416.864.5776 Fax: 416.864.3016


--
Kevin E. Thorpe
Head of Biostatistics, Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's Hospital
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.tho...@utoronto.ca Tel: 
416.864.5776 Fax: 416.864.3016

Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}

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


Re: [R] Converting a list to a data frame

2018-05-04 Thread Bill Poling
Good morning.

Novice usR. Here.

I am following this string, among many, learning as I go.

Quick question please?

I thought that perhaps ata.frame was part of the zoo pkg, b/c when I searched 
it came up in help?

However, evidently not or I am not using it properly.

Please advise, thank you.
x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
x2 <- do.call(rbind, lapply(names(x), function(z)
ata.frame(type=z, dat[[z]])))
#Error in ata.frame(type = z, dat[[z]]) : could not find function "ata.frame"

?ata.frame
??ata.frame #Looks like it's part of the zoo package?
install.packages("zoo")

#Typo: dat[[z]] should be x[[z]]:

x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
x2 <- do.call(rbind, lapply(names(x), function(z)
ata.frame(type=z, x[[z]])))
#Error in ata.frame(type = z, dat[[z]]) : still cannot find function 
"ata.frame"?

William H. Poling, Ph.D.

From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Huzefa Khalil
Sent: Wednesday, May 02, 2018 1:24 PM
To: Kevin E. Thorpe 
Cc: R Help Mailing List 
Subject: Re: [R] Converting a list to a data frame

Hi Kevin,

There is probably a better way, but it can be done in two steps like this

temp <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))

temp <- lapply(names(temp), function(n, temp) {
temp[[n]]$type <- n
return(temp[[n]])
}, temp = temp)

do.call(rbind, temp)



On Wed, May 2, 2018 at 1:11 PM, Kevin E. Thorpe 
>
wrote:

> I suspect this is pretty easy, but I'm having trouble figuring it out.
> Basically, I have a list of data frames such as the following example:
>
> list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
>
> I would like to turn this into data frame where the list elements are
> essentially rbind'ed together and the element name becomes a new variable.
> For example, I would like to turn the list above into a data frame that
> looks like this:
>
> data.frame(type=c("A","A","B","B"),x=c(1:2,5:6),y=c(3:4,7:8))
>
> Appreciate any pointers.
>
> Kevin
>
> --
> Kevin E. Thorpe
> Head of Biostatistics, Applied Health Research Centre (AHRC)
> Li Ka Shing Knowledge Institute of St. Michael's Hospital
> Assistant Professor, Dalla Lana School of Public Health
> University of Toronto
> email: kevin.tho...@utoronto.ca Tel: 
> 416.864.5776 Fax: 416.864.3016
>
> __
> R-help@r-project.org mailing list -- To 
> UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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

Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
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 for Molecular Properties

2018-05-04 Thread Jeff Newmiller

On Thu, 3 May 2018, Bert Gunter wrote:


... In addition, you may wish to also post on the Bioconductor list
for this sort of thing.


... where "this sort of thing" is the original subject matter "molecular 
properties" rather than the sidebar about the sos package which is 
probably better discussed here.


FWIW I don't think the sos package will help you search Bioconductor.



-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, May 3, 2018 at 12:58 AM, Spencer Graves
 wrote:


library(sos)


(mp <- findFn('{molecular properties}'))


  ** found 7 matches in 4 packages and opened two web pages in my
default browser with (a) the 7 matches and (b) the 4 packages. The first
function was something for amino acids, like you suggested.  Two others
returned compound and substance information from PubChem.


  Does this help?
  Spencer



On 2018-05-02 19:17, bbb_...@verizon.net wrote:


All

Is there a package or library that will, given a nucleotide sequence

1. calculate the extinction coefficient at 260 nm for (Beer-Lambert's law)
2. calculate molecular weight
3. return it's complementary sequence

I was able to find several packages that can do similar calculations for
an amino acid sequence for proteins but none for nucleic acids.

Any pointers, etc. would be great.

thank you in advance
Indr

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

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


Re: [R] Converting a list to a data frame

2018-05-04 Thread Kevin E. Thorpe
It looks like you made a copy/paste error below. Your ata.frame should 
be data.frame.


Kevin

On 05/04/2018 08:18 AM, Bill Poling wrote:

Good morning.

Novice usR. Here.

I am following this string, among many, learning as I go.

Quick question please?

I thought that perhaps ata.frame was part of the zoo pkg, b/c when I 
searched it came up in help?


However, evidently not or I am not using it properly.

Please advise, thank you.

x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))

x2 <- do.call(rbind, lapply(names(x), function(z)

ata.frame(type=z, dat[[z]])))

#Error in ata.frame(type = z, dat[[z]]) : could not find function 
"ata.frame"


?ata.frame

??ata.frame #Looks like it’s part of the zoo package?

install.packages("zoo")

#Typo: dat[[z]] should be x[[z]]:

x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))

x2 <- do.call(rbind, lapply(names(x), function(z)

ata.frame(type=z, x[[z]])))

#Error in ata.frame(type = z, dat[[z]]) : still cannot find function 
"ata.frame"?


*William H. Poling, Ph.D.*

*From:* R-help [mailto:r-help-boun...@r-project.org] *On Behalf Of 
*Huzefa Khalil

*Sent:* Wednesday, May 02, 2018 1:24 PM
*To:* Kevin E. Thorpe 
*Cc:* R Help Mailing List 
*Subject:* Re: [R] Converting a list to a data frame

Hi Kevin,

There is probably a better way, but it can be done in two steps like this

temp <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))

temp <- lapply(names(temp), function(n, temp) {
temp[[n]]$type <- n
return(temp[[n]])
}, temp = temp)

do.call(rbind, temp)



On Wed, May 2, 2018 at 1:11 PM, Kevin E. Thorpe 
>

wrote:

 > I suspect this is pretty easy, but I'm having trouble figuring it out.
 > Basically, I have a list of data frames such as the following example:
 >
 > list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8))
 >
 > I would like to turn this into data frame where the list elements are
 > essentially rbind'ed together and the element name becomes a new 
variable.

 > For example, I would like to turn the list above into a data frame that
 > looks like this:
 >
 > data.frame(type=c("A","A","B","B"),x=c(1:2,5:6),y=c(3:4,7:8))
 >
 > Appreciate any pointers.
 >
 > Kevin
 >
 > --
 > Kevin E. Thorpe
 > Head of Biostatistics, Applied Health Research Centre (AHRC)
 > Li Ka Shing Knowledge Institute of St. Michael's Hospital
 > Assistant Professor, Dalla Lana School of Public Health
 > University of Toronto
 > email: kevin.tho...@utoronto.ca  
Tel: 416.864.5776 Fax: 416.864.3016



--
Kevin E. Thorpe
Head of Biostatistics,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's Hospital
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.3016

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


Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-04 Thread Duncan Murdoch

On 04/05/2018 3:04 AM, sunyeping via R-help wrote:


--From:David Winsemius 
Send Time:2018 May 4 (Fri) 13:25To:孙业平 
Cc:R Help Mailing List Subject:Re: [R] 
why the length and width of a plot region produced by the dev.new() function cannot be correctly 
set?


  On May 3, 2018, at 6:28 PM, sunyeping via R-help  wrote:
  
  When I check the size of the plot region usingdev.size("in")a new plot region is produced and in the Rconsole I get[1] 5.33 5.322917


Your test is all mangleed together. You failed in your duty to read the list 
info and the Posting guide . NO HTML!


  If I mean to produce a plot region with size setting 
bydev.new(length=3,width=3)a plot region is produced, but the size is 
[2.281250, 5.322917], as detected by the de.size function. If I 
type:dev.new(length=10,width=10)I get a plot region of with the size of 
[7.614583, 5.322917]. It seems that the width of the new plot region cannot be 
set, and tt is always 5.322917. The length of the new plot region can be set, 
but it is always smaller that the values I set.What do I miss? What is the 
correct way of setting the dimension of the new plot region? I will be grateful 
to any help.Best regards,


The size of the device is not the size of the plot region. You need to take 
into account the margins. See ?par
Thank you, David.I have read the par() document. Clearly the size of the plot 
region is smaller than or equal to the divice size. However, if I produce a 
graphic device with dev.new (length, width) or other functions, I find the 
largest  width of the new device is always 5.3 inches whatever the values I 
set, and the length of it is alway smaller than what I set.


The length and width aren't the first and second parameters for any 
device, and length isn't a parameter at all.  Try


dev.new(height = 10, width = 10)

and you should get a bigger device if it will fit on your screen.  If it 
won't fit, then you might get a smaller one, and you'll need to choose a 
non-screen device such as png() or pdf() instead of the default device.


Duncan Murdoch

 Could you tell me how to produce a graphic divice with correct size 
that I set? I need this function because the graphic divice cannot 
accomendate all of the graph I make with some of plot tools such as 
ggtree. In ggtree plot, part of the tree tips label are invisible 
(https://www.dropbox.com/s/87gyusx7ay1xxu8/tree.pdf?dl=0) even I set 
"par(mar=rep(0,4))". So I think I must plot the tree on a larger graphic 
device.  Best regards.



  
   [[alternative HTML version deleted]]
  
  __

  R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
  https://stat.ethz.ch/mailman/listinfo/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
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law





[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [ESS] ess-insert-function-outline

2018-05-04 Thread Patrick Connolly
Thanks Lionel.

On Thu, 03-May-2018 at 11:14AM +0200, Lionel Henry wrote:

|> 
|> 

|> > On 3 mai 2018, at 10:54, Patrick Connolly
|> >  wrote:

|> > What could be the thinking behind that?
|> 
|> This function is strictly less useful than the alternatives mentioned by
|> Alex (yasnippet is an excellent package). You can copy the old definition
|> in your configuration file if you'd like to continue using it.

Which configuration file are you referring to?  Not the
function-outline.S in etc/ because it's already there.  Something in
the lisp/ directory?  Anything that contains reference to
function-outline seems to be the same.  I'm pretty ignorant of how the
idea of .el and .elc files in lisp works.  I just use emacs to write R
code.

 The yasnippet package would take me ages to get my head around, and I
 don't have use for most of what it seems to do.


|> 
|> https://github.com/emacs-ess/ESS/blob/master/lisp/old/ess-old-s.el

That's the same as what's in my lisp/old directory.  What am I to
learn from that?

best

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___Patrick Connolly   
 {~._.~}   Great minds discuss ideas
 _( Y )_ Average minds discuss events 
(:_~*~_:)  Small minds discuss people  
 (_)-(_)  . Eleanor Roosevelt
  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] Package for Molecular Properties

2018-05-04 Thread Bert Gunter
... In addition, you may wish to also post on the Bioconductor list
for this sort of thing.

-- Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Thu, May 3, 2018 at 12:58 AM, Spencer Graves
 wrote:
>
> library(sos)
>
>
> (mp <- findFn('{molecular properties}'))
>
>
>   ** found 7 matches in 4 packages and opened two web pages in my
> default browser with (a) the 7 matches and (b) the 4 packages. The first
> function was something for amino acids, like you suggested.  Two others
> returned compound and substance information from PubChem.
>
>
>   Does this help?
>   Spencer
>
>
>
> On 2018-05-02 19:17, bbb_...@verizon.net wrote:
>>
>> All
>>
>> Is there a package or library that will, given a nucleotide sequence
>>
>> 1. calculate the extinction coefficient at 260 nm for (Beer-Lambert's law)
>> 2. calculate molecular weight
>> 3. return it's complementary sequence
>>
>> I was able to find several packages that can do similar calculations for
>> an amino acid sequence for proteins but none for nucleic acids.
>>
>> Any pointers, etc. would be great.
>>
>> thank you in advance
>> Indr
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
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 for Molecular Properties

2018-05-04 Thread David Winsemius

> On May 3, 2018, at 12:58 AM, Spencer Graves 
>  wrote:
> 
> 
> library(sos)
> 
> 
> (mp <- findFn('{molecular properties}'))
> 
> 
>   ** found 7 matches in 4 packages and opened two web pages in my default 
> browser with (a) the 7 matches and (b) the 4 packages. The first function was 
> something for amino acids, like you suggested.  Two others returned compound 
> and substance information from PubChem.
> 
> 
>   Does this help?
>   Spencer
> 
> 
> On 2018-05-02 19:17, bbb_...@verizon.net wrote:
>> All
>> 
>> Is there a package or library that will, given a nucleotide sequence
>> 
>> 1. calculate the extinction coefficient at 260 nm for (Beer-Lambert's law)
>> 2. calculate molecular weight
>> 3. return it's complementary sequence

I second Spencer Graves suggestion if using sos::findFn. I use that function on 
a daily basis and find it very useful.

For #3 I suspect that you would need to specify whether you are dealing with 
RNA or DNA since the term complementary would have different implementations. 
Once that is done you could get a 5' sequence from a 3' sequence input by a 
simple use of base function `chartr`. Assuming the nucleotides were limited to 
CGTA (DNA) then:

> set.seed(123)
> seq <- sample( c("C","G","T","A") , 10, repl=TRUE)
> seq=paste0(seq,collapse="")
> seq
[1] "GAGAACTATG"
> chartr( old="CGTA", new="GCAT", seq)
[1] "CTCTTGATAC"

Caveat: I'm not a biologist, nor have I ever really done biochemistry. This was 
from memory of decades-old biology course. Check all the assumptions and 
assertions with a domain expert.

>> 
>> I was able to find several packages that can do similar calculations for an 
>> amino acid sequence for proteins but none for nucleic acids.
>> 
>> Any pointers, etc. would be great.
--

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/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 for Molecular Properties

2018-05-04 Thread bbb_aaa
Hi Spencer


Thank you for your suggestion.

I tried sos -- Is it actually supposed to actually list out the functions along 
with the packages? 

This is what I got:



found 7 matches
Downloaded 7 links in 4 packages.
Ignoring template.
Warning messages:
1: In file(templateFile, encoding = "utf-8", open = "r") :
  file("") only supports open = "w+" and open = "w+b": using the former
2: In print.packageSum(packageSum(x, title = titSum, ...)) :
  Brew created a file of size 0



Could it be because I recently upgraded to the latest version of R? 
When I first tried sos I got a warning (see below):





Loading required package: brew

Attaching package: ‘sos’

The following object is masked from ‘package:utils’:

?

Warning message:
package ‘sos’ was built under R version 3.4.4 

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


Re: [R] why the length and width of a plot region produced by the dev.new() function cannot be correctly set?

2018-05-04 Thread sunyeping via R-help

--From:David 
Winsemius Send Time:2018 May 4 (Fri) 13:25To:孙业平 
Cc:R Help Mailing List Subject:Re: 
[R] why the length and width of a plot region produced by the dev.new() 
function cannot be correctly set?

> On May 3, 2018, at 6:28 PM, sunyeping via R-help  wrote:
> 
> When I check the size of the plot region usingdev.size("in")a new plot region 
>is produced and in the Rconsole I get[1] 5.33 5.322917

Your test is all mangleed together. You failed in your duty to read the list 
info and the Posting guide . NO HTML!

> If I mean to produce a plot region with size setting 
>bydev.new(length=3,width=3)a plot region is produced, but the size is 
>[2.281250, 5.322917], as detected by the de.size function. If I 
>type:dev.new(length=10,width=10)I get a plot region of with the size of 
>[7.614583, 5.322917]. It seems that the width of the new plot region cannot be 
>set, and tt is always 5.322917. The length of the new plot region can be set, 
>but it is always smaller that the values I set.What do I miss? What is the 
>correct way of setting the dimension of the new plot region? I will be 
>grateful to any help.Best regards,

The size of the device is not the size of the plot region. You need to take 
into account the margins. See ?par
Thank you, David.I have read the par() document. Clearly the size of the plot 
region is smaller than or equal to the divice size. However, if I produce a 
graphic device with dev.new (length, width) or other functions, I find the 
largest  width of the new device is always 5.3 inches whatever the values I 
set, and the length of it is alway smaller than what I set. Could you tell me 
how to produce a graphic divice with correct size that I set? I need this 
function because the graphic divice cannot accomendate all of the graph I make 
with some of plot tools such as ggtree. In ggtree plot, part of the tree tips 
label are invisible (https://www.dropbox.com/s/87gyusx7ay1xxu8/tree.pdf?dl=0) 
even I set "par(mar=rep(0,4))". So I think I must plot the tree on a larger 
graphic device.  Best regards. 


> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/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
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law





[[alternative HTML version deleted]]

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