[R] Error: package 'lsei' is not installed for 'arch=i386'

2011-08-27 Thread MK
Hi guys,

I am having problem loading a package that I have installed. I have searched
some old thread but they were no help in terms of solving the problem.

I uninstalled every possible component of R and installed R 2.13 and
followed the R-faqs installation steps. Then I installed the package (lsei)
from local zip file which was installed successfully but can not be loaded
and returns the error message as titled. The zip file can be downloaded
below, it used to work fine on my old version of R (I think it was 2.9).

http://www.stat.auckland.ac.nz/~yongwang/

I've check .libPaths() as some suggested and remove the copy in the first
directory but that was the only copy that I have on the machine.

Can someone give me a direction on how I can solve this problem?

Thanks in advance.
MK

R version 2.13.1 (2011-07-08)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(lsei)
Error in library(lsei) : there is no package called 'lsei'
> utils:::menuInstallLocal()
package 'lsei' successfully unpacked and MD5 sums checked
> library(lsei)
Error: package 'lsei' is not installed for 'arch=i386'
> .libPaths()
[1] "C:/Users/user/R/win-library/2.13""C:/Program
Files/R/R-2.13.1/library"

--
View this message in context: 
http://r.789695.n4.nabble.com/Error-package-lsei-is-not-installed-for-arch-i386-tp3773012p3773012.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Strplit code

2011-09-20 Thread MK
Pardon my ignorance, but why is the do.call necessary?  why not just execute 
the rbind function?  What's the advantage in putting it in a do.call "wrapper"? 

On Sep 20, 2011, at 2:44 PM, William Dunlap  wrote:

> In S+  do.call's first argument must be a character string
> that gives the name of the function, so replace
> do.call(rbind, ...)
> with
>  do.call("rbind", ...)
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> From: Santosh [mailto:santosh2...@gmail.com]
> Sent: Tuesday, September 20, 2011 2:55 AM
> To: William Dunlap; R help
> Subject: Re: [R] Strplit code
> 
> Dear R- Splus experts,
> In R, I have frequently used do.call with strsplit. and I have a hard time 
> with Splus.. any suggestions?
> 
> for example, the R code below:
> 
> do.call(rbind,strsplit(paste(letters[1:10],c(1:10))," "))
> 
> Thanks so much,
> Santosh
> On Fri, Dec 5, 2008 at 8:51 AM, William Dunlap 
> mailto:wdun...@tibco.com>> wrote:
>  [R] Strplit code
>  pomchip at free.fr pomchip at free.fr
>  Wed Dec 3 20:52:21 CET 2008
> 
>  Dear R-users,
> 
>  The strsplit function does not exist in S-plus and I would like to
> use it. How
>  could I reproduce the function in Splus or access to its source code?
>  Thank you in advance,
> 
>  Sebastien
> strsplit() was added to S+ 8.0 (May 2007).  At the same time
> we changed the default regular expression style from 'basic'
> (a.k.a. 'obsolete') to 'extended' and we added the string functions
> sub(), gsub(), and sprintf().
> 
> S+ 8.1 is now available (as of November 2008).
> 
> Bill Dunlap
> TIBCO Software Inc - Spotfire Division
> wdunlap tibco.com
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] subsetting without losing the attributes

2012-07-17 Thread MK

Hi,

How do I use the subset function without losing the attributes?

For example,

test.df <- data.frame(a = rnorm(100), b = runif(100), c = rexp(100))
attr(test.df[, 1], "units") <- c("cm")
attr(test.df[, 2], "units") <- c("kg")
attr(test.df[, 3], "units") <- c("ha")


## We want this behavior
str(test.df[, "a", drop = FALSE])

## But not the behavior of subset
str(subset(test.df, select = a, drop = FALSE))
## Whic is equivalent to
str(test.df[TRUE, "a", drop = FALSE])

Cheers,
M

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


Re: [R] Remove rows that have repeated items in a particular column

2012-07-25 Thread MK

Very simple

mat[!duplicated(mat[, 1]), ]

M

On 26/07/12 06:50, Zhongyi Yuan wrote:

Dear R Users,

I apology for not being able to provide an adequately informative subject.
Let me describe my problem with an example.

For a matrix
*(mat <- matrix(c(1,1,2,2,2,3,3, 5,9,1,3,7,4,8), ncol = 2))*
my desired output is
*(desired <- matrix(c(1,2,3, 5,1,4), ncol = 2))*

That is, the first column is numerically grouped and only the first item in
each group is wanted.  The second column is in increasing order within each
group.  My actual data will be of size 10^6 by 100 so I am hoping to solve
this by a simple function.  Thank you very much for your help.

Best,
Zhongyi Yuan

[[alternative HTML version deleted]]

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


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


Re: [R] gamma distribution in rugarch package

2012-07-26 Thread MK
I don't think it is provided and gamma is neither a special case of ghyp 
nor ged.


Is there a reason for you to use the gamma distribution? The gamma 
distribution only has support for positive number and thus impossible 
for stock return.


Cheers,
M

On 26/07/12 09:52, saraberta wrote:

Hi guys,
does anyone know if there is the possibility to fit a gamma distribution
using ugarch?honestly i don't know if maybe is possible to fix some
parameters that reduce ghyp or ged in a gamma distribution..
thanks a lot
sara




--
View this message in context: 
http://r.789695.n4.nabble.com/gamma-distribution-in-rugarch-package-tp4637893.html
Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] R report generator (for Word)?

2012-01-01 Thread MK
Have you seen r2wd?

