Re: [R] R programming question

2015-09-03 Thread Thierry Onkelinx
Have a look at ?outer

outer(1:10, 10:1)

Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey


2015-09-03 15:34 GMT+02:00 Oleg Portnoy :
> I have two vectors of probability distribution of the same length n for
> random variable X and Y. I want to built matrix of two-dimension
> distribution for X and Y with assumption of independence.
> P(X=i,Y=j)=P(X=i)*P(Y=j)
> I want to do this very fast for n=120 and big amount of different
> distribution of X and Y.
> Thanks.
>
> [[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] Unable to display titles in final merged SPSS output file - when merged the two SPSS data sets in R

2015-09-03 Thread jagadishpchary
I have two large data sets in SPSS which I am trying to merge the files using
R - (for test purpose I included only two variables with 4 cases) and below
is the R syntax that I am using for merging the files.

data <- read.spss("D:/R_merge/Data.sav")
data1 <- read.spss("D:/R_merge/Data1.sav")
mydata <- smartbind(data, data1)
write.foreign(mydata, "D:/R_merge/data.txt", "D:/R_merge/data.sps",  
package="SPSS")

The issue is: when I export the data from R to SPSS the value labels
(titles) are not shown in the final merged SPSS data set - only the variable
name is shown at the title. 

I have also tried with "haven" package but the smartbind & rbind are working
properly

data <- read_sav("D:/R_merge/Data.sav")
data1 <- read_sav("D:/R_merge/Data1.sav")
mydata <- rbind(data, data1)
write_sav(data.frame(mydata), "D:/R_merge/test2.sav")

Could anyone please help me out. I am attaching 2 spss files. DATA.sav
  
DATA1.sav   



--
View this message in context: 
http://r.789695.n4.nabble.com/Unable-to-display-titles-in-final-merged-SPSS-output-file-when-merged-the-two-SPSS-data-sets-in-R-tp4711786.html
Sent from the R help mailing list archive at Nabble.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.


[R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-03 Thread Joyaa Antares
Hello r-help,

I am quite new to R.  I downloaded R 3.2.2 for Windows to use with Windows 10.  
 

On attempting to load the RcmdrPlugin.survival plug-in I got this error message:

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : 
  [tcl] invalid command name "configure".

The lead-up to this was:

* I uninstalled R 3.2.2 and deleted all R files I could find.
* Downloaded R 3.2.2 to do a fresh install
* Opened the .exe file as Administrator
* Ran 64-bit R as Administrator
* Updated all packages 
* Installed Rcmdr and RcmdrPlugin.survival
* Ran Rcmdr using library(Rcmdr) from the console
* This required an install of a host of packages, which I installed
* Loaded RcmdrPlugin.survival from the Tools menu
* I was asked to restart R commander, and when I tried it didn’t open properly 
(showing only File/Edit/Data in the menu bar), and this wouldn’t close properly 
either.  The error message as above showed in the console.

I haven’t posted to the list before and would be very grateful for help.  Thank 
you.   Joyaa
[[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] Urgent query

2015-09-03 Thread Bert Gunter
1. Always reply to the list, not just to 1 person.

2. I don't do private consulting.

3. Read the posting guide linked below for how to properly post code.

Cheers,

Bert
Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Wed, Sep 2, 2015 at 11:59 PM, Romana Shehla  wrote:
> Sir , I have attached the pdf file of codes.
>
> With regards,
> Romana Shehla
> Research Scholar
> AMU
>
> On Thu, Sep 3, 2015 at 12:15 AM, Bert Gunter  wrote:
>>
>> Please show us the code that you used that failed. There are several
>> different graphics systems in R, and the answer depends on which
>> system you use.
>>
>> Cheers,
>> Bert
>> Bert Gunter
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>>-- Clifford Stoll
>>
>>
>> On Wed, Sep 2, 2015 at 8:21 AM, Romana Shehla 
>> wrote:
>> > Sir/Madam,
>> >
>> >   I am a scholar at Aligarh Muslim University and have been
>> > continuously using R language. Recently, I am stuck on labeling axis of
>> > the
>> > graphic, I have made. Actually, I want to use mathematical notation
>> >  0> > unable
>> > to show the interval (0,1) .  I would be really grateful if you could
>> > help
>> > me with this problem.
>> > Waiting for your reply
>> >
>> > With regards,
>> > Romana Shehla
>> > Research Scholar
>> > AMU
>> >
>> > [[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] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-03 Thread Fox, John
Dear Joyaa,

I too run R 3.2.2 on a Windows 10 system. I uninstalled R, deleted my package 
library, and then reinstalled R and the Rcmdr and RcmdrPlugin.survival 
packages. I took all defaults, except that I selected the SDI rather than the 
default MDI for Rgui, but I seriously doubt that this is the source of your 
problem. I used the 0-Cloud mirror, both for R 3.2.2 and for packages.

I'm afraid that I can't duplicate your problem -- everything works perfectly 
fine for me.

You provided a reasonable amount of detail, but is there anything else you can 
add?

Best,
 John

-
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
web: socserv.mcmaster.ca/jfox



From: R-help [r-help-boun...@r-project.org] on behalf of Joyaa Antares 
[jo...@goldcoastosteopathy.com.au]
Sent: September 3, 2015 8:31 AM
To: r-help@r-project.org
Subject: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

Hello r-help,

I am quite new to R.  I downloaded R 3.2.2 for Windows to use with Windows 10.

On attempting to load the RcmdrPlugin.survival plug-in I got this error message:

Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
  [tcl] invalid command name "configure".

The lead-up to this was:

* I uninstalled R 3.2.2 and deleted all R files I could find.
* Downloaded R 3.2.2 to do a fresh install
* Opened the .exe file as Administrator
* Ran 64-bit R as Administrator
* Updated all packages
* Installed Rcmdr and RcmdrPlugin.survival
* Ran Rcmdr using library(Rcmdr) from the console
* This required an install of a host of packages, which I installed
* Loaded RcmdrPlugin.survival from the Tools menu
* I was asked to restart R commander, and when I tried it didn’t open properly 
(showing only File/Edit/Data in the menu bar), and this wouldn’t close properly 
either.  The error message as above showed in the console.

I haven’t posted to the list before and would be very grateful for help.  Thank 
you.   Joyaa
[[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] R programming question

2015-09-03 Thread Oleg Portnoy
I have two vectors of probability distribution of the same length n for
random variable X and Y. I want to built matrix of two-dimension
distribution for X and Y with assumption of independence.
P(X=i,Y=j)=P(X=i)*P(Y=j)
I want to do this very fast for n=120 and big amount of different
distribution of X and Y.
Thanks.

[[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] How to use dwish in MCMCpack in R

2015-09-03 Thread Anamika Chaudhuri
Hi All:

I am trying to use the dwish function in the MCMCpack in R

dwish(W, v, S) where

Arguments
W-Positive definite matrix W
v-Degrees of freedom (scalar).
S-Inverse scale matrix

How do I determine W, the positive definite matrix. The matrix provided in
the documentation doesnot help.

Thanks
Anamika

[[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] Revolutions blog: August 2015 roundup

2015-09-03 Thread David Smith
Since 2008, Revolution Analytics (and now Microsoft) staff and guests have 
written about R every weekday at the Revolutions blog:
 http://blog.revolutionanalytics.com
and every month I post a summary of articles from the previous month of 
particular interest to readers of r-help. 

In case you missed them, here are some articles related to R from the month of 
August:

Creating interactive time series charts of financial data in R: 
http://blog.revolutionanalytics.com/2015/08/plotting-time-series-in-r.html

Many R books have been translated into Chinese: 
http://blog.revolutionanalytics.com/2015/08/new-r-titles-available-in-chinese.html

A tutorial on visualizing current-events geographic data with choropleths: 
http://blog.revolutionanalytics.com/2015/08/following-uo-on-the-news-with-choroplether-and-r.html

Revolution R Enterprise 7.4.1 is now available on Windows and Linux servers 
http://blog.revolutionanalytics.com/2015/08/rre-741.html and in the Azure 
Marketplace
http://blog.revolutionanalytics.com/2015/08/revolution-r-enterprise-now-available-in-the-cloud-on-azure-marketplace.html

Zillow uses R to estimate the value of houses and rental properties: 
http://blog.revolutionanalytics.com/2015/08/how-r-is-used-at-zillow-to-estimate-housing-values.html

There’s a new (and free) online course on edX for R beginners, sponsored by 
Microsoft and presented by DataCamp: 
http://blog.revolutionanalytics.com/2015/08/free-edx-course-for-r-beginners.html
 

Mini-reviews of 5 new R packages: AzureML, distcomp, rotationForest, rpca, and 
SwarmSVM: 
http://blog.revolutionanalytics.com/2015/08/5-new-r-packages-for-data-scientists.html

The R Consortium’s best practices for secure use of R: 
http://blog.revolutionanalytics.com/2015/08/good-advice-for-security-with-r.html

How to extract data from a SQL Server database in Azure to an R client running 
Linux: 
http://blog.revolutionanalytics.com/2015/08/using-azure-as-an-r-datasource-part-4-pulling-data-from-sql-server-to-linux.html
 

DeployR Open 7.4.1, the open-source server-based framework for simple and 
secure R integration for application developers, is now available: 
http://blog.revolutionanalytics.com/2015/08/deployr-741-released.html

R 3.2.2 is now available: 
http://blog.revolutionanalytics.com/2015/08/r-322-released.html

A review of the JSM 2015 conference and the prevalence of R there: 
http://blog.revolutionanalytics.com/2015/08/r-news-from-jsm-2015.html

R is available with Cortana Analytics, which you can learn about in upcoming 
workshops and webinars: 
http://blog.revolutionanalytics.com/2015/08/get-to-know-cortana-analytics-workshop-and-webinars.html

A comparison of the network structure of the CRAN and Bioconductor 
repositories: 
http://blog.revolutionanalytics.com/2015/08/differences-in-the-network-structure-of-cran-and-bioconductor.html

Using R to find signal in noisy data: 
http://blog.revolutionanalytics.com/2015/08/how-do-you-know-if-yourdata-has-signal.html

I discussed the R Consortium in the inaugural episode of the R Talk podcast: 
http://blog.revolutionanalytics.com/2015/08/r-talk.html

An exponential random graph model of connections between CRAN packages: 
http://blog.revolutionanalytics.com/2015/08/a-simple-statnet-model-of-cran.html

Using the igraph package to simplify a network graph: 
http://blog.revolutionanalytics.com/2015/08/contracting-and-simplifying-a-network-graph.html

An introductory guide to the Bioconductor project: 
http://blog.revolutionanalytics.com/2015/08/a-short-introduction-to-bioconductor.html
 

An animation shows every commit to the R source code over 18 years: 
http://blog.revolutionanalytics.com/2015/08/watch-18-years-of-r-development-in-15-minutes.html

General interest stories (not related to R) in the past month included: 
Macklemore on mopeds 
(http://blog.revolutionanalytics.com/2015/08/because-its-friday-downtown-spokane.html),
 reconstructed timelapses 
(http://blog.revolutionanalytics.com/2015/08/timelapses.html), a moving 
visualization of WW2 fatalities 
(http://blog.revolutionanalytics.com/2015/08/a-moving-vision-of-ww2-fatalities.html),
 and the Magnus Effect 
(http://blog.revolutionanalytics.com/2015/08/magnus-effect.html).

Meeting times for local R user groups 
(http://blog.revolutionanalytics.com/local-r-groups.html) can be found on the 
updated R Community Calendar at: 
http://blog.revolutionanalytics.com/calendar.html

If you're looking for more articles about R, you can find summaries from 
previous months at http://blog.revolutionanalytics.com/roundups/. You can 
receive daily blog posts via email using services like blogtrottr.com, or join 
the Revolution Analytics mailing list at 
http://revolutionanalytics.com/newsletter to be alerted to new articles on a 
monthly basis.

As always, thanks for the comments and please keep sending suggestions to me at 
david...@microsoft.com or via Twitter (I'm @revodavid).

Cheers,
# David


-- 
David M Smith 
R 

Re: [R] urgent question about Lmer models

2015-09-03 Thread Bert Gunter
You need to consult a local statistical expert or post on a statistics
list like stats.stackexchange.com .  This is a statistical question
not an R question.

The answer is: Because the design is balanced and the treatment error
is obtained from the (within site) rsd, but you will probably need
more explanation than this.

BTW, if you haven't already done so, try making some informative
trellised plots to understand what is going on. Formal statistical
analysis alone can be very misleading.

Cheers,
Bert

Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Thu, Sep 3, 2015 at 8:57 AM, Aline Andrey  wrote:
> Dear r-help,
>
> I have a question about the std error of a lmer model with library
> (LmerTest).
>
> I have 12 sites with 6 treatments over each site. I measured some response
> variable (biomass_of_insects) (with a gaussian distribution).
>
> I did :
> library (LmerTest)
> model<- lmer((biomass_of_insects) ~ as.factor(treatments) + (1 | sites))
>
> However, the response of the model show always the same std error (see
> below):
>
> Fixed effects:
>Estimate Std. Error  df t value Pr(>|t|)
> (Intercept) 501.333 80.656  66.000   6.216 3.91e-08 ***
> as.factor(treat)F   126.667114.065  66.000   1.1100.271
> as.factor(treat)I-8.333114.065  66.000  -0.0730.942
> as.factor(treat)I+F1/3  -75.000114.065  66.000  -0.6580.513
> as.factor(treat)I+F2/3   18.333114.065  66.000   0.1610.873
> as.factor(treat)I+F3/3   15.917114.065  66.000   0.1400.889
>
>
>
> Do you know why std.error is always the same ?
>
> Thank you very much,
>
> Aline
>
> [[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] How to use dwish in MCMCpack in R

2015-09-03 Thread Anamika Chaudhuri
I put in the matrix at which I want the density as S. I was wondering what
is W then?

Thanks
Anamika

On Thu, Sep 3, 2015 at 12:28 PM, Duncan Murdoch 
wrote:

> On 03/09/2015 9:29 AM, Anamika Chaudhuri wrote:
> > Hi All:
> >
> > I am trying to use the dwish function in the MCMCpack in R
> >
> > dwish(W, v, S) where
> >
> > Arguments
> > W-Positive definite matrix W
> > v-Degrees of freedom (scalar).
> > S-Inverse scale matrix
> >
> > How do I determine W, the positive definite matrix. The matrix provided
> in
> > the documentation doesnot help.
>
> Your question doesn't make sense.  You want to compute the density of a
> Wishart distribution.  That's a distribution of matrices.  So you just
> put in the matrix at which you want to compute the density.
>
> 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] Urgent query

2015-09-03 Thread Bert Gunter
You still failed to post to the list! Please learn how to use your
mail client properly and **always** cc the list.

Anyway, here is an answer (there may be other ways):

> curve(dweibull(x,shape=0.8,scale=1),mgp=c(2,0.3,0),cex.lab=1.2,xlab="t",ylab="f(t)")
> mtext(expression(italic(paste(alpha==1,","," 
> ",0 wrote:
> Dear R mailing list,
>  I apologise for not being correct at posting my problem. I read
> the posting guide and got somewhat confused. I am really scared if I am
> still correct or not. If I am not, please pardon me.
> Following are the commands. Could you please let me know about how the limit
> 0 < β < 1 can be introduced at x-axis instead of β < 1, which I have
> written.
>
>
>
>
>>curve(dweibull(x,shape=0.8,scale=1),mgp=c(2,0.3,0),cex.lab=1.2,xlab="t",ylab="f(t)")
>
>>mtext(expression(italic(paste(alpha==1,",","
>> ",beta<1))),side=1,line=4,cex=1)
>
>
>
> With regards,
> Romana Shehla
> Research Scholar
> AMU
>
> On Thu, Sep 3, 2015 at 8:08 PM, Bert Gunter  wrote:
>>
>> 1. Always reply to the list, not just to 1 person.
>>
>> 2. I don't do private consulting.
>>
>> 3. Read the posting guide linked below for how to properly post code.
>>
>> Cheers,
>>
>> Bert
>> Bert Gunter
>>
>> "Data is not information. Information is not knowledge. And knowledge
>> is certainly not wisdom."
>>-- Clifford Stoll
>>
>>
>> On Wed, Sep 2, 2015 at 11:59 PM, Romana Shehla 
>> wrote:
>> > Sir , I have attached the pdf file of codes.
>> >
>> > With regards,
>> > Romana Shehla
>> > Research Scholar
>> > AMU
>> >
>> > On Thu, Sep 3, 2015 at 12:15 AM, Bert Gunter 
>> > wrote:
>> >>
>> >> Please show us the code that you used that failed. There are several
>> >> different graphics systems in R, and the answer depends on which
>> >> system you use.
>> >>
>> >> Cheers,
>> >> Bert
>> >> Bert Gunter
>> >>
>> >> "Data is not information. Information is not knowledge. And knowledge
>> >> is certainly not wisdom."
>> >>-- Clifford Stoll
>> >>
>> >>
>> >> On Wed, Sep 2, 2015 at 8:21 AM, Romana Shehla 
>> >> wrote:
>> >> > Sir/Madam,
>> >> >
>> >> >   I am a scholar at Aligarh Muslim University and have been
>> >> > continuously using R language. Recently, I am stuck on labeling axis
>> >> > of
>> >> > the
>> >> > graphic, I have made. Actually, I want to use mathematical notation
>> >> >  0> >> > unable
>> >> > to show the interval (0,1) .  I would be really grateful if you could
>> >> > help
>> >> > me with this problem.
>> >> > Waiting for your reply
>> >> >
>> >> > With regards,
>> >> > Romana Shehla
>> >> > Research Scholar
>> >> > AMU
>> >> >
>> >> > [[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] How to use dwish in MCMCpack in R

2015-09-03 Thread Duncan Murdoch
On 03/09/2015 9:29 AM, Anamika Chaudhuri wrote:
> Hi All:
> 
> I am trying to use the dwish function in the MCMCpack in R
> 
> dwish(W, v, S) where
> 
> Arguments
> W-Positive definite matrix W
> v-Degrees of freedom (scalar).
> S-Inverse scale matrix
> 
> How do I determine W, the positive definite matrix. The matrix provided in
> the documentation doesnot help.

Your question doesn't make sense.  You want to compute the density of a
Wishart distribution.  That's a distribution of matrices.  So you just
put in the matrix at which you want to compute the density.

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] How to use dwish in MCMCpack in R

2015-09-03 Thread Duncan Murdoch
On 03/09/2015 12:41 PM, Anamika Chaudhuri wrote:
> I put in the matrix at which I want the density as S. I was wondering
> what is W then?

You need to read the help page.  The matrix at which you want the
density is W.  S is a parameter of the distribution.

Duncan Murdoch

> 
> Thanks
> Anamika
> 
> On Thu, Sep 3, 2015 at 12:28 PM, Duncan Murdoch
> > wrote:
> 
> On 03/09/2015 9:29 AM, Anamika Chaudhuri wrote:
> > Hi All:
> >
> > I am trying to use the dwish function in the MCMCpack in R
> >
> > dwish(W, v, S) where
> >
> > Arguments
> > W-Positive definite matrix W
> > v-Degrees of freedom (scalar).
> > S-Inverse scale matrix
> >
> > How do I determine W, the positive definite matrix. The matrix provided 
> in
> > the documentation doesnot help.
> 
> Your question doesn't make sense.  You want to compute the density of a
> Wishart distribution.  That's a distribution of matrices.  So you just
> put in the matrix at which you want to compute the density.
> 
> 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.


[R] urgent question about Lmer models

2015-09-03 Thread Aline Andrey
Dear r-help,

I have a question about the std error of a lmer model with library
(LmerTest).

I have 12 sites with 6 treatments over each site. I measured some response
variable (biomass_of_insects) (with a gaussian distribution).

I did :
library (LmerTest)
model<- lmer((biomass_of_insects) ~ as.factor(treatments) + (1 | sites))

However, the response of the model show always the same std error (see
below):

Fixed effects:
   Estimate Std. Error  df t value Pr(>|t|)
(Intercept) 501.333 80.656  66.000   6.216 3.91e-08 ***
as.factor(treat)F   126.667114.065  66.000   1.1100.271
as.factor(treat)I-8.333114.065  66.000  -0.0730.942
as.factor(treat)I+F1/3  -75.000114.065  66.000  -0.6580.513
as.factor(treat)I+F2/3   18.333114.065  66.000   0.1610.873
as.factor(treat)I+F3/3   15.917114.065  66.000   0.1400.889



Do you know why std.error is always the same ?

Thank you very much,

Aline

[[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] urgent question about Lmer models

2015-09-03 Thread Ben Bolker
Bert Gunter  gmail.com> writes:

> 
> You need to consult a local statistical expert or post on a statistics
> list like stats.stackexchange.com .  This is a statistical question
> not an R question.
> 
> The answer is: Because the design is balanced and the treatment error
> is obtained from the (within site) rsd, but you will probably need
> more explanation than this.
> 
> BTW, if you haven't already done so, try making some informative
> trellised plots to understand what is going on. Formal statistical
> analysis alone can be very misleading.
> 
> Cheers,
> Bert
> 
> Bert Gunter

   That's a good explanation, very similar to the one I posted
at http://stackoverflow.com/questions/32383259/
   lmertest-package-standard-errors  (broken URL for Gmane).

  I know most people who read this message will already know this,
but (to the original poster) *please don't cross-post to R lists and
StackOverflow*; it causes wasted effort, as in this case.

  Ben Bolker

__
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] R on Windows 10

2015-09-03 Thread Martinez, Stephen Anthony - marti3sa
Please forgive me if this is the wrong place to ask or if I missed somewhere 
that it mentions this but I just wanted to make sure, does the most recent 
version of R work on windows 10? I know under the FAQ it says XP or newer but 
just wanted to confirm since windows 10 is new.

Thank you! 
-Stephen

__
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] Extracting column value from csv file according to if else and & operator

2015-09-03 Thread shawin
I should extract the value according to the condition above

On Thu, Sep 3, 2015 at 7:57 AM, Navien [via R] <
ml-node+s789695n4711782...@n4.nabble.com> wrote:

> Hi all
> I have a csv file and i would like to extract the value of it with
> specific range fof the last column for example; F>2 & F<2 & P=1, and then
> write the result to csv file.
>
> the data is :
>
> x1 x2 x3 x4 x5 x6
> 9.488404 9.470895 9.282434 9.366707 9.955383 9.640816
> 8.63063 8.558311 8.788391 8.576231 8.671588 8.84298
> 9.354749 9.367669 9.259953 9.421538 9.554635 9.603745
> 9.944864 9.950428 10.19102 10.07351 10.0327 10.13079
> Fc p
> 1.037883 0.320095
> 1.057708 0.060132
> 1.065191 0.92
>
>
>
> I tried the code bellow but , it does not work?
>
> FCPval <-
> read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv")
>
>  c=as.data.frame(FCPval)
>
> for (i in 1:rowN){if (C$F[i] >= 2 && C$F[i]<=-2&& C$p[i]<=3){
>
> dfrmPFC=data.frame(Fc=FC,p=p)}
> }
>
> the error is :
>
> Error in C$FC : object of type 'closure' is not subsettable.
>
> can i  extract the value according to the condition
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://r.789695.n4.nabble.com/Extracting-column-value-from-csv-file-according-to-if-else-and-operator-tp4711782.html
> To start a new topic under R help, email
> ml-node+s789695n789696...@n4.nabble.com
> To unsubscribe from R, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://r.789695.n4.nabble.com/Extracting-column-value-from-csv-file-according-to-if-else-and-operator-tp4711782p4711783.html
Sent from the R help mailing list archive at Nabble.com.
[[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] Extracting XML value

2015-09-03 Thread Ben Tupper
Hi,

You are very close and your understanding is correct - you need to extract the 
root node from the XMLDocument returned from xmlTreeParse.

library(XML)

txt <-  "\n\n  \n\n\n\n\n"

# parse the text tree and extract the root node
obs <- xmlRoot(xmlTreeParse(txt, useInternalNodes = TRUE, asText = TRUE))

# get the first child node of 'observation' name.  Yes, there is just one.
obs1 <- obs['observation'][[1]]

# it has no value, just attributes of which 'value' is one
xmlAttrs(obs1)[['value']]


Cheers,
Ben



On Sep 3, 2015, at 11:23 AM, Glenn Schultz  wrote:

> All,
> 
> I have made it as far as generating an api call which returns the following 
> xml
> [1] "\n realtime_start=\"2015-09-03\" realtime_end=\"2015-09-03\" 
> observation_start=\"2015-09-01\" observation_end=\"2015-09-01\" units=\"lin\" 
> output_type=\"1\" file_type=\"xml\" order_by=\"observation_date\" 
> sort_order=\"asc\" count=\"1\" offset=\"0\" limit=\"10\">\n   realtime_start=\"2015-09-03\" realtime_end=\"2015-09-03\" date=\"2015-09-01\" 
> value=\"0.46\"/>\n\n\n\n\n"
> attr(,"Content-Type")
>   charset 
> "text/xml""UTF-8" 
> 
> following DTL's presentation on the Berkley site and the package help I 
> parsed the xml
> 
> doc = xmlTreeParse(USSW10, asText = TRUE, useInternal = TRUE)
> 
> which gives
> 
>  observation_start="2015-09-01" observation_end="2015-09-01" units="lin" 
> output_type="1" file_type="xml" order_by="observation_date" sort_order="asc" 
> count="1" offset="0" limit="10">
>date="2015-09-01" value="0.46"/>
> 
> 
> finally I try to extract the value 0.46 using the xmlValue function.  I have 
> lost something in translation and I am unable to extract the value.  my 
> understanding is I have one node with no children, correct?
> 
> -Glenn
> 
> 
> __
> 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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

__
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] ggplot2 will not install after system upgrade

2015-09-03 Thread Ista Zahn
Hi Jeff,
Your chances of getting a useful response will increase if you provide
some additional information. For example, which version of R? Which
version of ggplot2? What sequence of commands produces the error? What
_exactly_ does the error message say?

Does

update.packages(ask=FALSE, checkBuilt=TRUE)
install.packages("ggplot2")

help?

Best,
Ista

On Thu, Sep 3, 2015 at 3:03 PM, Jeff Trefftzs  wrote:
> I just upgraded my laptop from Fedora Core 20 to Fedora Core 22, and
> after the upgrade R can no longer use the ggplot2 library.  The
> principal complaint seems to be that libicui18n.so.50 is not found. The
> version of libicu that is installed is version 54.  On the other hand,
> the same environment exists on my desktop computer, also with version
> 54 of libicu and all works just fine.
> Any hints?  Has anyone else seen this?
>
> Thanks,
>
> --
> Jeff Trefftzs
> http://www.trefftzs.org
>
> __
> 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] optimx parameter scale warning

2015-09-03 Thread Will Hopper
 Hi all,

I'm using optimx (version 2013.8.7) to perform parameter estimation with
the nelder-mead method, and received a warning that the parameters are on
different scales, which can hurt optimization performance on derivative
free methods. This warning is accurate as some parameters are small
(between 0 and 1) and others can be quite large.

So, I tried using the parscale option in the control list to put them on
more equal scaling. There are 8 parameters, so I supplied a vector of
length 8 to the parscale option, which if I understand correctly, would
scale the large parameters down by their starting values so everything will
start out near 1 Here is the call to optimx itself I used:

fit <- optimx(par = c(ER=.6,LR=.035,TR
=.05,FR=.1,alpha=50,lambda=.4,Tmin=.5,Tmax=40),
  fn = RT_ErrorFcn,
  method = "Nelder-Mead"
  control = list(maxit=1000,
 parscale = c(1,1,1,1,50, 1,1,40)),
  fcn = model$fn, # passed to RT_ErrorFcn
  fix = model$fixed,  #RT_ErrorFcn
  obs = data) # passed to RT_ErrorFcn


However, the warning about different parameter scales is still given. Is it
intended behavior for the warning to be given even when the parscale option
is used? Or am I misunderstanding the point of the parscale option, or
implementing it wrong?

Thanks for any info on this topic.

- Will

[[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] R on Windows 10

2015-09-03 Thread Jeff Newmiller
Apparently yes. Just this morning John Fox said he was using R 3.2.2 on Windows 
10. To be fair, he was responding to someone who was having trouble, but as 
typical there were no details.

The posting guide does recommend searching the archives before posting.
---
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
--- 
Sent from my phone. Please excuse my brevity.

On September 3, 2015 11:25:46 AM PDT, "Martinez, Stephen Anthony - marti3sa" 
 wrote:
>Please forgive me if this is the wrong place to ask or if I missed
>somewhere that it mentions this but I just wanted to make sure, does
>the most recent version of R work on windows 10? I know under the FAQ
>it says XP or newer but just wanted to confirm since windows 10 is new.
>
>Thank you! 
>-Stephen
>
>__
>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] registerDoParallel and R CMD check --as-cran errors

2015-09-03 Thread Witold E Wolski
To answer my own question. Dono if it's the right way to do... In the
example code I am using a single CPU and it works.

regards

PS. Should I have asked this question on the devel list?



On 2 September 2015 at 14:39, Witold E Wolski  wrote:

> I am testing a package with
>
> R CMD check
> and
> R CMD check --as-cran
>
> some code which is run in the examples section uses the foreach and
> doParallel package.
>
>
> When run with --as-cran I have an error.
> registerDoParallel function causes an error.
>
> Error in .check_ncores(length(names)) : 6 simultaneous processes spawned
> Calls: annotatePeptides ... registerDoParallel -> makeCluster ->
> makePSOCKcluster -> .check_ncores
>
>
> What should can I do to prevent this error and pas the --as-cran check?
>
> best regards
> Witold
>
>
> --
> Witold Eryk Wolski
>
>


-- 
Witold Eryk Wolski

[[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] R on Windows 10

2015-09-03 Thread Fox, John
Dear Jeff and Stephen,

I can confirm that I'm using R 3.2.2 (and R-devel) on two Windows 10 systems 
with no problems whatsoever. As well, although I can't be sure, I doubt that 
the problem reported earlier today (concerning the RcmdrPlugin.survival 
package) was related to use of Windows 10.

I hope this helps,
 John

---
John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.socsci.mcmaster.ca/jfox/



> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff
> Newmiller
> Sent: Thursday, September 3, 2015 4:46 PM
> To: Martinez, Stephen Anthony - marti3sa; r-help@r-project.org
> Subject: Re: [R] R on Windows 10
> 
> Apparently yes. Just this morning John Fox said he was using R 3.2.2 on
> Windows 10. To be fair, he was responding to someone who was having
> trouble, but as typical there were no details.
> 
> The posting guide does recommend searching the archives before posting.
> 
> ---
> 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
> 
> ---
> Sent from my phone. Please excuse my brevity.
> 
> On September 3, 2015 11:25:46 AM PDT, "Martinez, Stephen Anthony -
> marti3sa"  wrote:
> >Please forgive me if this is the wrong place to ask or if I missed
> >somewhere that it mentions this but I just wanted to make sure, does
> >the most recent version of R work on windows 10? I know under the FAQ
> >it says XP or newer but just wanted to confirm since windows 10 is new.
> >
> >Thank you!
> >-Stephen
> >
> >__
> >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] Converting CSV file to numeric and calculate ttest

2015-09-03 Thread shawin
dear Pikal , did you receive my last mail ?

On Thu, Sep 3, 2015 at 8:11 AM, PIKAL Petr [via R] <
ml-node+s789695n471178...@n4.nabble.com> wrote:

> Hi
>
> p value of what? How do you know that it should be 0.3?
>
> Your HTML post is mangled and almost unreadable.
>
> Your code is not reproducible, we do not have AT1.csv
>
> AT1 shall be numeric so your reading process is wrong and following
> conversion to numeric shall be umnnecessary if you read your data properly.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:[hidden email]
> ] On Behalf Of
> shawin
> > Sent: Wednesday, September 02, 2015 9:08 PM
> > To: [hidden email]
> 
> > Subject: Re: [R] Converting CSV file to numeric and calculate ttest
> >
> > p value should be 0.3
> >
> > On Wed, Sep 2, 2015 at 8:07 PM, Navien [via R] <
> > [hidden email] >
> wrote:
> >
> > > I have a csv file i convert it to numeric value , then i apply t-test
> > > , but t-test result is not correct: please could you guide me. the
> > data :
> > > ID x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 1367452_at
> > > 9.488404158 9.470895414 9.282433728 9.366707445 9.955383045
> > > 9.640816474 9.606262272 9.329651027 9.434541611 9.473922432
> > > 9.311412966
> > > 9.3154885 9.434977488 9.470895414 9.764258059 1367453_at 8.630629966
> > > 8.55831075 8.788391003 8.576231135 8.671587906
> > > 8.842979993 8.861958856 8.58330436 8.603596508 8.570129609 8.59798922
> > > 8.572686772 8.679751791 8.663950953 8.432875347 1367454_at
> > 9.354748885
> > > 9.367668838 9.259952558 9.421538213 9.554635162
> > > 9.603744578 9.452197983 9.284228877 9.404607878 9.317737979
> > > 9.343115301
> > > 9.310644266 9.27227486 9.360337823 9.44706281 1367455_at 9.944863964
> > > 9.950427516 10.19101759 10.07350804 10.03269879
> > > 10.1307908 10.03487287 9.74609383 9.886379007 9.775472567 10.036596
> > > 9.544738458 9.699611598 9.911962567 9.625804277
> > >   AT1 <-
> > > read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/AT1.csv",
> > >  stringsAsFactors=TRUE)
> > >
> > >
> > > str(AT1)
> > > matAT = data.frame(AT1[,-1])
> > > str(matAT)
> > > write.csv(matAT,"matAT.csv",row.names=FALSE)
> > > #convert the csv file to numeric
> > > matAT<-as.matrix(sapply(matAT,as.numeric))
> > > str(matAT)
> > > group<-factor(rep(c("Ob","Ln"),times=c(7,8)))
> > > t.test(matAT[1,]~group)
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > If you reply to this email, your message will be added to the
> > > discussion
> > > below:
> > >
> > > http://r.789695.n4.nabble.com/Converting-CSV-file-to-numeric-and-
> > calcu
> > > late-ttest-tp4711770.html To start a new topic under R help, email
> > > [hidden email] 
> > > To unsubscribe from R, click here
> > >
> >  > >
> > ibe_by_code=789695=c2hhd2lua2FyaW1AZ21haWwuY29tfDc4OTY5NXwtM
> > > jQ0MzkwMjQ1>
> > > .
> > > NAML
> > >
> >  > >
> > ewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces
> > > .BasicNamespace-nabble.view.web.template.NabbleNamespace-
> > nabble.naml.n
> > > amespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> > nabb
> > >
> > le.view.web.template.NodeNamespace=notify_subscribers%21na
> > > bble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> > send_instant_em
> > > ail%21nabble%3Aemail.naml>
> > >
> >
> >
> >
> >
> > --
> > View this message in context: http://r.789695.n4.nabble.com/Converting-
> > CSV-file-to-numeric-and-calculate-ttest-tp4711770p4711771.html
> > Sent from the R help mailing list archive at Nabble.com.
> >   [[alternative HTML version deleted]]
> >
> > __
> > [hidden email] 
> 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.
>
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie
> vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, 

[R] ggplot2 will not install after system upgrade

2015-09-03 Thread Jeff Trefftzs
I just upgraded my laptop from Fedora Core 20 to Fedora Core 22, and
after the upgrade R can no longer use the ggplot2 library.  The
principal complaint seems to be that libicui18n.so.50 is not found. The
version of libicu that is installed is version 54.  On the other hand,
the same environment exists on my desktop computer, also with version
54 of libicu and all works just fine.  
Any hints?  Has anyone else seen this?

Thanks,

-- 
Jeff Trefftzs
http://www.trefftzs.org

__
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 CSV file to numeric and calculate ttest

2015-09-03 Thread shawin
Oh sorry F<2 & F<-2 ,  i need to extract the row value according to the
last two column F,P and using condition ,

I attached  an test file to see the data

On Thu, Sep 3, 2015 at 8:43 AM, PIKAL Petr [via R] <
ml-node+s789695n4711787...@n4.nabble.com> wrote:

> Hi
>
> what is F?
>
> F>2 & F<2
> this is FALSE for all values of F
>
> What value you want to extract? All rows corresponding to condition or
> just values from specific column.
>
> For selection values you can use e.g. [
> data(iris)
> sel<-iris$Sepal.Width>4
> iris[sel,] or iris[sel, c(1,3,5)]
>
> Cheers
> Petr
>
> From: Shawin Karim [mailto:[hidden email]
> ]
> Sent: Thursday, September 03, 2015 9:17 AM
> To: PIKAL Petr
> Subject: Re: [R] Converting CSV file to numeric and calculate ttest
>
> I solve it , thanks  but i have an issue please :
>
>
> have a csv file and i would like to extract the value of it with specific
> range fof the last column for example; F>2 & F<2 & P=1, and then write the
> result to csv file.
>
> the data is :
> x1
>
> x2
>
> x3
>
> x4
>
> x5
>
> x6
>
> 9.488404
>
> 9.470895
>
> 9.282434
>
> 9.366707
>
> 9.955383
>
> 9.640816
>
> 8.63063
>
> 8.558311
>
> 8.788391
>
> 8.576231
>
> 8.671588
>
> 8.84298
>
> 9.354749
>
> 9.367669
>
> 9.259953
>
> 9.421538
>
> 9.554635
>
> 9.603745
>
> 9.944864
>
> 9.950428
>
> 10.19102
>
> 10.07351
>
> 10.0327
>
> 10.13079
>
>
> Fc
>
> p
>
> 1.037883
>
> 0.320095
>
> 1.057708
>
> 0.060132
>
> 1.065191
>
> 0.92
>
>
>
>
> I tried the code bellow but , it does not work?
>
> FCPval <-
> read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv")
>
>  c=as.data.frame(FCPval)
>
> for (i in 1:rowN){if (C$F[i] >= 2 && C$F[i]<=-2&& C$p[i]<=3){
>
> dfrmPFC=data.frame(Fc=FC,p=p)}
> }
>
> the error is :
>
> Error in C$FC : object of type 'closure' is not subsettable.
>
> can i  extract the value according to the condition
>
> On Thu, Sep 3, 2015 at 8:14 AM, PIKAL Petr <[hidden email]
>  email] >> wrote:
> Hi
>
> p value of what? How do you know that it should be 0.3?
>
> Your HTML post is mangled and almost unreadable.
>
> Your code is not reproducible, we do not have AT1.csv
>
> AT1 shall be numeric so your reading process is wrong and following
> conversion to numeric shall be umnnecessary if you read your data properly.
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:[hidden email]
>  email] >] On
> Behalf Of shawin
> > Sent: Wednesday, September 02, 2015 9:08 PM
> > To: [hidden email]
>  email] >
> > Subject: Re: [R] Converting CSV file to numeric and calculate ttest
> >
> > p value should be 0.3
> >
> > On Wed, Sep 2, 2015 at 8:07 PM, Navien [via R] <
> > [hidden email] 
>  >> wrote:
> >
> > > I have a csv file i convert it to numeric value , then i apply t-test
> > > , but t-test result is not correct: please could you guide me. the
> > data :
> > > ID x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 1367452_at
> > > 9.488404158 9.470895414 9.282433728 9.366707445 9.955383045
> > > 9.640816474 9.606262272 9.329651027 9.434541611 9.473922432
> > > 9.311412966
> > > 9.3154885 9.434977488 9.470895414 9.764258059 1367453_at 8.630629966
> > > 8.55831075 8.788391003 8.576231135 8.671587906
> > > 8.842979993 8.861958856 8.58330436 8.603596508 8.570129609 8.59798922
> > > 8.572686772 8.679751791 8.663950953 8.432875347 1367454_at
> > 9.354748885
> > > 9.367668838 9.259952558 9.421538213 9.554635162
> > > 9.603744578 9.452197983 9.284228877 9.404607878 9.317737979
> > > 9.343115301
> > > 9.310644266 9.27227486 9.360337823 9.44706281 1367455_at 9.944863964
> > > 9.950427516 10.19101759 10.07350804 10.03269879
> > > 10.1307908 10.03487287 9.74609383 9.886379007 9.775472567 10.036596
> > > 9.544738458 9.699611598 9.911962567 9.625804277
> > >   AT1 <-
> > > read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/AT1.csv",
> > >  stringsAsFactors=TRUE)
> > >
> > >
> > > str(AT1)
> > > matAT = data.frame(AT1[,-1])
> > > str(matAT)
> > > write.csv(matAT,"matAT.csv",row.names=FALSE)
> > > #convert the csv file to numeric
> > > matAT<-as.matrix(sapply(matAT,as.numeric))
> > > str(matAT)
> > > group<-factor(rep(c("Ob","Ln"),times=c(7,8)))
> > > t.test(matAT[1,]~group)
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > If you reply to this email, your message will be added to the
> > > discussion
> > > below:
> > >
> > > http://r.789695.n4.nabble.com/Converting-CSV-file-to-numeric-and-
> > calcu
> > > late-ttest-tp4711770.html To 

Re: [R] ggplot2 will not install after system upgrade

2015-09-03 Thread Marc Schwartz

> On Sep 3, 2015, at 2:03 PM, Jeff Trefftzs  wrote:
> 
> I just upgraded my laptop from Fedora Core 20 to Fedora Core 22, and
> after the upgrade R can no longer use the ggplot2 library.  The
> principal complaint seems to be that libicui18n.so.50 is not found. The
> version of libicu that is installed is version 54.  On the other hand,
> the same environment exists on my desktop computer, also with version
> 54 of libicu and all works just fine.  
> Any hints?  Has anyone else seen this?
> 
> Thanks,


Jeff,

How did you install R (RPM or compiled source) and did you re-install after the 
F22 upgrade, or just upgrade from F20 to F22 in place?

Since F20 EOL’d this summer, you would likely need to install current R RPMs 
built for F22, after the upgrade and/or rebuild R from source post the F22 
upgrade.

My guess is a version incompatibility issue, where you are running a version of 
R built for F20 on F22.

Regards,

Marc Schwartz

__
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 CSV file to numeric and calculate ttest

2015-09-03 Thread PIKAL Petr
Hi

what is F?

F>2 & F<2
this is FALSE for all values of F

What value you want to extract? All rows corresponding to condition or just 
values from specific column.

For selection values you can use e.g. [
data(iris)
sel<-iris$Sepal.Width>4
iris[sel,] or iris[sel, c(1,3,5)]

Cheers
Petr

From: Shawin Karim [mailto:shawinka...@gmail.com]
Sent: Thursday, September 03, 2015 9:17 AM
To: PIKAL Petr
Subject: Re: [R] Converting CSV file to numeric and calculate ttest

I solve it , thanks  but i have an issue please :


have a csv file and i would like to extract the value of it with specific range 
fof the last column for example; F>2 & F<2 & P=1, and then write the result to 
csv file.

the data is :
x1

x2

x3

x4

x5

x6

9.488404

9.470895

9.282434

9.366707

9.955383

9.640816

8.63063

8.558311

8.788391

8.576231

8.671588

8.84298

9.354749

9.367669

9.259953

9.421538

9.554635

9.603745

9.944864

9.950428

10.19102

10.07351

10.0327

10.13079


Fc

p

1.037883

0.320095

1.057708

0.060132

1.065191

0.92




I tried the code bellow but , it does not work?

FCPval <- read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv")

 c=as.data.frame(FCPval)

for (i in 1:rowN){if (C$F[i] >= 2 && C$F[i]<=-2&& C$p[i]<=3){

dfrmPFC=data.frame(Fc=FC,p=p)}
}

the error is :

Error in C$FC : object of type 'closure' is not subsettable.

can i  extract the value according to the condition

On Thu, Sep 3, 2015 at 8:14 AM, PIKAL Petr 
> wrote:
Hi

p value of what? How do you know that it should be 0.3?

Your HTML post is mangled and almost unreadable.

Your code is not reproducible, we do not have AT1.csv

AT1 shall be numeric so your reading process is wrong and following conversion 
to numeric shall be umnnecessary if you read your data properly.

Cheers
Petr

> -Original Message-
> From: R-help 
> [mailto:r-help-boun...@r-project.org] On 
> Behalf Of shawin
> Sent: Wednesday, September 02, 2015 9:08 PM
> To: r-help@r-project.org
> Subject: Re: [R] Converting CSV file to numeric and calculate ttest
>
> p value should be 0.3
>
> On Wed, Sep 2, 2015 at 8:07 PM, Navien [via R] <
> ml-node+s789695n4711770...@n4.nabble.com>
>  wrote:
>
> > I have a csv file i convert it to numeric value , then i apply t-test
> > , but t-test result is not correct: please could you guide me. the
> data :
> > ID x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 1367452_at
> > 9.488404158 9.470895414 9.282433728 9.366707445 9.955383045
> > 9.640816474 9.606262272 9.329651027 9.434541611 9.473922432
> > 9.311412966
> > 9.3154885 9.434977488 9.470895414 9.764258059 1367453_at 8.630629966
> > 8.55831075 8.788391003 8.576231135 8.671587906
> > 8.842979993 8.861958856 8.58330436 8.603596508 8.570129609 8.59798922
> > 8.572686772 8.679751791 8.663950953 8.432875347 1367454_at
> 9.354748885
> > 9.367668838 9.259952558 9.421538213 9.554635162
> > 9.603744578 9.452197983 9.284228877 9.404607878 9.317737979
> > 9.343115301
> > 9.310644266 9.27227486 9.360337823 9.44706281 1367455_at 9.944863964
> > 9.950427516 10.19101759 10.07350804 10.03269879
> > 10.1307908 10.03487287 9.74609383 9.886379007 9.775472567 10.036596
> > 9.544738458 9.699611598 9.911962567 9.625804277
> >   AT1 <-
> > read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/AT1.csv",
> >  stringsAsFactors=TRUE)
> >
> >
> > str(AT1)
> > matAT = data.frame(AT1[,-1])
> > str(matAT)
> > write.csv(matAT,"matAT.csv",row.names=FALSE)
> > #convert the csv file to numeric
> > matAT<-as.matrix(sapply(matAT,as.numeric))
> > str(matAT)
> > group<-factor(rep(c("Ob","Ln"),times=c(7,8)))
> > t.test(matAT[1,]~group)
> >
> >
> >
> >
> >
> >
> >
> > --
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> >
> > http://r.789695.n4.nabble.com/Converting-CSV-file-to-numeric-and-
> calcu
> > late-ttest-tp4711770.html To start a new topic under R help, email
> > ml-node+s789695n789696...@n4.nabble.com
> > To unsubscribe from R, click here
> >
>  >
> ibe_by_code=789695=c2hhd2lua2FyaW1AZ21haWwuY29tfDc4OTY5NXwtM
> > jQ0MzkwMjQ1>
> > .
> > NAML
> >
>  >
> ewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces
> > .BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.naml.n
> > amespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabb
> >
> le.view.web.template.NodeNamespace=notify_subscribers%21na
> > bble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> send_instant_em
> > ail%21nabble%3Aemail.naml>
> >
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Converting-
> 

Re: [R] Converting CSV file to numeric and calculate ttest

2015-09-03 Thread PIKAL Petr
Hi

p value of what? How do you know that it should be 0.3?

Your HTML post is mangled and almost unreadable.

Your code is not reproducible, we do not have AT1.csv

AT1 shall be numeric so your reading process is wrong and following conversion 
to numeric shall be umnnecessary if you read your data properly.

Cheers
Petr

> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of shawin
> Sent: Wednesday, September 02, 2015 9:08 PM
> To: r-help@r-project.org
> Subject: Re: [R] Converting CSV file to numeric and calculate ttest
>
> p value should be 0.3
>
> On Wed, Sep 2, 2015 at 8:07 PM, Navien [via R] <
> ml-node+s789695n4711770...@n4.nabble.com> wrote:
>
> > I have a csv file i convert it to numeric value , then i apply t-test
> > , but t-test result is not correct: please could you guide me. the
> data :
> > ID x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 1367452_at
> > 9.488404158 9.470895414 9.282433728 9.366707445 9.955383045
> > 9.640816474 9.606262272 9.329651027 9.434541611 9.473922432
> > 9.311412966
> > 9.3154885 9.434977488 9.470895414 9.764258059 1367453_at 8.630629966
> > 8.55831075 8.788391003 8.576231135 8.671587906
> > 8.842979993 8.861958856 8.58330436 8.603596508 8.570129609 8.59798922
> > 8.572686772 8.679751791 8.663950953 8.432875347 1367454_at
> 9.354748885
> > 9.367668838 9.259952558 9.421538213 9.554635162
> > 9.603744578 9.452197983 9.284228877 9.404607878 9.317737979
> > 9.343115301
> > 9.310644266 9.27227486 9.360337823 9.44706281 1367455_at 9.944863964
> > 9.950427516 10.19101759 10.07350804 10.03269879
> > 10.1307908 10.03487287 9.74609383 9.886379007 9.775472567 10.036596
> > 9.544738458 9.699611598 9.911962567 9.625804277
> >   AT1 <-
> > read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/AT1.csv",
> >  stringsAsFactors=TRUE)
> >
> >
> > str(AT1)
> > matAT = data.frame(AT1[,-1])
> > str(matAT)
> > write.csv(matAT,"matAT.csv",row.names=FALSE)
> > #convert the csv file to numeric
> > matAT<-as.matrix(sapply(matAT,as.numeric))
> > str(matAT)
> > group<-factor(rep(c("Ob","Ln"),times=c(7,8)))
> > t.test(matAT[1,]~group)
> >
> >
> >
> >
> >
> >
> >
> > --
> > If you reply to this email, your message will be added to the
> > discussion
> > below:
> >
> > http://r.789695.n4.nabble.com/Converting-CSV-file-to-numeric-and-
> calcu
> > late-ttest-tp4711770.html To start a new topic under R help, email
> > ml-node+s789695n789696...@n4.nabble.com
> > To unsubscribe from R, click here
> >
>  >
> ibe_by_code=789695=c2hhd2lua2FyaW1AZ21haWwuY29tfDc4OTY5NXwtM
> > jQ0MzkwMjQ1>
> > .
> > NAML
> >
>  >
> ewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces
> > .BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabble.naml.n
> > amespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-
> nabb
> >
> le.view.web.template.NodeNamespace=notify_subscribers%21na
> > bble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-
> send_instant_em
> > ail%21nabble%3Aemail.naml>
> >
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Converting-
> CSV-file-to-numeric-and-calculate-ttest-tp4711770p4711771.html
> Sent from the R help mailing list archive at Nabble.com.
>   [[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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly 

Re: [R] spatial estimation

2015-09-03 Thread Roger Bivand
fabrizio renzi  gmail.com> writes:

> 
> I am using spdep package to do spatial estimations in R.
> 
> Anyway I was not able to find out how to compute the loglikelihood (and a
> pseudo-R^2) of a 2sls spatial model, estimated through the command stsls. I
> need some fitting indicator to compare the 2sls model with the one obtained
> through maxL (command lagsarlm).
> 

When the poster wrote to me off-list a week ago, I replied:

"Please *do* write to the R-sig-geo list rather than to me directly -
others can answer your question as well, perhaps better, and in a more
timely way than I can. In addition, threads in the list can be searched in
the archives, so others can avoid the same problem later.

Please when you post indicate the published paper defining the LL of this
GMM-estimated model."

It is instructive to run:

library(sem)
logLik(tsls(Q ~ P + D, ~ D + F + A, data=Kmenta))

which explains why I asked for a publication providing something which
doesn't spring naturally from the estimation method.

Roger Bivand



> Thanks for your answer,
> 
> Regards
>

__
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] merge xts objects with different data types ?

2015-09-03 Thread ce

Hello

Let's say some questions about merging  xts variables :

a<- xts("abc", Sys.Date())
b <- xts("def", Sys.Date())
c <- xts(1, Sys.Date())

> merge(a,b)
   a b
2015-09-03 "abc" "def"
> merge(a,b,c)
a  b c
2015-09-03 NA NA 1
Warning messages:
1: In merge.xts(a, b, c) : NAs introduced by coercion
2: In merge.xts(a, b, c) : NAs introduced by coercion
3: In merge.xts(a, b, c) : NAs introduced by coercion
4: In merge.xts(a, b, c) : NAs introduced by coercion

How I can merge  a, b ,c correctly ? Another example is with Binary variables :

> e<- xts(TRUE, Sys.Date())
> e
   [,1]
2015-09-03 TRUE
> merge(e,b)
   e  b
2015-09-03 1 NA
Warning message:
In merge.xts(e, b) : NAs introduced by coercion


My second question is how I can convert an xts object to factor :

> d <- merge(a,b)
> d
   a b
2015-09-03 "abc" "def"
> factor(d, levels = c("abc","def"))
  a   b 
abc def 
Levels: abc def

Date disappears here?

Thanks for your help
ce

__
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] R on Windows 10

2015-09-03 Thread Miloš Žarković
R, Rstudio and Rcommander work on windows 10 without problems
On 3 Sep 2015 22:11, "Martinez, Stephen Anthony - marti3sa" <
marti...@dukes.jmu.edu> wrote:

> Please forgive me if this is the wrong place to ask or if I missed
> somewhere that it mentions this but I just wanted to make sure, does the
> most recent version of R work on windows 10? I know under the FAQ it says
> XP or newer but just wanted to confirm since windows 10 is new.
>
> Thank you!
> -Stephen
>
> __
> 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] Extracting XML value

2015-09-03 Thread Glenn Schultz

All,

I have made it as far as generating an api call which returns the following xml
[1] "\n\n  \n\n\n\n\n"
attr(,"Content-Type")
              charset 
"text/xml"    "UTF-8" 

following DTL's presentation on the Berkley site and the package help I parsed 
the xml

doc = xmlTreeParse(USSW10, asText = TRUE, useInternal = TRUE)

which gives


  


finally I try to extract the value 0.46 using the xmlValue function.  I have 
lost something in translation and I am unable to extract the value.  my 
understanding is I have one node with no children, correct?

-Glenn


__
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 CSV file to numeric and calculate ttest

2015-09-03 Thread shawin
Dear Petr,

This code does not work ?
For selection values you can use e.g. [
data(iris)
sel<-iris$Sepal.Width>4
iris[sel,] or iris[sel, c(1,3,5)]


the data is csv file which is :
FCPval <- read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv")

;

Fc2<-(FCPVal$Fc>=2 | FCPval<=-2);  this will just come out , true false
 not extracting the Fc  ,
#
FCP<-as.matrix(sapply(FCPval,as.numeric))
A=as.data.frame(FCP)
Fc2<-(A$Fc>=1.3| A$Fc<=-1.3) & A$p=0.05;  // has error when i combine
condition

Error in (Fc2 <- (A$Fc >= 1.3 | A$Fc <= -1.3) & A$p) = 0.05 :
  could not find function "<-<-"

write.csv(Fc2,"Fc2.csv",row.names =FALSE )

please need help


On Thu, Sep 3, 2015 at 8:56 AM, Shawin Karim  wrote:

> Oh sorry F<2 & F<-2 ,  i need to extract the row value according to the
> last two column F,P and using condition ,
>
> I attached  an test file to see the data
>
> On Thu, Sep 3, 2015 at 8:43 AM, PIKAL Petr [via R] <
> ml-node+s789695n4711787...@n4.nabble.com> wrote:
>
>> Hi
>>
>> what is F?
>>
>> F>2 & F<2
>> this is FALSE for all values of F
>>
>> What value you want to extract? All rows corresponding to condition or
>> just values from specific column.
>>
>> For selection values you can use e.g. [
>> data(iris)
>> sel<-iris$Sepal.Width>4
>> iris[sel,] or iris[sel, c(1,3,5)]
>>
>> Cheers
>> Petr
>>
>> From: Shawin Karim [mailto:[hidden email]
>> ]
>> Sent: Thursday, September 03, 2015 9:17 AM
>> To: PIKAL Petr
>> Subject: Re: [R] Converting CSV file to numeric and calculate ttest
>>
>> I solve it , thanks  but i have an issue please :
>>
>>
>> have a csv file and i would like to extract the value of it with specific
>> range fof the last column for example; F>2 & F<2 & P=1, and then write the
>> result to csv file.
>>
>> the data is :
>> x1
>>
>> x2
>>
>> x3
>>
>> x4
>>
>> x5
>>
>> x6
>>
>> 9.488404
>>
>> 9.470895
>>
>> 9.282434
>>
>> 9.366707
>>
>> 9.955383
>>
>> 9.640816
>>
>> 8.63063
>>
>> 8.558311
>>
>> 8.788391
>>
>> 8.576231
>>
>> 8.671588
>>
>> 8.84298
>>
>> 9.354749
>>
>> 9.367669
>>
>> 9.259953
>>
>> 9.421538
>>
>> 9.554635
>>
>> 9.603745
>>
>> 9.944864
>>
>> 9.950428
>>
>> 10.19102
>>
>> 10.07351
>>
>> 10.0327
>>
>> 10.13079
>>
>>
>> Fc
>>
>> p
>>
>> 1.037883
>>
>> 0.320095
>>
>> 1.057708
>>
>> 0.060132
>>
>> 1.065191
>>
>> 0.92
>>
>>
>>
>>
>> I tried the code bellow but , it does not work?
>>
>> FCPval <-
>> read.csv("C:/Users/shawin/Desktop/RProgramms/RAdipose/FCPval.csv")
>>
>>  c=as.data.frame(FCPval)
>>
>> for (i in 1:rowN){if (C$F[i] >= 2 && C$F[i]<=-2&& C$p[i]<=3){
>>
>> dfrmPFC=data.frame(Fc=FC,p=p)}
>> }
>>
>> the error is :
>>
>> Error in C$FC : object of type 'closure' is not subsettable.
>>
>> can i  extract the value according to the condition
>>
>> On Thu, Sep 3, 2015 at 8:14 AM, PIKAL Petr <[hidden email]
>> > email] >> wrote:
>> Hi
>>
>> p value of what? How do you know that it should be 0.3?
>>
>> Your HTML post is mangled and almost unreadable.
>>
>> Your code is not reproducible, we do not have AT1.csv
>>
>> AT1 shall be numeric so your reading process is wrong and following
>> conversion to numeric shall be umnnecessary if you read your data properly.
>>
>> Cheers
>> Petr
>>
>> > -Original Message-
>> > From: R-help [mailto:[hidden email]
>> > email] >] On
>> Behalf Of shawin
>> > Sent: Wednesday, September 02, 2015 9:08 PM
>> > To: [hidden email]
>> > email] >
>> > Subject: Re: [R] Converting CSV file to numeric and calculate ttest
>> >
>> > p value should be 0.3
>> >
>> > On Wed, Sep 2, 2015 at 8:07 PM, Navien [via R] <
>> > [hidden email] 
>> > >> wrote:
>> >
>> > > I have a csv file i convert it to numeric value , then i apply t-test
>> > > , but t-test result is not correct: please could you guide me. the
>> > data :
>> > > ID x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 1367452_at
>> > > 9.488404158 9.470895414 9.282433728 9.366707445 9.955383045
>> > > 9.640816474 9.606262272 9.329651027 9.434541611 9.473922432
>> > > 9.311412966
>> > > 9.3154885 9.434977488 9.470895414 9.764258059 1367453_at 8.630629966
>> > > 8.55831075 8.788391003 8.576231135 8.671587906
>> > > 8.842979993 8.861958856 8.58330436 8.603596508 8.570129609 8.59798922
>> > > 8.572686772 8.679751791 8.663950953 8.432875347 1367454_at
>> > 9.354748885
>> > > 9.367668838 9.259952558 9.421538213 9.554635162
>> > > 9.603744578 9.452197983 9.284228877 

[R] file.show cleanup

2015-09-03 Thread Dan D
The file.show() function seems to be exactly what I'm needing for displaying
file contents for users, but I need something like "file.close()" to close
the "R Information" window to clean up afterwards. Does anyone know if there
is such a thing?

-Dan



--
View this message in context: 
http://r.789695.n4.nabble.com/file-show-cleanup-tp4711824.html
Sent from the R help mailing list archive at Nabble.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] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-03 Thread Fox, John
Dear Joyaa,

> -Original Message-
> From: Joyaa Antares [mailto:jo...@goldcoastosteopathy.com.au]
> Sent: September 3, 2015 9:37 PM
> To: Fox, John 
> Cc: r-help@r-project.org
> Subject: Re: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 
> 10
> 
> Dear John, Dear List,
> 
> Thank you for responding.  Like you, I have tried uninstalling R and 
> reinstalling
> again.  Question 1: having uninstalled R, how do you delete the package 
> library?

You say below that you installed R packages when R was run as administrator and 
that you took all defaults. In that case,  the installed packages will be in 
C:\Program Files\R\R-3.2.2\library . Just delete the library directory, which 
will still be there after R 3.2.2 is uninstalled. I do recommend, by the way, 
that, for using the Rcmdr, you install R with the SDI rather than the default 
MDI, but that doesn't explain your difficulties.

> 
> I have used defaults throughout the process, except for running the whole 
> things
> as Administrator rather than a User.  For the mirror, my first two install 
> attempts
> were via a mirror in Germany.  My 3rd and 4th attempts via Cambridge, UK.
> 
> Perhaps importantly: the first time I ran the RcmdrPlugin.survival plug-in it
> worked fine.  

If you said that before, I missed it. 

> I got half way through the exercise I was attempting, then closed
> the programs for the night.  The next day, when I tried to reload the plugin 
> from
> R Commander, the plugin asked me to restart R Commander, but on opting for
> "Yes", this is when R Commander does not open properly.

Here's my hypothesis: When you "closed" R, you saved the R workspace. My guess 
is that this is the source of your problem. If so, the saved workspace is in 
the file .RData in your home directory; delete it and try again.

If this works, in future, exit from the Rcmdr and R via the Rcmdr menus (or if 
closing R directly, don't save the workspace).

I hope this helps,
 John

-
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
Web: socserv.mcmaster.ca/jfox


> 
> My thanks to you and the list for your time.  Joyaa (Gold Coast, Queensland,
> Australia)
> 
> -Original Message-
> From: Fox, John
> Sent: Friday, September 4, 2015 1:29 AM
> To: Joyaa Antares
> Cc: r-help@r-project.org
> Subject: RE: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows
> 10
> 
> Dear Joyaa,
> 
> I too run R 3.2.2 on a Windows 10 system. I uninstalled R, deleted my package
> library, and then reinstalled R and the Rcmdr and RcmdrPlugin.survival 
> packages.
> I took all defaults, except that I selected the SDI rather than the default 
> MDI for
> Rgui, but I seriously doubt that this is the source of your problem. I used 
> the 0-
> Cloud mirror, both for R
> 3.2.2 and for packages.
> 
> I'm afraid that I can't duplicate your problem -- everything works perfectly 
> fine
> for me.
> 
> You provided a reasonable amount of detail, but is there anything else you can
> add?
> 
> Best,
> John
> 
> -
> John Fox, Professor
> McMaster University
> Hamilton, Ontario
> Canada L8S 4M4
> web: socserv.mcmaster.ca/jfox
> 
> 
> 
> From: R-help [r-help-boun...@r-project.org] on behalf of Joyaa Antares
> [jo...@goldcoastosteopathy.com.au]
> Sent: September 3, 2015 8:31 AM
> To: r-help@r-project.org
> Subject: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10
> 
> Hello r-help,
> 
> I am quite new to R.  I downloaded R 3.2.2 for Windows to use with Windows
> 10.
> 
> On attempting to load the RcmdrPlugin.survival plug-in I got this error
> message:
> 
> Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
>   [tcl] invalid command name "configure".
> 
> The lead-up to this was:
> 
> * I uninstalled R 3.2.2 and deleted all R files I could find.
> * Downloaded R 3.2.2 to do a fresh install
> * Opened the .exe file as Administrator
> * Ran 64-bit R as Administrator
> * Updated all packages
> * Installed Rcmdr and RcmdrPlugin.survival
> * Ran Rcmdr using library(Rcmdr) from the console
> * This required an install of a host of packages, which I installed
> * Loaded RcmdrPlugin.survival from the Tools menu
> * I was asked to restart R commander, and when I tried it didn't open properly
> (showing only File/Edit/Data in the menu bar), and this wouldn't close 
> properly
> either.  The error message as above showed in the console.
> 
> I haven't posted to the list before and would be very grateful for help.
> Thank you.   Joyaa
> [[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] ggplot2 will not install after system upgrade

2015-09-03 Thread Jeff Trefftzs
On Thu, 2015-09-03 at 16:47 -0400, Ista Zahn wrote:
> Hi Jeff,
> Your chances of getting a useful response will increase if you
> provide
> some additional information. For example, which version of R? Which
> version of ggplot2? 


Sorry.  R was version 3.2.1
ggplot2 1.0.1

> What sequence of commands produces the error?

install.packages("ggplot2") (or various equivalents while in R-Studio

> What
> _exactly_ does the error message say?

I was working on my laptop, where I didn't have email enabled, so I was
unable to cut & paste all the output.  The last bit of the error
messages boiled down to "unable to find libicui18n.so.50.  No such file
or directory"

Does
> update.packages(ask=FALSE, checkBuilt=TRUE)
> install.packages("ggplot2")

I hadn't tried that.  

Follow-up:  On the laptop I downgraded to R-3.1.3 and things worked
again.  The various error messages I got were confusing.  When I tried
to install ggplot2 from the first US mirror the https server at
Berkeley), it told me "gplot2 not available for R 3.2.1".  When I tried
one of the other servers (e.g., other Berkeley server, or the UCLA
server) it would download, and come to grief with the libicu message.

But downgrading to R 3.1.3 seems to have cured things.

I'm still baffled, however, since I'm writing this on my desktop
computer which has R version 3.2.1 and a successful install of ggplot2
-1.0.1 actually working.

-- 
Jeff Trefftzs
http://www.trefftzs.org

__
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] Pairwise comparisons, adonis (Vegan)

2015-09-03 Thread Hazel Knipe
Hello all, 
 
I am an undergraduate, so bare with me if I don't make complete sense! 
 
I have performed a permanova using the function Adonis (vegan), to test for 
significant difference in OTU datasets from different species (n=5) at 
different sites (n=6) with a total of 20 libraries (unbalanced). I have got a 
significant result, but I would like to know which species/ sites are causing 
this result.
 
adonis(formula = vegdist(comm, method = "bray") ~ Species, data = metadata, 
strata = Site) 
 
I have heard you can run multiple adonis tests, and then adjust the P value 
(which correction?), although I am not sure my reduced datasets meet the 
assumptions, or if the permutations produce a meaningful result at such a low 
number.  
 
Does anyone know how to get around this, or if I should be using a different 
test for this data? 
 
Thank you in advance, 
 
Hazel Knipe
  
[[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] edit GUI preferences for current session?

2015-09-03 Thread Dan D
I'd like to edit the GUI preferences for the current (Windows) session via
command line rather than the Edit|GUI preferences menu. In particular, is
there a way to change the pagerstyle to singlewindow without using the menu
or editing the RConsole file?

Any ideas?

Thanks!

-Dan



--
View this message in context: 
http://r.789695.n4.nabble.com/edit-GUI-preferences-for-current-session-tp4711825.html
Sent from the R help mailing list archive at Nabble.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] merge xts objects with different data types ?

2015-09-03 Thread Jeff Newmiller
The root of your problems lie in your assumption that xts variables act like 
data frames. Instead they are matrices with an index attribute. All values in a 
matrix must be of the same storage mode. 

You might want to investigate the data.table package. It is not a time series 
object but you can still handle time series operations and you can have any 
type of data.
---
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
--- 
Sent from my phone. Please excuse my brevity.

On September 3, 2015 5:40:36 PM PDT, ce  wrote:
>
>Hello
>
>Let's say some questions about merging  xts variables :
>
>a<- xts("abc", Sys.Date())
>b <- xts("def", Sys.Date())
>c <- xts(1, Sys.Date())
>
>> merge(a,b)
>   a b
>2015-09-03 "abc" "def"
>> merge(a,b,c)
>a  b c
>2015-09-03 NA NA 1
>Warning messages:
>1: In merge.xts(a, b, c) : NAs introduced by coercion
>2: In merge.xts(a, b, c) : NAs introduced by coercion
>3: In merge.xts(a, b, c) : NAs introduced by coercion
>4: In merge.xts(a, b, c) : NAs introduced by coercion
>
>How I can merge  a, b ,c correctly ? Another example is with Binary
>variables :
>
>> e<- xts(TRUE, Sys.Date())
>> e
>   [,1]
>2015-09-03 TRUE
>> merge(e,b)
>   e  b
>2015-09-03 1 NA
>Warning message:
>In merge.xts(e, b) : NAs introduced by coercion
>
>
>My second question is how I can convert an xts object to factor :
>
>> d <- merge(a,b)
>> d
>   a b
>2015-09-03 "abc" "def"
>> factor(d, levels = c("abc","def"))
>  a   b 
>abc def 
>Levels: abc def
>
>Date disappears here?
>
>Thanks for your help
>ce
>
>__
>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] How to get filter probabilities from msmFit() of package MSwM?

2015-09-03 Thread 王柏元

Dear all:
I am a rookie in using R. I have a question: How to get filter 
probabilities from msmFit() of package MSwM?

following are my code

#Markov Switch Model
library(MSwM)
data(example)
mod<-lm(y~1,example)
mod.msm<-msmFit(mod,k=2,sw=c(T,T))
summary(mod.msm)
plotProb(mod.msm,which=1)
plotProb(mod.msm,which=2)


 
王柏元 
Paul Wang
pywan...@yahoo.com.tw

__
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] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

2015-09-03 Thread Joyaa Antares

Dear John, Dear List,

Thank you for responding.  Like you, I have tried uninstalling R and 
reinstalling again.  Question 1: having uninstalled R, how do you delete the 
package library?


I have used defaults throughout the process, except for running the whole 
things as Administrator rather than a User.  For the mirror, my first two 
install attempts were via a mirror in Germany.  My 3rd and 4th attempts via 
Cambridge, UK.


Perhaps importantly: the first time I ran the RcmdrPlugin.survival plug-in 
it worked fine.  I got half way through the exercise I was attempting, then 
closed the programs for the night.  The next day, when I tried to reload the 
plugin from R Commander, the plugin asked me to restart R Commander, but on 
opting for "Yes", this is when R Commander does not open properly.


My thanks to you and the list for your time.  Joyaa (Gold Coast, Queensland, 
Australia)


-Original Message- 
From: Fox, John

Sent: Friday, September 4, 2015 1:29 AM
To: Joyaa Antares
Cc: r-help@r-project.org
Subject: RE: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 
10


Dear Joyaa,

I too run R 3.2.2 on a Windows 10 system. I uninstalled R, deleted my 
package library, and then reinstalled R and the Rcmdr and 
RcmdrPlugin.survival packages. I took all defaults, except that I selected 
the SDI rather than the default MDI for Rgui, but I seriously doubt that 
this is the source of your problem. I used the 0-Cloud mirror, both for R 
3.2.2 and for packages.


I'm afraid that I can't duplicate your problem -- everything works perfectly 
fine for me.


You provided a reasonable amount of detail, but is there anything else you 
can add?


Best,
John

-
John Fox, Professor
McMaster University
Hamilton, Ontario
Canada L8S 4M4
web: socserv.mcmaster.ca/jfox



From: R-help [r-help-boun...@r-project.org] on behalf of Joyaa Antares 
[jo...@goldcoastosteopathy.com.au]

Sent: September 3, 2015 8:31 AM
To: r-help@r-project.org
Subject: [R] Unable to run RcmdrPlugin.survival using 3.2.2 with Windows 10

Hello r-help,

I am quite new to R.  I downloaded R 3.2.2 for Windows to use with Windows 
10.


On attempting to load the RcmdrPlugin.survival plug-in I got this error 
message:


Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") :
 [tcl] invalid command name "configure".

The lead-up to this was:

* I uninstalled R 3.2.2 and deleted all R files I could find.
* Downloaded R 3.2.2 to do a fresh install
* Opened the .exe file as Administrator
* Ran 64-bit R as Administrator
* Updated all packages
* Installed Rcmdr and RcmdrPlugin.survival
* Ran Rcmdr using library(Rcmdr) from the console
* This required an install of a host of packages, which I installed
* Loaded RcmdrPlugin.survival from the Tools menu
* I was asked to restart R commander, and when I tried it didn’t open 
properly (showing only File/Edit/Data in the menu bar), and this wouldn’t 
close properly either.  The error message as above showed in the console.


I haven’t posted to the list before and would be very grateful for help. 
Thank you.   Joyaa

   [[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] 回覆﹕ How to get filter probabilities from msmFit() of package MSwM?

2015-09-03 Thread 王柏元
By using  plotProb(mod.msm,which=2), I could only show the graph of smoothed 
probabilities. May I extract smoothed probabilities and filter probabilities 
from the msmFit()?  thank you very much.

15/9/4 (五),王柏元  寫道:

 主旨: [R] How to get filter probabilities from msmFit() of package MSwM?
 收件者: r-help@r-project.org
 日期: 2015年9月4日,五,上午9:01


 Dear all:
     I am a rookie in using R. I have a question:
 How to get filter probabilities from msmFit() of package
 MSwM?

 following are my code

 #Markov Switch Model
 library(MSwM)
 data(example)
 mod<-lm(y~1,example)
 mod.msm<-msmFit(mod,k=2,sw=c(T,T))
 summary(mod.msm)
 plotProb(mod.msm,which=1)
 plotProb(mod.msm,which=2)


  
 王柏元 
 Paul Wang
 pywan...@yahoo.com.tw

 __
 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] merge xts objects with different data types ?

2015-09-03 Thread Joshua Ulrich
On Thu, Sep 3, 2015 at 7:40 PM, ce  wrote:
>
> Hello
>
> Let's say some questions about merging  xts variables :
>
> a<- xts("abc", Sys.Date())
> b <- xts("def", Sys.Date())
> c <- xts(1, Sys.Date())
>
>> merge(a,b)
>a b
> 2015-09-03 "abc" "def"
>> merge(a,b,c)
> a  b c
> 2015-09-03 NA NA 1
> Warning messages:
> 1: In merge.xts(a, b, c) : NAs introduced by coercion
> 2: In merge.xts(a, b, c) : NAs introduced by coercion
> 3: In merge.xts(a, b, c) : NAs introduced by coercion
> 4: In merge.xts(a, b, c) : NAs introduced by coercion
>
> How I can merge  a, b ,c correctly ? Another example is with Binary variables 
> :
>
>> e<- xts(TRUE, Sys.Date())
>> e
>[,1]
> 2015-09-03 TRUE
>> merge(e,b)
>e  b
> 2015-09-03 1 NA
> Warning message:
> In merge.xts(e, b) : NAs introduced by coercion
>
xts objects are a matrix with an index attribute, and you can't mix
types in a matrix.  So all the objects you merge need to be the same
type.  For objects a, b, and c: you need to convert c to character:
storage.mode(c) <- "character"

Also, merge.xts currently only supports n-way merges integer, numeric,
and logical types (see https://github.com/joshuaulrich/xts/issues/44).
So you need to merge a and b first, then merge that result with c.
You can do that by calling merge.xts many times, or via Reduce:
merge(merge(a,b),c)
Reduce(merge, list(a,b,c))

>
> My second question is how I can convert an xts object to factor :
>
>> d <- merge(a,b)
>> d
>a b
> 2015-09-03 "abc" "def"
>> factor(d, levels = c("abc","def"))
>   a   b
> abc def
> Levels: abc def
>
> Date disappears here?
>
I'm not sure what you expected; factors don't have dates.  It's not
clear what you're trying to do here.

> Thanks for your help
> ce
>
> __
> 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.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.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] merge xts objects with different data types ?

2015-09-03 Thread ce

Thanks a lot Jeff and Joshua,
I can see why data.table can be used with dates ( still more work to make it 
work :)  )

For factors, I was hoping to get a time series of a factor ( values can be only 
"abc" or "def" category ) :

2015-09-04 "abc"
2015-09-05 "abc"
2015-09-06 "def"
2015-09-07 "abc"


-Original Message-
From: "Joshua Ulrich" [josh.m.ulr...@gmail.com]
Date: 09/03/2015 09:43 PM
To: "ce" 
CC: "R-Help" 
Subject: Re: [R] merge xts objects with different data types ?

On Thu, Sep 3, 2015 at 7:40 PM, ce  wrote:
>
> Hello
>
> Let's say some questions about merging  xts variables :
>
> a<- xts("abc", Sys.Date())
> b <- xts("def", Sys.Date())
> c <- xts(1, Sys.Date())
>
>> merge(a,b)
>a b
> 2015-09-03 "abc" "def"
>> merge(a,b,c)
> a  b c
> 2015-09-03 NA NA 1
> Warning messages:
> 1: In merge.xts(a, b, c) : NAs introduced by coercion
> 2: In merge.xts(a, b, c) : NAs introduced by coercion
> 3: In merge.xts(a, b, c) : NAs introduced by coercion
> 4: In merge.xts(a, b, c) : NAs introduced by coercion
>
> How I can merge  a, b ,c correctly ? Another example is with Binary variables 
> :
>
>> e<- xts(TRUE, Sys.Date())
>> e
>[,1]
> 2015-09-03 TRUE
>> merge(e,b)
>e  b
> 2015-09-03 1 NA
> Warning message:
> In merge.xts(e, b) : NAs introduced by coercion
>
xts objects are a matrix with an index attribute, and you can't mix
types in a matrix.  So all the objects you merge need to be the same
type.  For objects a, b, and c: you need to convert c to character:
storage.mode(c) <- "character"

Also, merge.xts currently only supports n-way merges integer, numeric,
and logical types (see https://github.com/joshuaulrich/xts/issues/44).
So you need to merge a and b first, then merge that result with c.
You can do that by calling merge.xts many times, or via Reduce:
merge(merge(a,b),c)
Reduce(merge, list(a,b,c))

>
> My second question is how I can convert an xts object to factor :
>
>> d <- merge(a,b)
>> d
>a b
> 2015-09-03 "abc" "def"
>> factor(d, levels = c("abc","def"))
>   a   b
> abc def
> Levels: abc def
>
> Date disappears here?
>
I'm not sure what you expected; factors don't have dates.  It's not
clear what you're trying to do here.

> Thanks for your help
> ce
>
> __
> 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.



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.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.