[R] Network meta-analysis help

2017-09-19 Thread Sherief Ghozy via R-help
Greetings. I hope my message finds you well.

I know this question may be silly for some experts like you but it's a very 
important matter for me so, sorry for that.

I was trying to make a network meta-analysis using R for the attached data set 
which shows the association between breast feeding and autism spectrum disorder 
(the event here is bad).

I've searched a lot through the internet but no clear guidelines on how to do 
network meta-analysis and produce the related figures (Forest plot, Network 
plot, Heat map  ect).

I've installed "netmeta" pack successfully.

Can you help me in this matter ? or even guide me where to find help ?

I really need to finish this analysis.

Sorry for any inconvenience.

Thanks in advance.
__
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] igraph problem

2017-09-19 Thread Justin Thong
Run this code

tree<-graph_from_literal(1-+2:3,3-+5,1-+4);
graph.bfs(tree,root=1, neimode="out",father=TRUE,order=TRUE,unreachable =
FALSE)

I do not understand why the father values will give NA 1 1 3 1 rather than NA
1 1 1 3

The reason I am doing this is to obtain the values(by vertex names) or some
index of each individual branch in tree. Does anyone have any ideas on how
to do this?

Yours sincerely,
Justin

*I check my email at 9AM and 4PM everyday*
*If you have an EMERGENCY, contact me at +447938674419 <07938%20674419>(UK)
or +60125056192 <+60%2012-505%206192>(Malaysia)*

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


Re: [R] symbolic computing example with Ryacas

2017-09-19 Thread Gabor Grothendieck
Here are some more examples:

library(Ryacas)

x <- Sym("x")
yacas("x:=2")
Eval(x*x)
## [1] 4

# vignette has similar example
y <- Sym("y")
Eval(Subst(y*y, y, 3))
## [1] 9

# demo("Ryacas-Function") has similar example to this
f <- function(z) {}
body(f) <- yacas(expression(z*z))[[1]]
f(4)
## [1] 16