http://www.r-bloggers.com/exporting-r-output-to-ms-word-with-r2wd-an-example-session/



On Jan 1, 2012, at 10:50 AM, Michael  wrote:

> Happy New Year all!
> 
> I am looking for a good solution for keeping record of my experiments -
> could you please help me?
> 
> My work is about analysing data... My current work-flow:
> 
> 1. Everyday my bosses give me some small steps/tasks for analysing data -
> which are parts of one bigger/whole project.
> 2. Everyday I send tens of emails to bosses/colleagues to report my
> findings in each step.
> 3. Bosses/colleagues often respond to my findings in real-time and suggest
> new experiments/steps and ask "what-if" questions.
> 4. I often have to manually copy and paste the results from R console and
> put them into an Excel and decorate a bit and send out.
> 5. Every one week and 2 weeks, we need to present to more senior bosses
> with more nice-looking presentations which is a summary of our findings in
> those 1-2 weeks. It's this time that is most chaotic because my colleagues
> and I have to dig into all the hundreds of emails in the past 1-2 weeks and
> copy and paste and organize those data again and make a nice overall
> summary for presentation...
> 6. As I am a hard-working guy, I myself often run my own random/ad-hoc
> experiments using out-of-work time and whenever I have interesting
> findings, I will send to immediate bosses and colleagues to seek their
> comments.
> 7. All these experiments are in fact variations of different versions/ideas
> of one big/whole project. Lets say in one big project bosses/colleagues and
> I have come up with a few big ideas, then we have a few sub-projects:
> 
> MyProjectIdea1
> MyProjectIdea2
> ...
> MyProjectIdeaN
> 
> And each idea has a few variations, mostly are for answering "what-if"
> questions by varying the parameters here and there ...
> For example:
> 
> MyProjectIdea1_Variation1_WhatIfParam1ChangedTo1.2?
> ...
> ...
> etc.
> 
> 8. Most experiments run tens of minutes to many hours... and some of them
> have to run on Linux, and some others can be run on Windows. Fortunately we
> have universal paths accessible on both Windows and Linux, so those won't
> be problem...
> 
> 9. Because of the time-consuming nature of these experiments, I also save
> the images as "rData" whenever I can. However, it's necessary to keep track
> of the context where these data were generated. Otherwise even the records
> of these images won't help recall the scenario we have run...
> 
> ---
> 
> Keeping track of these changes and all kinds of "what-if"s now becomes
> increasingly a problem for me.
> 
> Some times in order to respond to a query, although I have done it before
> already, but because I didn't keep record and save the result, or even
> though I have saved the memory image yet I am not completely sure about the
> "cleanness" of the results/data,I have to redo it and wait for another few
> hours.
> 
> Is there a way that I can manage these whole processes better and be more
> productive?
> 
> I have been digging and thinking about this for while and I guess Sweave is
> the right way to go?
> 
> The problem for Sweave is that it's hard to make Latex generated pdf
> appealing to business managers... so if I keep records in Sweave/Latex for
> my own record/benefit (that's already a big benefit)... I still need to
> somehow manually copy/paste the data from Sweave/Latex/pdf into
> Word/Excel/Powerpoint in order to make a nice presentation...
> 
> I know there are some Open Office and Word version of Sweave... the problem
> is that I couldn't find many demonstrations on these topics and my question
> is: are they good and can they fulfill what we needed?
> 
> Your thoughts are greatly appreciated!
> 
> Thanks a lot!
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] The Future of R | API to Public Databases

2012-01-13 Thread MK
The WDI package on CRAN already provide access to the World Bank data 
through their API, we also have an inhouse package for FAOSTAT here at 
FAO but it is not mature enough to be released on CRAN yet.


Not sure about other international organisations but I do agree that it 
would be nice if there is a package which would make these data more 
readily to R users.



On 13/01/12 22:58, Sarah Goslee wrote:

R is Open Source. You're welcome to write tools, and submit your
package to CRAN. I think some part of this has been done, based
on questions to the list asking about those parts.

Personally, I've been using S-Plus and then R for 18 years, and never
required data from any of them. Which doesn't make it not important,
but suggests that public databases aren't the be-all and end-all for
R use.

Sarah

On Fri, Jan 13, 2012 at 4:14 PM, Benjamin Weber  wrote:

Dear R Users -

R is a wonderful software package. CRAN provides a variety of tools to
work on your data. But R is not apt to utilize all the public
databases in an efficient manner.
I observed the most tedious part with R is searching and downloading
the data from public databases and putting it into the right format. I
could not find a package on CRAN which offers exactly this fundamental
capability.
Imagine R is the unified interface to access (and analyze) all public
data in the easiest way possible. That would create a real impact,
would put R a big leap forward and would enable us to see the world
with different eyes.

There is a lack of a direct connection to the API of these databases,
to name a few:

- Eurostat
- OECD
- IMF
- Worldbank
- UN
- FAO
- data.gov
- ...

The ease of access to the data is the key of information processing with R.

How can we handle the flow of information noise? R has to give an
answer to that with an extensive API to public databases.

I would love your comments and ideas as a contribution in a vital discussion.

Benjamin



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


Re: [R] Data generation

2012-01-30 Thread MK

Assuming you want the whole data matrix coming from a single distribution.

matrix(rnorm(20 *30, 3, 1), 20, 30)


On 30/01/12 06:33, Partha Sinha wrote:

I want to generate a data matrix (20*30) having mean 3 and std
deviation 1 (normal dist).
pl help
Partha

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


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