On Tue, Sep 19, 2017 at 2:08 PM, Vivek Sutradhara  wrote:
> Thanks for the response. Yes, I did study the vignette but did not
> understand it fully. Anyway, I have tried once again now. I am happy to say
> that I have got what I wanted.
>
> library(Ryacas)
> x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
> my_func <- function(x,U,x0,C) {
>   return (U/(1+exp(-(x-x0)/C)))}
> FirstDeriv <- deriv(my_func(x,U,x0,C), x)
> PrettyForm(FirstDeriv)
> #slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")
> slope <- Subst(FirstDeriv,x,x0)
> #PrettyForm(slope) - gives errors
> PrettyForm(Simplify(slope))
>
> I was confused by the references to the yacas command.  Now, I have chosen
> to omit it. Then I get what I want.
> Thanks,
> Vivek
>
> 2017-09-19 16:04 GMT+02:00 Bert Gunter :
>
>> Have you studied the "Introduction to Ryacas" vignette that come with the
>> package?
>>
>> 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 Tue, Sep 19, 2017 at 2:37 AM, Vivek Sutradhara 
>> wrote:
>>
>>> Hi all,
>>> I am trying to implement the following matlab code with Ryacas :
>>>
>>> syms U x x0 C
>>>
>>> d1=diff(U/(1+exp(-(x-x0)/C)),x);
>>>
>>> pretty(d1)
>>>
>>> d2=diff(U/(1+exp(-(x-x0)/C)),x,2);
>>>
>>> pretty(d2)
>>>
>>> solx2 = solve(d2 == 0, x, 'Real', true)
>>>
>>> pretty(solx2)
>>>
>>> slope2=subs(d1,solx2)
>>>
>>>
>>> I have tried the following :
>>>
>>> library(Ryacas)
>>>
>>> x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
>>>
>>> my_func <- function(x,U,x0,C) {
>>>
>>>   return (U/(1+exp(-(x-x0)/C)))}
>>>
>>> FirstDeriv <- deriv(my_func(x,U,x0,C), x)
>>>
>>> PrettyForm(FirstDeriv)
>>>
>>> slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")
>>>
>>> PrettyForm(slope)
>>>
>>>
>>> I don't understand how I should use the Subst command. I want the slope of
>>> the first derivative at x=x0. How do I implement that?
>>>
>>> I would appreciate any help that I can get.
>>>
>>> Thanks,
>>>
>>> Vivek
>>>
>>> [[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/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.



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

__
R-help@r-project.org mailing list -- 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] symbolic computing example with Ryacas

2017-09-19 Thread Vivek Sutradhara
Thanks for the response. Yes, I did study the vignette but did not
understand it fully. Anyway, I have tried once again now. I am happy to say
that I have got what I wanted.

library(Ryacas)
x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
my_func <- function(x,U,x0,C) {
  return (U/(1+exp(-(x-x0)/C)))}
FirstDeriv <- deriv(my_func(x,U,x0,C), x)
PrettyForm(FirstDeriv)
#slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")
slope <- Subst(FirstDeriv,x,x0)
#PrettyForm(slope) - gives errors
PrettyForm(Simplify(slope))

I was confused by the references to the yacas command.  Now, I have chosen
to omit it. Then I get what I want.
Thanks,
Vivek

2017-09-19 16:04 GMT+02:00 Bert Gunter :

> Have you studied the "Introduction to Ryacas" vignette that come with the
> package?
>
> 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 Tue, Sep 19, 2017 at 2:37 AM, Vivek Sutradhara 
> wrote:
>
>> Hi all,
>> I am trying to implement the following matlab code with Ryacas :
>>
>> syms U x x0 C
>>
>> d1=diff(U/(1+exp(-(x-x0)/C)),x);
>>
>> pretty(d1)
>>
>> d2=diff(U/(1+exp(-(x-x0)/C)),x,2);
>>
>> pretty(d2)
>>
>> solx2 = solve(d2 == 0, x, 'Real', true)
>>
>> pretty(solx2)
>>
>> slope2=subs(d1,solx2)
>>
>>
>> I have tried the following :
>>
>> library(Ryacas)
>>
>> x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
>>
>> my_func <- function(x,U,x0,C) {
>>
>>   return (U/(1+exp(-(x-x0)/C)))}
>>
>> FirstDeriv <- deriv(my_func(x,U,x0,C), x)
>>
>> PrettyForm(FirstDeriv)
>>
>> slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")
>>
>> PrettyForm(slope)
>>
>>
>> I don't understand how I should use the Subst command. I want the slope of
>> the first derivative at x=x0. How do I implement that?
>>
>> I would appreciate any help that I can get.
>>
>> Thanks,
>>
>> Vivek
>>
>> [[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/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.


Re: [R] remove quotes from matrix

2017-09-19 Thread greg holly
Hi Bert;

I sincerely appreciate for this. When I follow your way I have got
dimnames(dm)
[[1]]
NULL

I think this is the reason why the matrix is being converted into  a column
vector.

Regards,

Greg

On Tue, Sep 19, 2017 at 11:32 AM, Bert Gunter 
wrote:

> Works fine for me. What do you object to in the following?
>
> Calling the above df "d",
>
> > dm <- as.matrix(d)
> > dm
>   Sub_PathwaysBMI_beta   SAT_beta   VAT_beta
> 1 "Alanine_and_Aspartate" " 0.23820" "-0.02409" " 0.94180"
> 2 "Alanine_and_Aspartate" "-0.31300" "-1.97510" "-2.22040"
> 3 "Alanine_and_Aspartate" " 0.12380" " 0.40950" " 0.68050"
> 4 "Alanine_and_Aspartate" " 0.30350" " 0.48610" " 0.70830"
> 5 "Alanine_and_Aspartate" "-0.00982" " 0.32930" " 0.01597"
>   VSR_beta
> 1 " 0.24690"
> 2 "-0.23540"
> 3 " 0.05539"
> 4 " 0.01337"
> 5 "-0.04353"
> > dimnames(dm)
> [[1]]
> [1] "1" "2" "3" "4" "5"
>
> [[2]]
> [1] "Sub_Pathways" "BMI_beta" "SAT_beta" "VAT_beta"
> [5] "VSR_beta"
>
> > dm <- noquote(dm)
> > dm
>   Sub_Pathways  BMI_beta SAT_beta VAT_beta VSR_beta
> 1 Alanine_and_Aspartate  0.23820 -0.02409  0.94180  0.24690
> 2 Alanine_and_Aspartate -0.31300 -1.97510 -2.22040 -0.23540
> 3 Alanine_and_Aspartate  0.12380  0.40950  0.68050  0.05539
> 4 Alanine_and_Aspartate  0.30350  0.48610  0.70830  0.01337
> 5 Alanine_and_Aspartate -0.00982  0.32930  0.01597 -0.04353
> > dimnames(dm)
> [[1]]
> [1] "1" "2" "3" "4" "5"
>
> [[2]]
> [1] "Sub_Pathways" "BMI_beta" "SAT_beta" "VAT_beta"
> [5] "VSR_beta"
>
>
> Perhaps you need to read ?noquote or ?matrix.
>
> -- 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 Tue, Sep 19, 2017 at 8:20 AM, greg holly  wrote:
>
>> Dear all;
>>
>> Thanks. Here are the dput results as Duncan suggested.
>>
>> Regards,
>>
>> Greg
>>
>> structure(list(Sub_Pathways = structure(c(3L, 3L, 3L, 3L, 3L), .Label =
>> c("Acetylated_Peptides",
>> "Advanced_Glycation_End-product", "Alanine_and_Aspartate", "Aminosugar",
>> "Ascorbate_and_Aldarate", "Carnitine", "Ceramides", "Creatine",
>> "Diacylglycerol", "Dipeptide", "Dipeptide_Derivative",
>> "Disaccharides_and_Oligosaccharides",
>> "Eicosanoid", "Endocannabinoid", "Fatty_Acid(Acyl_Carnitine)",
>> "Fatty_Acid(Acyl_Glycine)", "Fatty_Acid,_Amino", "Fatty_Acid,_Branched",
>> "Fatty_Acid,_Dicarboxylate", "Fatty_Acid,_Dihydroxy",
>> "Fatty_Acid,_Monohydroxy",
>> "Fatty_Acid_(Acyl_Choline)", "Fatty_Acid_(Acyl_Glutamine)",
>> "Fatty_Acid_(also_BCAA)",
>> "Fatty_Acid_Synthesis", "Fibrinogen_Cleavage_Peptide",
>> "Fructose,_Mannose_and_Galactose",
>> "Gamma-glutamyl_Amino_Acid", "Glutamate", "Glutathione", "Glycerolipid",
>> "Glycine,_Serine_and_Threonine", "Glycogen",
>> "Glycolysis,_Gluconeogenesis,_and_Pyruvate",
>> "Guanidino_and_Acetamido", "Hemoglobin_and_Porphyrin", "Histidine",
>> "Inositol", "Ketone_Bodies", "Leucine,_Isoleucine_and_Valine",
>> "Long_Chain_Fatty_Acid", "Lysine", "Lyso-phospho-ether", "Lysolipid",
>> "Lysoplasmalogen", "Medium_Chain_Fatty_Acid",
>> "Methionine,_Cysteine,_SAM_and_Taurine",
>> "Mevalonate", "Monoacylglycerol", "Nicotinate_and_Nicotinamide",
>> "Oxidative_Phosphorylation", "Pantothenate_and_CoA", "Pentose",
>> "Phenylalanine_and_Tyrosine", "Phospholipid", "Plasmalogen",
>> "Polyamine", "Polypeptide", "Polyunsaturated_Fatty_Acid_(n3_and_n6)",
>> "Primary_Bile_Acid", "Purine,_(Hypo)Xanthine/Inosine_containing",
>> "Purine,_Adenine_containing", "Purine,_Guanine_containing",
>> "Pyrimidine,_Cytidine_containing",
>> "Pyrimidine,_Orotate_containing", "Pyrimidine,_Thymine_containing",
>> "Pyrimidine,_Uracil_containing", "Riboflavin", "Secondary_Bile_Acid",
>> "Short_Chain_Fatty_Acid", "Sphingolipid", "Steroid", "Sterol",
>> "TCA_Cycle", "Tocopherol", "Tryptophan",
>> "Urea_cycle;_Arginine_and_Proline",
>> "Vitamin_A", "Vitamin_B6"), class = "factor"), BMI_beta = c(0.2382,
>> -0.313, 0.1238, 0.3035, -0.00982), SAT_beta = c(-0.02409, -1.9751,
>> 0.4095, 0.4861, 0.3293), VAT_beta = c(0.9418, -2.2204, 0.6805,
>> 0.7083, 0.01597), VSR_beta = c(0.2469, -0.2354, 0.05539, 0.01337,
>> -0.04353)), .Names = c("Sub_Pathways", "BMI_beta", "SAT_beta",
>> "VAT_beta", "VSR_beta"), row.names = c(NA, 5L), class = "data.frame")
>>
>> On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch <
>> murdoch.dun...@gmail.com>
>> wrote:
>>
>> > On 19/09/2017 9:47 AM, greg holly wrote:
>> >
>> >> Hi all;
>> >>
>> >> I have data at 734*22 dimensions with rows and columns names are
>> >> non-numeric.When I convert this data into matrix then all values show
>> up
>> >> with quotes. Then when I use
>> >> x1= noquotes(x) to remove the quotes from the matrix then non-numeric
>> row
>> >> names remain all other values in matrix disappear.
>> >>
>> >> Your help is greatly appreciated.
>> >>
>> >>
>> >
>> > Matrices in R can have only one type.  If you start with a 

Re: [R] remove quotes from matrix

2017-09-19 Thread David L Carlson
Your description was confusing. You do not have row names that are non-numeric:

> str(dta)
'data.frame':   5 obs. of  5 variables:
 $ Sub_Pathways: Factor w/ 79 levels "Acetylated_Peptides",..: 3 3 3 3 3
 $ BMI_beta: num  0.2382 -0.313 0.1238 0.3035 -0.00982
 $ SAT_beta: num  -0.0241 -1.9751 0.4095 0.4861 0.3293
 $ VAT_beta: num  0.942 -2.22 0.68 0.708 0.016
 $ VSR_beta: num  0.2469 -0.2354 0.0554 0.0134 -0.0435

You have a column that is a factor with 79 levels. That cannot be row names 
because you indicated that the original data was 734*22 dimensions and row 
names cannot have duplications. If you want numeric values, you need to strip 
off the first column:

> as.matrix(dta[ , -1])
  BMI_beta SAT_beta VAT_beta VSR_beta
1  0.23820 -0.02409  0.94180  0.24690
2 -0.31300 -1.97510 -2.22040 -0.23540
3  0.12380  0.40950  0.68050  0.05539
4  0.30350  0.48610  0.70830  0.01337
5 -0.00982  0.32930  0.01597 -0.04353

If you just want to print the character values without quotes:

> print(as.matrix(dta), quote=FALSE)
  Sub_Pathways  BMI_beta SAT_beta VAT_beta VSR_beta
1 Alanine_and_Aspartate  0.23820 -0.02409  0.94180  0.24690
2 Alanine_and_Aspartate -0.31300 -1.97510 -2.22040 -0.23540
3 Alanine_and_Aspartate  0.12380  0.40950  0.68050  0.05539
4 Alanine_and_Aspartate  0.30350  0.48610  0.70830  0.01337
5 Alanine_and_Aspartate -0.00982  0.32930  0.01597 -0.04353

But do not forget that they are still character strings.


David L Carlson
Department of Anthropology
Texas A University
College Station, TX 77843-4352



-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of greg holly
Sent: Tuesday, September 19, 2017 10:21 AM
To: Duncan Murdoch 
Cc: r-help mailing list 
Subject: Re: [R] remove quotes from matrix

Dear all;

Thanks. Here are the dput results as Duncan suggested.

Regards,

Greg

structure(list(Sub_Pathways = structure(c(3L, 3L, 3L, 3L, 3L), .Label = 
c("Acetylated_Peptides", "Advanced_Glycation_End-product", 
"Alanine_and_Aspartate", "Aminosugar", "Ascorbate_and_Aldarate", "Carnitine", 
"Ceramides", "Creatine", "Diacylglycerol", "Dipeptide", "Dipeptide_Derivative", 
"Disaccharides_and_Oligosaccharides",
"Eicosanoid", "Endocannabinoid", "Fatty_Acid(Acyl_Carnitine)", 
"Fatty_Acid(Acyl_Glycine)", "Fatty_Acid,_Amino", "Fatty_Acid,_Branched", 
"Fatty_Acid,_Dicarboxylate", "Fatty_Acid,_Dihydroxy", 
"Fatty_Acid,_Monohydroxy", "Fatty_Acid_(Acyl_Choline)", 
"Fatty_Acid_(Acyl_Glutamine)", "Fatty_Acid_(also_BCAA)", 
"Fatty_Acid_Synthesis", "Fibrinogen_Cleavage_Peptide", 
"Fructose,_Mannose_and_Galactose",
"Gamma-glutamyl_Amino_Acid", "Glutamate", "Glutathione", "Glycerolipid", 
"Glycine,_Serine_and_Threonine", "Glycogen", 
"Glycolysis,_Gluconeogenesis,_and_Pyruvate",
"Guanidino_and_Acetamido", "Hemoglobin_and_Porphyrin", "Histidine", "Inositol", 
"Ketone_Bodies", "Leucine,_Isoleucine_and_Valine", "Long_Chain_Fatty_Acid", 
"Lysine", "Lyso-phospho-ether", "Lysolipid", "Lysoplasmalogen", 
"Medium_Chain_Fatty_Acid", "Methionine,_Cysteine,_SAM_and_Taurine",
"Mevalonate", "Monoacylglycerol", "Nicotinate_and_Nicotinamide", 
"Oxidative_Phosphorylation", "Pantothenate_and_CoA", "Pentose", 
"Phenylalanine_and_Tyrosine", "Phospholipid", "Plasmalogen", "Polyamine", 
"Polypeptide", "Polyunsaturated_Fatty_Acid_(n3_and_n6)",
"Primary_Bile_Acid", "Purine,_(Hypo)Xanthine/Inosine_containing",
"Purine,_Adenine_containing", "Purine,_Guanine_containing", 
"Pyrimidine,_Cytidine_containing",
"Pyrimidine,_Orotate_containing", "Pyrimidine,_Thymine_containing", 
"Pyrimidine,_Uracil_containing", "Riboflavin", "Secondary_Bile_Acid", 
"Short_Chain_Fatty_Acid", "Sphingolipid", "Steroid", "Sterol", "TCA_Cycle", 
"Tocopherol", "Tryptophan", "Urea_cycle;_Arginine_and_Proline",
"Vitamin_A", "Vitamin_B6"), class = "factor"), BMI_beta = c(0.2382, -0.313, 
0.1238, 0.3035, -0.00982), SAT_beta = c(-0.02409, -1.9751, 0.4095, 0.4861, 
0.3293), VAT_beta = c(0.9418, -2.2204, 0.6805, 0.7083, 0.01597), VSR_beta = 
c(0.2469, -0.2354, 0.05539, 0.01337, -0.04353)), .Names = c("Sub_Pathways", 
"BMI_beta", "SAT_beta", "VAT_beta", "VSR_beta"), row.names = c(NA, 5L), class = 
"data.frame")

On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch 
wrote:

> On 19/09/2017 9:47 AM, greg holly wrote:
>
>> Hi all;
>>
>> I have data at 734*22 dimensions with rows and columns names are 
>> non-numeric.When I convert this data into matrix then all values show 
>> up with quotes. Then when I use x1= noquotes(x) to remove the quotes 
>> from the matrix then non-numeric row names remain all other values in 
>> matrix disappear.
>>
>> Your help is greatly appreciated.
>>
>>
>
> Matrices in R can have only one type.  If you start with a dataframe 
> and any columns contain character data, all entries will be converted 
> to character, and the matrix will be displayed with quotes.
>
> When you say all values 

Re: [R] remove quotes from matrix

2017-09-19 Thread Bert Gunter
Works fine for me. What do you object to in the following?

Calling the above df "d",

> dm <- as.matrix(d)
> dm
  Sub_PathwaysBMI_beta   SAT_beta   VAT_beta
1 "Alanine_and_Aspartate" " 0.23820" "-0.02409" " 0.94180"
2 "Alanine_and_Aspartate" "-0.31300" "-1.97510" "-2.22040"
3 "Alanine_and_Aspartate" " 0.12380" " 0.40950" " 0.68050"
4 "Alanine_and_Aspartate" " 0.30350" " 0.48610" " 0.70830"
5 "Alanine_and_Aspartate" "-0.00982" " 0.32930" " 0.01597"
  VSR_beta
1 " 0.24690"
2 "-0.23540"
3 " 0.05539"
4 " 0.01337"
5 "-0.04353"
> dimnames(dm)
[[1]]
[1] "1" "2" "3" "4" "5"

[[2]]
[1] "Sub_Pathways" "BMI_beta" "SAT_beta" "VAT_beta"
[5] "VSR_beta"

> dm <- noquote(dm)
> dm
  Sub_Pathways  BMI_beta SAT_beta VAT_beta VSR_beta
1 Alanine_and_Aspartate  0.23820 -0.02409  0.94180  0.24690
2 Alanine_and_Aspartate -0.31300 -1.97510 -2.22040 -0.23540
3 Alanine_and_Aspartate  0.12380  0.40950  0.68050  0.05539
4 Alanine_and_Aspartate  0.30350  0.48610  0.70830  0.01337
5 Alanine_and_Aspartate -0.00982  0.32930  0.01597 -0.04353
> dimnames(dm)
[[1]]
[1] "1" "2" "3" "4" "5"

[[2]]
[1] "Sub_Pathways" "BMI_beta" "SAT_beta" "VAT_beta"
[5] "VSR_beta"


Perhaps you need to read ?noquote or ?matrix.

-- 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 Tue, Sep 19, 2017 at 8:20 AM, greg holly  wrote:

> Dear all;
>
> Thanks. Here are the dput results as Duncan suggested.
>
> Regards,
>
> Greg
>
> structure(list(Sub_Pathways = structure(c(3L, 3L, 3L, 3L, 3L), .Label =
> c("Acetylated_Peptides",
> "Advanced_Glycation_End-product", "Alanine_and_Aspartate", "Aminosugar",
> "Ascorbate_and_Aldarate", "Carnitine", "Ceramides", "Creatine",
> "Diacylglycerol", "Dipeptide", "Dipeptide_Derivative",
> "Disaccharides_and_Oligosaccharides",
> "Eicosanoid", "Endocannabinoid", "Fatty_Acid(Acyl_Carnitine)",
> "Fatty_Acid(Acyl_Glycine)", "Fatty_Acid,_Amino", "Fatty_Acid,_Branched",
> "Fatty_Acid,_Dicarboxylate", "Fatty_Acid,_Dihydroxy",
> "Fatty_Acid,_Monohydroxy",
> "Fatty_Acid_(Acyl_Choline)", "Fatty_Acid_(Acyl_Glutamine)",
> "Fatty_Acid_(also_BCAA)",
> "Fatty_Acid_Synthesis", "Fibrinogen_Cleavage_Peptide",
> "Fructose,_Mannose_and_Galactose",
> "Gamma-glutamyl_Amino_Acid", "Glutamate", "Glutathione", "Glycerolipid",
> "Glycine,_Serine_and_Threonine", "Glycogen",
> "Glycolysis,_Gluconeogenesis,_and_Pyruvate",
> "Guanidino_and_Acetamido", "Hemoglobin_and_Porphyrin", "Histidine",
> "Inositol", "Ketone_Bodies", "Leucine,_Isoleucine_and_Valine",
> "Long_Chain_Fatty_Acid", "Lysine", "Lyso-phospho-ether", "Lysolipid",
> "Lysoplasmalogen", "Medium_Chain_Fatty_Acid",
> "Methionine,_Cysteine,_SAM_and_Taurine",
> "Mevalonate", "Monoacylglycerol", "Nicotinate_and_Nicotinamide",
> "Oxidative_Phosphorylation", "Pantothenate_and_CoA", "Pentose",
> "Phenylalanine_and_Tyrosine", "Phospholipid", "Plasmalogen",
> "Polyamine", "Polypeptide", "Polyunsaturated_Fatty_Acid_(n3_and_n6)",
> "Primary_Bile_Acid", "Purine,_(Hypo)Xanthine/Inosine_containing",
> "Purine,_Adenine_containing", "Purine,_Guanine_containing",
> "Pyrimidine,_Cytidine_containing",
> "Pyrimidine,_Orotate_containing", "Pyrimidine,_Thymine_containing",
> "Pyrimidine,_Uracil_containing", "Riboflavin", "Secondary_Bile_Acid",
> "Short_Chain_Fatty_Acid", "Sphingolipid", "Steroid", "Sterol",
> "TCA_Cycle", "Tocopherol", "Tryptophan",
> "Urea_cycle;_Arginine_and_Proline",
> "Vitamin_A", "Vitamin_B6"), class = "factor"), BMI_beta = c(0.2382,
> -0.313, 0.1238, 0.3035, -0.00982), SAT_beta = c(-0.02409, -1.9751,
> 0.4095, 0.4861, 0.3293), VAT_beta = c(0.9418, -2.2204, 0.6805,
> 0.7083, 0.01597), VSR_beta = c(0.2469, -0.2354, 0.05539, 0.01337,
> -0.04353)), .Names = c("Sub_Pathways", "BMI_beta", "SAT_beta",
> "VAT_beta", "VSR_beta"), row.names = c(NA, 5L), class = "data.frame")
>
> On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch  >
> wrote:
>
> > On 19/09/2017 9:47 AM, greg holly wrote:
> >
> >> Hi all;
> >>
> >> I have data at 734*22 dimensions with rows and columns names are
> >> non-numeric.When I convert this data into matrix then all values show up
> >> with quotes. Then when I use
> >> x1= noquotes(x) to remove the quotes from the matrix then non-numeric
> row
> >> names remain all other values in matrix disappear.
> >>
> >> Your help is greatly appreciated.
> >>
> >>
> >
> > Matrices in R can have only one type.  If you start with a dataframe and
> > any columns contain character data, all entries will be converted to
> > character, and the matrix will be displayed with quotes.
> >
> > When you say all values disappear, it sounds as though you are displaying
> > strings containing nothing (or just blanks).  Those will be displayed as
> ""
> > normally, but if the matrix is marked to display without quotes, they are
> > displayed as empty strings, so it will appear that nothing is 

Re: [R] remove quotes from matrix

2017-09-19 Thread greg holly
Dear all;

Thanks. Here are the dput results as Duncan suggested.

Regards,

Greg

structure(list(Sub_Pathways = structure(c(3L, 3L, 3L, 3L, 3L), .Label =
c("Acetylated_Peptides",
"Advanced_Glycation_End-product", "Alanine_and_Aspartate", "Aminosugar",
"Ascorbate_and_Aldarate", "Carnitine", "Ceramides", "Creatine",
"Diacylglycerol", "Dipeptide", "Dipeptide_Derivative",
"Disaccharides_and_Oligosaccharides",
"Eicosanoid", "Endocannabinoid", "Fatty_Acid(Acyl_Carnitine)",
"Fatty_Acid(Acyl_Glycine)", "Fatty_Acid,_Amino", "Fatty_Acid,_Branched",
"Fatty_Acid,_Dicarboxylate", "Fatty_Acid,_Dihydroxy",
"Fatty_Acid,_Monohydroxy",
"Fatty_Acid_(Acyl_Choline)", "Fatty_Acid_(Acyl_Glutamine)",
"Fatty_Acid_(also_BCAA)",
"Fatty_Acid_Synthesis", "Fibrinogen_Cleavage_Peptide",
"Fructose,_Mannose_and_Galactose",
"Gamma-glutamyl_Amino_Acid", "Glutamate", "Glutathione", "Glycerolipid",
"Glycine,_Serine_and_Threonine", "Glycogen",
"Glycolysis,_Gluconeogenesis,_and_Pyruvate",
"Guanidino_and_Acetamido", "Hemoglobin_and_Porphyrin", "Histidine",
"Inositol", "Ketone_Bodies", "Leucine,_Isoleucine_and_Valine",
"Long_Chain_Fatty_Acid", "Lysine", "Lyso-phospho-ether", "Lysolipid",
"Lysoplasmalogen", "Medium_Chain_Fatty_Acid",
"Methionine,_Cysteine,_SAM_and_Taurine",
"Mevalonate", "Monoacylglycerol", "Nicotinate_and_Nicotinamide",
"Oxidative_Phosphorylation", "Pantothenate_and_CoA", "Pentose",
"Phenylalanine_and_Tyrosine", "Phospholipid", "Plasmalogen",
"Polyamine", "Polypeptide", "Polyunsaturated_Fatty_Acid_(n3_and_n6)",
"Primary_Bile_Acid", "Purine,_(Hypo)Xanthine/Inosine_containing",
"Purine,_Adenine_containing", "Purine,_Guanine_containing",
"Pyrimidine,_Cytidine_containing",
"Pyrimidine,_Orotate_containing", "Pyrimidine,_Thymine_containing",
"Pyrimidine,_Uracil_containing", "Riboflavin", "Secondary_Bile_Acid",
"Short_Chain_Fatty_Acid", "Sphingolipid", "Steroid", "Sterol",
"TCA_Cycle", "Tocopherol", "Tryptophan",
"Urea_cycle;_Arginine_and_Proline",
"Vitamin_A", "Vitamin_B6"), class = "factor"), BMI_beta = c(0.2382,
-0.313, 0.1238, 0.3035, -0.00982), SAT_beta = c(-0.02409, -1.9751,
0.4095, 0.4861, 0.3293), VAT_beta = c(0.9418, -2.2204, 0.6805,
0.7083, 0.01597), VSR_beta = c(0.2469, -0.2354, 0.05539, 0.01337,
-0.04353)), .Names = c("Sub_Pathways", "BMI_beta", "SAT_beta",
"VAT_beta", "VSR_beta"), row.names = c(NA, 5L), class = "data.frame")

On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch 
wrote:

> On 19/09/2017 9:47 AM, greg holly wrote:
>
>> Hi all;
>>
>> I have data at 734*22 dimensions with rows and columns names are
>> non-numeric.When I convert this data into matrix then all values show up
>> with quotes. Then when I use
>> x1= noquotes(x) to remove the quotes from the matrix then non-numeric row
>> names remain all other values in matrix disappear.
>>
>> Your help is greatly appreciated.
>>
>>
>
> Matrices in R can have only one type.  If you start with a dataframe and
> any columns contain character data, all entries will be converted to
> character, and the matrix will be displayed with quotes.
>
> When you say all values disappear, it sounds as though you are displaying
> strings containing nothing (or just blanks).  Those will be displayed as ""
> normally, but if the matrix is marked to display without quotes, they are
> displayed as empty strings, so it will appear that nothing is displayed.
>
> You can see the structure of the original data using the str() function,
> e.g. str(x) should display types for each column.
>
> If this isn't enough to explain what's going on, please show us more
> detail.  For example, show us the result of
>
> y <- x[1:5, 1:5]
> dput(y)
>
> both before and after converting x to a matrix.
>
> Duncan Murdoch
>

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


Re: [R] remove quotes from matrix

2017-09-19 Thread Bert Gunter
Your  claims are false -- or at least confused.

> d <- data.frame(a = I(letters[1:3]), b = 1:3)
## the I() is to prevent automatic conversion to factor

> d
  a b
1 a 1
2 b 2
3 c 3
> dm <- as.matrix(d)
> dm
 a   b
[1,] "a" "1"
[2,] "b" "2"
[3,] "c" "3"
> dimnames(dm)
[[1]]
NULL

[[2]]
[1] "a" "b"

## Note that there are no rownames, as d had none.
> dm <- noquote(dm)
> dm
 a b
[1,] a 1
[2,] b 2
[3,] c 3

We still need a reprex to resolve the confusion.

-- 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 Tue, Sep 19, 2017 at 7:49 AM, greg holly  wrote:

> Hi Duncan and Bert;
>
> I do appreciate for your replies. I just figured out that after x1=
> noquotes(x) commend my 733*22 matrix returns into n*1 vector. Is there way
> to keep this as matrix with the dimension of 733*22?
>
> Regards,
>
> Greg
>
>
> On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch  >
> wrote:
>
> > On 19/09/2017 9:47 AM, greg holly wrote:
> >
> >> Hi all;
> >>
> >> I have data at 734*22 dimensions with rows and columns names are
> >> non-numeric.When I convert this data into matrix then all values show up
> >> with quotes. Then when I use
> >> x1= noquotes(x) to remove the quotes from the matrix then non-numeric
> row
> >> names remain all other values in matrix disappear.
> >>
> >> Your help is greatly appreciated.
> >>
> >>
> >
> > Matrices in R can have only one type.  If you start with a dataframe and
> > any columns contain character data, all entries will be converted to
> > character, and the matrix will be displayed with quotes.
> >
> > When you say all values disappear, it sounds as though you are displaying
> > strings containing nothing (or just blanks).  Those will be displayed as
> ""
> > normally, but if the matrix is marked to display without quotes, they are
> > displayed as empty strings, so it will appear that nothing is displayed.
> >
> > You can see the structure of the original data using the str() function,
> > e.g. str(x) should display types for each column.
> >
> > If this isn't enough to explain what's going on, please show us more
> > detail.  For example, show us the result of
> >
> > y <- x[1:5, 1:5]
> > dput(y)
> >
> > both before and after converting x to a matrix.
> >
> > Duncan Murdoch
> >
>
> [[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.
>

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


Re: [R] remove quotes from matrix

2017-09-19 Thread Jeff Newmiller
Greg, I think you should stop using noquote, because it is doing something that 
will not be useful to you for preparing your data for analysis.

Please follow Duncan's advice and provide us with a sample of your data.  Also, 
please set your email program to send plain text rather than HTML formatted 
text. 
-- 
Sent from my phone. Please excuse my brevity.

On September 19, 2017 7:49:12 AM PDT, greg holly  wrote:
>Hi Duncan and Bert;
>
>I do appreciate for your replies. I just figured out that after x1=
>noquotes(x) commend my 733*22 matrix returns into n*1 vector. Is there
>way
>to keep this as matrix with the dimension of 733*22?
>
>Regards,
>
>Greg
>
>
>On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch
>
>wrote:
>
>> On 19/09/2017 9:47 AM, greg holly wrote:
>>
>>> Hi all;
>>>
>>> I have data at 734*22 dimensions with rows and columns names are
>>> non-numeric.When I convert this data into matrix then all values
>show up
>>> with quotes. Then when I use
>>> x1= noquotes(x) to remove the quotes from the matrix then
>non-numeric row
>>> names remain all other values in matrix disappear.
>>>
>>> Your help is greatly appreciated.
>>>
>>>
>>
>> Matrices in R can have only one type.  If you start with a dataframe
>and
>> any columns contain character data, all entries will be converted to
>> character, and the matrix will be displayed with quotes.
>>
>> When you say all values disappear, it sounds as though you are
>displaying
>> strings containing nothing (or just blanks).  Those will be displayed
>as ""
>> normally, but if the matrix is marked to display without quotes, they
>are
>> displayed as empty strings, so it will appear that nothing is
>displayed.
>>
>> You can see the structure of the original data using the str()
>function,
>> e.g. str(x) should display types for each column.
>>
>> If this isn't enough to explain what's going on, please show us more
>> detail.  For example, show us the result of
>>
>> y <- x[1:5, 1:5]
>> dput(y)
>>
>> both before and after converting x to a matrix.
>>
>> Duncan Murdoch
>>
>
>   [[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] remove quotes from matrix

2017-09-19 Thread greg holly
Hi Duncan and Bert;

I do appreciate for your replies. I just figured out that after x1=
noquotes(x) commend my 733*22 matrix returns into n*1 vector. Is there way
to keep this as matrix with the dimension of 733*22?

Regards,

Greg


On Tue, Sep 19, 2017 at 10:04 AM, Duncan Murdoch 
wrote:

> On 19/09/2017 9:47 AM, greg holly wrote:
>
>> Hi all;
>>
>> I have data at 734*22 dimensions with rows and columns names are
>> non-numeric.When I convert this data into matrix then all values show up
>> with quotes. Then when I use
>> x1= noquotes(x) to remove the quotes from the matrix then non-numeric row
>> names remain all other values in matrix disappear.
>>
>> Your help is greatly appreciated.
>>
>>
>
> Matrices in R can have only one type.  If you start with a dataframe and
> any columns contain character data, all entries will be converted to
> character, and the matrix will be displayed with quotes.
>
> When you say all values disappear, it sounds as though you are displaying
> strings containing nothing (or just blanks).  Those will be displayed as ""
> normally, but if the matrix is marked to display without quotes, they are
> displayed as empty strings, so it will appear that nothing is displayed.
>
> You can see the structure of the original data using the str() function,
> e.g. str(x) should display types for each column.
>
> If this isn't enough to explain what's going on, please show us more
> detail.  For example, show us the result of
>
> y <- x[1:5, 1:5]
> dput(y)
>
> both before and after converting x to a matrix.
>
> Duncan Murdoch
>

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


Re: [R] remove quotes from matrix

2017-09-19 Thread Duncan Murdoch

On 19/09/2017 9:47 AM, greg holly wrote:

Hi all;

I have data at 734*22 dimensions with rows and columns names are
non-numeric.When I convert this data into matrix then all values show up
with quotes. Then when I use
x1= noquotes(x) to remove the quotes from the matrix then non-numeric row
names remain all other values in matrix disappear.

Your help is greatly appreciated.




Matrices in R can have only one type.  If you start with a dataframe and 
any columns contain character data, all entries will be converted to 
character, and the matrix will be displayed with quotes.


When you say all values disappear, it sounds as though you are 
displaying strings containing nothing (or just blanks).  Those will be 
displayed as "" normally, but if the matrix is marked to display without 
quotes, they are displayed as empty strings, so it will appear that 
nothing is displayed.


You can see the structure of the original data using the str() function, 
e.g. str(x) should display types for each column.


If this isn't enough to explain what's going on, please show us more 
detail.  For example, show us the result of


y <- x[1:5, 1:5]
dput(y)

both before and after converting x to a matrix.

Duncan Murdoch

__
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] symbolic computing example with Ryacas

2017-09-19 Thread Bert Gunter
Have you studied the "Introduction to Ryacas" vignette that come with the
package?

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 Tue, Sep 19, 2017 at 2:37 AM, Vivek Sutradhara 
wrote:

> Hi all,
> I am trying to implement the following matlab code with Ryacas :
>
> syms U x x0 C
>
> d1=diff(U/(1+exp(-(x-x0)/C)),x);
>
> pretty(d1)
>
> d2=diff(U/(1+exp(-(x-x0)/C)),x,2);
>
> pretty(d2)
>
> solx2 = solve(d2 == 0, x, 'Real', true)
>
> pretty(solx2)
>
> slope2=subs(d1,solx2)
>
>
> I have tried the following :
>
> library(Ryacas)
>
> x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")
>
> my_func <- function(x,U,x0,C) {
>
>   return (U/(1+exp(-(x-x0)/C)))}
>
> FirstDeriv <- deriv(my_func(x,U,x0,C), x)
>
> PrettyForm(FirstDeriv)
>
> slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")
>
> PrettyForm(slope)
>
>
> I don't understand how I should use the Subst command. I want the slope of
> the first derivative at x=x0. How do I implement that?
>
> I would appreciate any help that I can get.
>
> Thanks,
>
> Vivek
>
> [[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.
>

[[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] remove quotes from matrix

2017-09-19 Thread greg holly
Hi all;

I have data at 734*22 dimensions with rows and columns names are
non-numeric.When I convert this data into matrix then all values show up
with quotes. Then when I use
x1= noquotes(x) to remove the quotes from the matrix then non-numeric row
names remain all other values in matrix disappear.

Your help is greatly appreciated.

Greg

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


Re: [R] Graph f(x) = 1/x

2017-09-19 Thread ruipbarradas

Hello,

I believe that the easiest way is

curve(1/x, -5, 5)

Also, you're missing a '-' in y < 1/x, it should be y <- 1/x

Hope this helps,

Rui Barradas



Citando AbouEl-Makarim Aboueissa :


Dear All: good morning

I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am getting an error message. Please see below.

I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
log) : *
*  'x' and 'y' lengths differ*


x

x <- seq(-5, 5, 0.01)
y < 1/x

plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
= 1/x", lwd = 2, col ="red")

abline(h=0, lty=2, col = "blue")
abline(v=0, lty=2, col = "blue")
axis(1)
axis(2)
title(main="The Graph of f(x) = 1/x")


any help will be highly appreciated.


with thanks
abou
__
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

[[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] symbolic computing example with Ryacas

2017-09-19 Thread Vivek Sutradhara
Hi all,
I am trying to implement the following matlab code with Ryacas :

syms U x x0 C

d1=diff(U/(1+exp(-(x-x0)/C)),x);

pretty(d1)

d2=diff(U/(1+exp(-(x-x0)/C)),x,2);

pretty(d2)

solx2 = solve(d2 == 0, x, 'Real', true)

pretty(solx2)

slope2=subs(d1,solx2)


I have tried the following :

library(Ryacas)

x <- Sym("x");U <- Sym("U");x0 <- Sym("x0");C <- Sym("C")

my_func <- function(x,U,x0,C) {

  return (U/(1+exp(-(x-x0)/C)))}

FirstDeriv <- deriv(my_func(x,U,x0,C), x)

PrettyForm(FirstDeriv)

slope <- yacas("Subst(x,x0),deriv(my_func(x,U,x0,C), x)")

PrettyForm(slope)


I don't understand how I should use the Subst command. I want the slope of
the first derivative at x=x0. How do I implement that?

I would appreciate any help that I can get.

Thanks,

Vivek

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


Re: [R] Graph f(x) = 1/x

2017-09-19 Thread Ivan Calandra
It's always good to start a new session when you don't understand what's 
wrong, because sometimes your code is correct, but you use old data 
without knowing it :)


Ivan

--
Dr. Ivan Calandra
TraCEr, Laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra

On 19/09/2017 10:19, AbouEl-Makarim Aboueissa wrote:

Dear Zeileis:

Thank you very much

abou

On Tue, Sep 19, 2017 at 4:13 AM, Achim Zeileis 
wrote:



On Tue, 19 Sep 2017, AbouEl-Makarim Aboueissa wrote:

Dear All: good morning

I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am getting an error message. Please see below.

I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
log) : *
*  'x' and 'y' lengths differ*


You have "y < 1/x" rather than "y <- 1/x"! So "y" is not assigned and
presumably you have some old "y" variable in your global environment that
is used and does not match the length of "x".



x

x <- seq(-5, 5, 0.01)
y < 1/x

plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
= 1/x", lwd = 2, col ="red")

abline(h=0, lty=2, col = "blue")
abline(v=0, lty=2, col = "blue")
axis(1)
axis(2)
title(main="The Graph of f(x) = 1/x")


any help will be highly appreciated.


with thanks
abou
__
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

 [[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/posti
ng-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] Graph f(x) = 1/x

2017-09-19 Thread AbouEl-Makarim Aboueissa
Dear Zeileis:

Thank you very much

abou

On Tue, Sep 19, 2017 at 4:13 AM, Achim Zeileis 
wrote:

>
>
> On Tue, 19 Sep 2017, AbouEl-Makarim Aboueissa wrote:
>
> Dear All: good morning
>>
>> I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
>> I am getting an error message. Please see below.
>>
>> I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
>> log) : *
>> *  'x' and 'y' lengths differ*
>>
>
> You have "y < 1/x" rather than "y <- 1/x"! So "y" is not assigned and
> presumably you have some old "y" variable in your global environment that
> is used and does not match the length of "x".
>
>
>> x
>>
>> x <- seq(-5, 5, 0.01)
>> y < 1/x
>>
>> plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
>> = 1/x", lwd = 2, col ="red")
>>
>> abline(h=0, lty=2, col = "blue")
>> abline(v=0, lty=2, col = "blue")
>> axis(1)
>> axis(2)
>> title(main="The Graph of f(x) = 1/x")
>>
>>
>> any help will be highly appreciated.
>>
>>
>> with thanks
>> abou
>> __
>> AbouEl-Makarim Aboueissa, PhD
>> Professor of Statistics
>> Department of Mathematics and Statistics
>> University of Southern Maine
>>
>> [[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/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>


-- 
__
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

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


Re: [R] Graph f(x) = 1/x

2017-09-19 Thread Achim Zeileis



On Tue, 19 Sep 2017, AbouEl-Makarim Aboueissa wrote:


Dear All: good morning

I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am getting an error message. Please see below.

I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
log) : *
*  'x' and 'y' lengths differ*


You have "y < 1/x" rather than "y <- 1/x"! So "y" is not assigned and 
presumably you have some old "y" variable in your global environment that 
is used and does not match the length of "x".




x

x <- seq(-5, 5, 0.01)
y < 1/x

plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
= 1/x", lwd = 2, col ="red")

abline(h=0, lty=2, col = "blue")
abline(v=0, lty=2, col = "blue")
axis(1)
axis(2)
title(main="The Graph of f(x) = 1/x")


any help will be highly appreciated.


with thanks
abou
__
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

[[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] Graph f(x) = 1/x

2017-09-19 Thread AbouEl-Makarim Aboueissa
Dear All: good morning

I am trying to graph the function y=f(x)=1/x over the interval (-5,5). But
I am getting an error message. Please see below.

I am getting the error message: *Error in xy.coords(x, y, xlabel, ylabel,
log) : *
*  'x' and 'y' lengths differ*


x

x <- seq(-5, 5, 0.01)
y < 1/x

plot(x,y, type='l', xlim=c(-5, 5), ylim=c(-5, 5), xlab = "x", ylab = "f(x)
= 1/x", lwd = 2, col ="red")

abline(h=0, lty=2, col = "blue")
abline(v=0, lty=2, col = "blue")
axis(1)
axis(2)
title(main="The Graph of f(x) = 1/x")


any help will be highly appreciated.


with thanks
abou
__
AbouEl-Makarim Aboueissa, PhD
Professor of Statistics
Department of Mathematics and Statistics
University of Southern Maine

[[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] Extracting Europe from a netCDF file

2017-09-19 Thread Eeusha Nafi
Dear ALL,
I was trying to extract the data only for european region from this file
https://www.dropbox.com/s/xpo7zklcmtm3g5r/gfdl_preci.nc?dl=0
using these points (-10.375, 35.125), (43.375, 35.125), (-10.375, 71.375),
(43.375, 71.375). However, I am not sure how I can proceed further.
I have started with the following script:






*f <- "~/gfdl_preci.nc "library(raster)pr <-
brick(f)print(pr)pt <-as.data.frame(extract(pr, extent(-10.375, 43.375,
35.125, 71.375)), xy = TRUE)*

I would be grateful if anyone could kindly help me to proceed furhter.

Regards,
Eeusha

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