Re: [R] Newton's method for finding roots

2009-05-17 Thread Dieter Menne
Kon Knafelman  hotmail.com> writes

> I need to use netwon's method to find the root of a polynomial, ..

It't time to get your homework date May 12 submitted.

http://markmail.org/message/x5vdbync3gxfs5hp

Dieter

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


Re: [R] Using column length in plot gives error

2009-05-17 Thread Dieter Menne
MikSmith  hsm.org.uk> writes:

> I'm trying to write a generic script for processing some data which finishes
> off with some plots. Given Im never sure how many columns will be in my
> dataframe I wanted to using the following 
> 
> plot(spectra.wavelength, cormat, type = "l", ylim=c(-1,1), xlab="Wavelength
> (nm)", ylab="Correlation")
> 
> however even if I specify as type="l" it appears plot as points (right hand
> plot). If I specify a range such as 
> 
> plot(650:700, cormat, type = "l", ylim=c(-1,1), xlab="Wavelength (nm)",
> ylab="Correlation")
> 
> it looks good (left hand plot). If I try something like:
> 

The example is not reproducible so we can only guess. I assume
spectra.wavelength is a matrix, so the matrix x/y values are plotted. 
In the second example the first parameter is definitively a vector.

Dieter

__
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] Simulation Help

2009-05-17 Thread Kon Knafelman

Hey Guys, 

i need 1000 samples of size 15, for distributions of Exp(1) and Norm(0,1). here 
is what i have done so far.For the exponential
z<-list()
for(i in 1:1000){z[[i]]=rexp(15,1)}

For the Normal
y<-list()

for(i in 1:1000){y[[i]]=rnorm(15,0,1)}


Is this correct?

after this i need to compute the statistic (n-1)S2/ ó2 , produce a probability 
histogram for this result, and superimpose the distribution over chi-squared 
with 14 degrees of freedom.

My thoughts on how to proceed is that after the statistic is calculated, i use 
the "fistdist" function? Only thing is, i am not sure how to compute the 
(n-1)S2/ ó2

If anyone could help me out that would be much appreciated.

Thanks Guys

_
[[elided Hotmail spam]]

[[elided Hotmail spam]]
=Domain_tagline&_m=EXT
[[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] Row number of minimum value?

2009-05-17 Thread MikSmith

Hi

This *must* be an insanely easy thing to work out, but I'm not too familiar
with R syntax. So how do I work out the row number (if I pass a column) of
the minimum value?? I can get the value itself from min(), but where can I
get the row??

Many thanks

mike
-- 
View this message in context: 
http://www.nabble.com/Row-number-of-minimum-value--tp23578215p23578215.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] Croston's

2009-05-17 Thread s80url

Hi, 

Can anyone advise on the most appropriate way to use the Croston's function
in the Forecast package.  I have high intermittent demand and am interested
in predicting sales trends.  Is this possible?  What is meant by this
statement in the help file: "Note that prediction intervals are not computed
as Croston's method has no underlying stochastic model."

Any help would be much appreciated.

Many Thanks

Sunil
-- 
View this message in context: 
http://www.nabble.com/Croston%27s-tp23579073p23579073.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] Kumar quantile

2009-05-17 Thread prixel

can someone please help me with this problem.

i found the density and distribution for the Kumar~(2.3,3.2), but now im
stuck on the quantile. how do i determine the quantile for kumar with
Inverse F(0.5).
im trying to use qkumar(_,2.3,3.2). but im stuck on determing the
probability vector.

thanks :)
-- 
View this message in context: 
http://www.nabble.com/Kumar-quantile-tp23580613p23580613.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] Row number of minimum value?

2009-05-17 Thread Adrian Dusa
Hi Mike,

On Sunday 17 May 2009, MikSmith wrote:
> Hi
>
> This *must* be an insanely easy thing to work out, but I'm not too familiar
> with R syntax. So how do I work out the row number (if I pass a column) of
> the minimum value?? I can get the value itself from min(), but where can I
> get the row??

Maybe this helps:
which(mycol == min(mycol))

where "mycol" is your column.
Hth,
Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd.
050025 Bucharest sector 5
Romania
Tel.:+40 21 3126618 \
 +40 21 3120210 / int.101
Fax: +40 21 3158391

__
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] Asymmetric t - copula code in R

2009-05-17 Thread Roslina Zakaria
Hi R-users,

Where can I find the code for asymmetric t-copula in R?

Thank you for any help given.


  
[[alternative HTML version deleted]]

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


Re: [R] replace "%" with "\%"

2009-05-17 Thread Michael Dewey

At 15:46 15/05/2009, Liviu Andronic wrote:

Dear all,
I'm trying to gsub() "%" with "\%" with no obvious success.


Hello Liviu,
When I posted a similar question a few years ago one helpful response 
introduced me to nchar

> nchar("%")
[1] 1
> nchar("\%")
[1] 1
Warning messages:
1: '\%' is an unrecognized escape in a character string
2: unrecognized escape removed from "\%"
> nchar("\\%")
[1] 2
>

Of course other people have already solved your specific problem but 
nchar is a handy tool I find.


(And apologies to the person who helped me last time but I cannot 
find the post in the archive for some reason and so am reluctant to 
credit them in case I got it wrong)



> temp1 <- c("mean", "sd",   "0%",   "25%",  "50%",  "75%",  "100%")
> temp1
[1] "mean" "sd"   "0%"   "25%"  "50%"  "75%"  "100%"
> gsub("%", "\%", temp1, fixed=TRUE)
[1] "mean" "sd"   "0%"   "25%"  "50%"  "75%"  "100%"
Warning messages:
1: '\%' is an unrecognized escape in a character string
2: unrecognized escape removed from "\%"

I am not quite sure on how to deal with this error message. I tried
the following
> gsub("%", "\\%", temp1, fixed=TRUE)
[1] "mean"   "sd" "0\\%"   "25\\%"  "50\\%"  "75\\%"  "100\\%"

Could anyone suggest how to obtain output similar to:
[1] "mean"   "sd" "0\%"   "25\%"  "50\%"  "75\%"  "100\%"

Thank you,
Liviu



--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail


Michael Dewey
http://www.aghmed.fsnet.co.uk

__
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] converting numeric to integer

2009-05-17 Thread Linlin Yan
On Sun, May 17, 2009 at 5:00 PM, Thomas Mang  wrote:
> Hi,
>
> Well, also not quite.
> Suppose x = 5.001 (in finite binary represenation). Then I want x ==
> 5, but that is of course an integer which is now less than the original
> numeral.
Sorry for that I haven't got what your mean exactly about the finite
binary representation, because my English is not very good. How much
is the difference of x and 5 when result must be 5?

> Your code would turn it into 6;  moreover, your code would still work on
> numeric-values, so once it gets to the interger-conversion we are back at
> where the problem started, namely at the issue of finite floating-point
> representations, which might, or might not, yield the desired integer after
> the decimal digits have been truncated.
>
> BTW, do you know why sometimes replys do not appear in the newsgroups ->
> mine to yours is not there, equally not your last response (althought the
> later might of course be the resuld because I made a mistak. in the first
> step)
The reason our last replys did not appear in the newsgroup is that you
replied to me only rather than to the maillist addres
r-h...@stat.math.ethz.ch.

>
> cheers and thanks,
> Thomas
>
>
> Linlin Yan wrote:
>>
>> I see. What you want is the integer with same sign as the original
>> numeral, and whose absolute value is the least integer which is not
>> less than absolute value of the original numeral. Am I right? I am
>> afraid that there may not be any single function could work it out.
>> But I could give the following expression:
>> sign(x) * ceiling(abs(x)),
>> which may be a little clearer.
>>
>> On Sun, May 17, 2009 at 2:02 PM, Thomas Mang  wrote:
>>
>>>
>>> Hi,
>>>
>>> ceiling would do the wrong thing for negative values. If x = -4.999,
>>> the
>>> wanted result would be -5, but ceiling makes a -4 out of it.
>>>
>>> bye,
>>> Thomas
>>>
>>> Linlin Yan wrote:
>>>

 How about ceiling(x), which return the smallest integer not less than x?

 On Sun, May 17, 2009 at 2:49 AM, Thomas Mang 
 wrote:


>
> Hello,
>
> Suppose I have x, which is a variable of class numeric. The
> calculations
> performed to yield x imply that mathematically it should be an integer
> ,
> but
> due to round-off errors, it might not be (and so in either direction).
> The
> error is however small, so round(x) will yield the appropriate integer
> value. Moreover, this integer values is guaranteed to be representable
> by
> an
> 'integer' class, that is -2^31 < x < 2^31, and logically it is an
> integer
> anyway. So I want to convert x from class 'numeric' to 'integer'. What
> is
> the most elegant, but always correct way, to achieve this conversion ?
>
> What comes to mind is of course something along:
>
> x = as.integer(round(x))
>
> I am, however, not sure if this always works, because I do not know if
> the
> round-function is guaranteed to return a numeric value which, in finite
> binary representation, is always >= the underlying mathematical
> integer.
> If
> that is however guaranteed, that would of course be a simple + elegant
> one.
>
> An alternative I came up with is:
>
> x = as.integer(round(x) + ifelse(x >= 0, 0.5, -0.5))
> Where I explicitly add a bit to ensure the finite binary representation
> must
> be >= the underlying integer, and then truncate the decimal digits.
> IMO, this one is always guaranteed to work, at least within the
> numerical
> range of what integers are limited to anyway.
>
>
> What's your opinion on the issue ?
> Any other solution ?
>
> Thanks a lot in advance and cheers,
> Thomas
>
> __
> 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] converting numeric to integer

2009-05-17 Thread Gabor Grothendieck
Try:

as.integer(x + 0.5)

assuming the calculation error is less than 0.5 .

On Sat, May 16, 2009 at 2:49 PM, Thomas Mang  wrote:
> Hello,
>
> Suppose I have x, which is a variable of class numeric. The calculations
> performed to yield x imply that mathematically it should be an integer , but
> due to round-off errors, it might not be (and so in either direction). The
> error is however small, so round(x) will yield the appropriate integer
> value. Moreover, this integer values is guaranteed to be representable by an
> 'integer' class, that is -2^31 < x < 2^31, and logically it is an integer
> anyway. So I want to convert x from class 'numeric' to 'integer'. What is
> the most elegant, but always correct way, to achieve this conversion ?
>
> What comes to mind is of course something along:
>
> x = as.integer(round(x))
>
> I am, however, not sure if this always works, because I do not know if the
> round-function is guaranteed to return a numeric value which, in finite
> binary representation, is always >= the underlying mathematical integer. If
> that is however guaranteed, that would of course be a simple + elegant one.
>
> An alternative I came up with is:
>
> x = as.integer(round(x) + ifelse(x >= 0, 0.5, -0.5))
> Where I explicitly add a bit to ensure the finite binary representation must
> be >= the underlying integer, and then truncate the decimal digits.
> IMO, this one is always guaranteed to work, at least within the numerical
> range of what integers are limited to anyway.
>
>
> What's your opinion on the issue ?
> Any other solution ?
>
> Thanks a lot in advance and cheers,
> Thomas
>
> __
> 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] converting numeric to integer

2009-05-17 Thread Thomas Mang

Hi,

The problem is, x might be negative. If x == -6.999, the result 
should be -7, not -6. That's why my original proposal had the 
ifelse-condition (one could alternatively write sign(x) * 0.5, BTW.
I agree however that in my proposal, the round(x) is redundant, one can 
use x itself as left-hand argument for the sum operation. Is there 
however still a more 'elegant' way ?


thanks,
Thomas



Gabor Grothendieck wrote:

Try:

as.integer(x + 0.5)

assuming the calculation error is less than 0.5 .

On Sat, May 16, 2009 at 2:49 PM, Thomas Mang  wrote:

Hello,

Suppose I have x, which is a variable of class numeric. The calculations
performed to yield x imply that mathematically it should be an integer , but
due to round-off errors, it might not be (and so in either direction). The
error is however small, so round(x) will yield the appropriate integer
value. Moreover, this integer values is guaranteed to be representable by an
'integer' class, that is -2^31 < x < 2^31, and logically it is an integer
anyway. So I want to convert x from class 'numeric' to 'integer'. What is
the most elegant, but always correct way, to achieve this conversion ?

What comes to mind is of course something along:

x = as.integer(round(x))

I am, however, not sure if this always works, because I do not know if the
round-function is guaranteed to return a numeric value which, in finite
binary representation, is always >= the underlying mathematical integer. If
that is however guaranteed, that would of course be a simple + elegant one.

An alternative I came up with is:

x = as.integer(round(x) + ifelse(x >= 0, 0.5, -0.5))
Where I explicitly add a bit to ensure the finite binary representation must
be >= the underlying integer, and then truncate the decimal digits.
IMO, this one is always guaranteed to work, at least within the numerical
range of what integers are limited to anyway.


What's your opinion on the issue ?
Any other solution ?

Thanks a lot in advance and cheers,
Thomas

__
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] converting numeric to integer

2009-05-17 Thread Gabor Grothendieck
Try this:

as.integer(x + sign(x) * .5)


On Sun, May 17, 2009 at 6:01 AM, Thomas Mang  wrote:
> Hi,
>
> The problem is, x might be negative. If x == -6.999, the result should
> be -7, not -6. That's why my original proposal had the ifelse-condition (one
> could alternatively write sign(x) * 0.5, BTW.
> I agree however that in my proposal, the round(x) is redundant, one can use
> x itself as left-hand argument for the sum operation. Is there however still
> a more 'elegant' way ?
>
> thanks,
> Thomas
>
>
>
> Gabor Grothendieck wrote:
>>
>> Try:
>>
>> as.integer(x + 0.5)
>>
>> assuming the calculation error is less than 0.5 .
>>
>> On Sat, May 16, 2009 at 2:49 PM, Thomas Mang  wrote:
>>>
>>> Hello,
>>>
>>> Suppose I have x, which is a variable of class numeric. The calculations
>>> performed to yield x imply that mathematically it should be an integer ,
>>> but
>>> due to round-off errors, it might not be (and so in either direction).
>>> The
>>> error is however small, so round(x) will yield the appropriate integer
>>> value. Moreover, this integer values is guaranteed to be representable by
>>> an
>>> 'integer' class, that is -2^31 < x < 2^31, and logically it is an integer
>>> anyway. So I want to convert x from class 'numeric' to 'integer'. What is
>>> the most elegant, but always correct way, to achieve this conversion ?
>>>
>>> What comes to mind is of course something along:
>>>
>>> x = as.integer(round(x))
>>>
>>> I am, however, not sure if this always works, because I do not know if
>>> the
>>> round-function is guaranteed to return a numeric value which, in finite
>>> binary representation, is always >= the underlying mathematical integer.
>>> If
>>> that is however guaranteed, that would of course be a simple + elegant
>>> one.
>>>
>>> An alternative I came up with is:
>>>
>>> x = as.integer(round(x) + ifelse(x >= 0, 0.5, -0.5))
>>> Where I explicitly add a bit to ensure the finite binary representation
>>> must
>>> be >= the underlying integer, and then truncate the decimal digits.
>>> IMO, this one is always guaranteed to work, at least within the numerical
>>> range of what integers are limited to anyway.
>>>
>>>
>>> What's your opinion on the issue ?
>>> Any other solution ?
>>>
>>> Thanks a lot in advance and cheers,
>>> Thomas
>>>
>>> __
>>> 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] Using column length in plot gives error

2009-05-17 Thread MikSmith

Hi Stephanie

Absolutely right! My CSV was imported as a factor. Reading the R FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f

I actually need to do:

as.numeric(as.character(spectra.wavelength))

to get back to my original data.

Many thanks for the pointer

mike



Stephanie Kovalchik wrote:
> 
> Is spectra.wavelength a factor? If so, plot will treat it as  
> categorical and not draw a line. Try the following modification.
> 
> plot(as.numeric(spectra.wavelength), cormat, type = "l", ylim=c(-1,1),  
> xlab="Wavelength (nm)", ylab="Correlation")
> 
> Quoting MikSmith :
> 
>>
>> Hi
>>
>> I'm trying to write a generic script for processing some data which
>> finishes
>> off with some plots. Given Im never sure how many columns will be in my
>> dataframe I wanted to using the following
>>
>> plot(spectra.wavelength, cormat, type = "l", ylim=c(-1,1),
>> xlab="Wavelength
>> (nm)", ylab="Correlation")
>>
>> however even if I specify as type="l" it appears plot as points (right
>> hand
>> plot). If I specify a range such as
>>
>> plot(650:700, cormat, type = "l", ylim=c(-1,1), xlab="Wavelength (nm)",
>> ylab="Correlation")
>>
>> it looks good (left hand plot). If I try something like:
>>
>> plot(spectra.wavelength[1]:spectra.wavelength[length(spectra.wavelength)],
>> cormat, type = "l", ylim=c(-1,1), xlab="Wavelength (nm)",
>> ylab="Correlation")
>>
>> it fails with "variable lengths differ" and when I look at
>> spectra.wavelength[1] it gives me the value but then states there are 53
>> levels.
>>
>> What does this mean and how can I get the result I want??!
>>
>> many thanks
>>
>> mike http://www.nabble.com/file/p23562717/1.pdf 1.pdf
>> --
>> View this message in context:   
>> http://www.nabble.com/Using-column-length-in-plot-gives-error-tp23562717p23562717.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-column-length-in-plot-gives-error-tp23562717p23582038.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] Row number of minimum value?

2009-05-17 Thread MikSmith

Hi Adrian

Many thanks. That works perfectly! It's easy when you know the answer :)

mike


Adrian Dusa wrote:
> 
> Hi Mike,
> 
> On Sunday 17 May 2009, MikSmith wrote:
>> Hi
>>
>> This *must* be an insanely easy thing to work out, but I'm not too
>> familiar
>> with R syntax. So how do I work out the row number (if I pass a column)
>> of
>> the minimum value?? I can get the value itself from min(), but where can
>> I
>> get the row??
> 
> Maybe this helps:
> which(mycol == min(mycol))
> 
> where "mycol" is your column.
> Hth,
> Adrian
> 
> 
> -- 
> Adrian Dusa
> Romanian Social Data Archive
> 1, Schitu Magureanu Bd.
> 050025 Bucharest sector 5
> Romania
> Tel.:+40 21 3126618 \
>  +40 21 3120210 / int.101
> Fax: +40 21 3158391
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Row-number-of-minimum-value--tp23578215p23582001.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] package for /usr/lib64/R/library/tkrplot/libs/tkrplot.so

2009-05-17 Thread Juergen Rose
Hi,

'revdep-rebuild' under GENTOO shows me
that /usr/lib64/R/library/tkrplot/libs/tkrplot.so, which was installed
at April 24th, is broken.
'ldd /usr/lib64/R/library/tkrplot/libs/tkrplot.so' shows me that
tkrplot.so needs libtcl8.4.so and libtk8.4.so, which is no more
installed since the installation of tcl,tk-8.5.7, which has happened at
april 26th.
But revdep-rebuild can't find out a gentoo-package for tkrplot.so.
That's why I assume, that tkrplot.so belongs to a CRAN package.
Also update.packages() inside R does not no that tkrplot.so is broken.

How can I find out, which CRAN package installs tkrplot.so?

Regards Juergen

__
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] replace "%" with "\%"

2009-05-17 Thread Gabor Grothendieck
Having some way to specify strings which does not involve special
interpretation of backslashes is a frequent wish list item that
would be helpful for latex, Windows path names and regular
expressions.   A review of delimiter collision approaches by
different languages can be found here:

http://en.wikipedia.org/wiki/String_literal#Delimiter_collision

I get the feeling that many people would like to see something here
but that the core group has had a hard time coming to a decision
due to the many possibilities.

On Fri, May 15, 2009 at 12:11 PM, Wacek Kusnierczyk
 wrote:
> Marc Schwartz wrote:
>>
>> On May 15, 2009, at 9:46 AM, Liviu Andronic wrote:
>>
>>> Dear all,
>>> I'm trying to gsub() "%" with "\%" with no obvious success.
 temp1 <- c("mean", "sd",   "0%",   "25%",  "50%",  "75%",  "100%")
 temp1
>>> [1] "mean" "sd"   "0%"   "25%"  "50%"  "75%"  "100%"
 gsub("%", "\%", temp1, fixed=TRUE)
>>> [1] "mean" "sd"   "0%"   "25%"  "50%"  "75%"  "100%"
>>> Warning messages:
>>> 1: '\%' is an unrecognized escape in a character string
>>> 2: unrecognized escape removed from "\%"
>>>
>>> I am not quite sure on how to deal with this error message. I tried
>>> the following
 gsub("%", "\\%", temp1, fixed=TRUE)
>>> [1] "mean"   "sd"     "0\\%"   "25\\%"  "50\\%"  "75\\%"  "100\\%"
>>>
>>> Could anyone suggest how to obtain output similar to:
>>> [1] "mean"   "sd"     "0\%"   "25\%"  "50\%"  "75\%"  "100\%"
>>>
>>> Thank you,
>>> Liviu
>>
>> Presuming that you might want to output the results to a TeX file for
>> subsequent processing, where the '%' would otherwise be a comment
>> character, the key is not to get a single '\', but a double '\\', so
>> that you then get a single '\' on output:
>>
>> temp1 <- c("mean", "sd",   "0%",   "25%",  "50%",  "75%",  "100%")
>>
>> temp2 <- gsub("%", "%", temp1)
>>
>> > temp2
>> [1] "mean"   "sd"     "0\\%"   "25\\%"  "50\\%"  "75\\%"  "100\\%"
>>
>> > cat(temp2)
>> mean sd 0\% 25\% 50\% 75\% 100\%
>>
>>
>> Remember that the single '\' is an escape character, which needs to be
>> doubled.
>>
>
> this confusing "backslash each backslashing backslash" scheme is
> idiosyncratic to r;  in many cases where one'd otherwise use a single
> backslash in a regex or a replacement string in another programming
> language, in r you have to double it.
>
> and actually, in this case you don't need four backslashes.  the
> original poster has actually had a valid solution, but he wasn't aware
> that the string "\\%", returned (not printed) by gsub includes two, not
> three characters --  thus only one backslash, not two:
>
>    cat(
>        gsub(
>            pattern='%',
>            replacement='\\%',
>            x='foo % bar',
>            fixed=TRUE))
>    # foo \% bar
>
> of course, if the pattern cannot be fixed, i.e., fixed=TRUE is less than
> helpful, you'd need four backslashes in the replacement -- a cute,
> though somewhat disturbing, weirdo.
>
> vQ
>
> __
> 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] Row number of minimum value?

2009-05-17 Thread Uwe Ligges



Adrian Dusa wrote:

Hi Mike,

On Sunday 17 May 2009, MikSmith wrote:

Hi

This *must* be an insanely easy thing to work out, but I'm not too familiar
with R syntax. So how do I work out the row number (if I pass a column) of
the minimum value?? I can get the value itself from min(), but where can I
get the row??


Maybe this helps:
which(mycol == min(mycol))



... or which.min(mycol) for short.

Uwe Ligges




where "mycol" is your column.
Hth,
Adrian




__
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] wireframe 3-D problems

2009-05-17 Thread Xu Jun
Ben,

Thank you for your help!

Jun

[[alternative HTML version deleted]]

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


Re: [R] Question about barplot: gridlines & value labels

2009-05-17 Thread Jim Lemon

Dimitri Liakhovitski wrote:

Hello!
I promise I looked into help files before asking. Still cannot figure
it out. I think it's because I am totally confused what packages use
lettice, which use trellis, etc.
Sections 1 and 2 below produce the data and the data to plot. My
question is about barplot in Section 3. I am trying to:
1. add only horizontal gridlines and manipulate the type and color of
that line. tck = 1 is not flexible enough to do it.
2. make the legend come on top of gridlines and not under them
3. add plotted Y values above the bars

Thank you very much for any pointers!
Dimitri

### Section 1: generates my data set "data":

N<-100
myset1<-c(1,2,3,4,5)
probs1<-c(.05,.10,.15,.40,.30)

group<-unlist(lapply(1:4,function(x){
out<-rep(x,25)
return(out)
}))
set.seed(1)
a<-sample(myset1, N, replace = TRUE,probs1)
a[which(rbinom(100,2,.01)==1)]<-NA
set.seed(12)
b<-sample(myset1, N, replace = TRUE,probs1)
b[which(rbinom(100,2,.01)==1)]<-NA
set.seed(123)
data<-data.frame(group,a=a,b=b)
data["group"]<-lapply(data["group"],function(x) {
x[x %in% 1]<-"Group 1"
x[x %in% 2]<-"Group 2"
x[x %in% 3]<-"Group 3"
x[x %in% 4]<-"Group 4"
return(x)
})
data$group<-as.factor(data$group)
lapply(data,table,exclude=NULL)

### Section 2. Creating data to plot:
table.a<-with(data,table(group,a))
table.a.percents<-apply(table.a,2,function(x){
out<-round(x*100/sum(x),1)
return(out)
})

### Section 3. Creating a plot:
barplot(table.a.percents,xlab = "Values", ylab =
"Percentages",ylim=c(0,100),axis.lty=1,legend=T,beside=T,tck = 1)

  

Hi Dimitri,
I think you will have to display the legend separately:

legend(20,90,rownames(table.a.percents),
fill=c("gray30","gray50","gray70","gray90"),bg="white")


I tried passing the bg="white" argument in barplot, but it had no 
effect. Probably gobbled by another function before it got to legend.


Jim

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


[R] (no subject)

2009-05-17 Thread Debbie Zhang

Dear R users,

I incurred some problems with importing data into R. 

i.e. If I want to import a text file or word file which contains lots of 
numerical numbers, what function should I use?

 

Please help.

 

Thanks a lot.

Debbie

_
View photos of singles in your area Click Here

au%2Fsearch%2Fsearch%2Easpx%3Fexec%3Dgo%26tp%3Dq%26gc%3D2%26tr%3D1%26lage%3D18%26uage%3D55%26cl%3D14%26sl%3D0%26dist%3D50%26po%3D1%26do%3D2%26trackingid%3D1046138%26r2s%3D1&_t=773166090&_r=Hotmail_Endtext&_m=EXT
[[alternative HTML version deleted]]

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


Re: [R] (no subject)

2009-05-17 Thread Johannes Hüsing

Debbie Zhang schrieb:

Dear R users,

I incurred some problems with importing data into R. 


i.e. If I want to import a text file or word file which contains lots of 
numerical numbers, what function should I use?

  
It does help if you read the posting guide first. In general, the file 
has to be a bit more structured than a numeric file containing lots of 
wordy words. Getting an idea of the structure of the data is important 
to anyone who wants to try to answer your question.








 


Please help.

 


Thanks a lot.

Debbie

_
View photos of singles in your area Click Here

au%2Fsearch%2Fsearch%2Easpx%3Fexec%3Dgo%26tp%3Dq%26gc%3D2%26tr%3D1%26lage%3D18%26uage%3D55%26cl%3D14%26sl%3D0%26dist%3D50%26po%3D1%26do%3D2%26trackingid%3D1046138%26r2s%3D1&_t=773166090&_r=Hotmail_Endtext&_m=EXT
[[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] Lattice scales question: using "at" when log = TRUE

2009-05-17 Thread Afshartous, David

On my machine the 10^1 tick mark does not show up.

> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] lattice_0.17-22

loaded via a namespace (and not attached):
[1] grid_2.9.0



On 5/16/09 9:03 PM, "Deepayan Sarkar"  wrote:

On 5/16/09, Afshartous, David  wrote:
>
>
>  Thanks, but even with typo corrected as below the supplied marks are not 
> followed:
>  xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE, at = 
> c(10^1,10^2, 10^2.5, 10^3
>

How so? Looks OK to me.

-Deepayan


>
>
>  
>  From: Gabor Grothendieck [ggrothendi...@gmail.com]
>  Sent: Saturday, May 16, 2009 6:11 PM
>  To: Afshartous, David
>  Cc: r-help@r-project.org
>  Subject: Re: [R] Lattice scales question: using "at" when log = TRUE
>
>
>  Your parentheses are wrong.  It should be
>
>  y = list(log = TRUE, at = ...)
>
>
>  On Sat, May 16, 2009 at 5:11 PM, Afshartous, David
>   wrote:
>  >
>  > All,
>  >
>  > I have a simple lattice plot where I have set log = TRUE for the y scale.
>  >
>  > When I attempt to change the tick locations via the "at" argument within
>  > scales, the supplied numeric vector is not followed. Any suggestions much
>  > appreciated for the example below:
>  >
>  > y = c(10^1.5, 10^2, 10^3, 10^2)
>  > t = c(1,2,3,4)
>  > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE)))
>  >
>  > ## tick marks not followed for supplied marks below:
>  > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE), at = c(10^1,
>  > 10^2, 10^2.5, 10^3)))
>  >
>  > Cheers,
>  > David
>  >
>  > PS -
>  > Another thing is that the scale is no longer in scientific notations, but
>  > that is okay since this can be fixed via the labels argument within scales:
>  > e.g., labels = c(expression(10^1), expression(10^2), ...)
>  > An example of fancy labels for log axes is on p.147 of Deepayan's Lattice
>  > book.
>  >
>  > __
>  > 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-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] Lattice scales question: using "at" when log = TRUE

2009-05-17 Thread Gabor Grothendieck
There is no reason to think it would
show up since its outside the range
of your data.

Use ylim to expand the range of the
axis if you want it.

On Sun, May 17, 2009 at 10:29 AM, Afshartous, David
 wrote:
>
> On my machine the 10^1 tick mark does not show up.
>
>> sessionInfo()
> R version 2.9.0 (2009-04-17)
> i386-apple-darwin8.11.1
>
> locale:
> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] lattice_0.17-22
>
> loaded via a namespace (and not attached):
> [1] grid_2.9.0
>
>
>
> On 5/16/09 9:03 PM, "Deepayan Sarkar"  wrote:
>
> On 5/16/09, Afshartous, David  wrote:
>>
>>
>>  Thanks, but even with typo corrected as below the supplied marks are not 
>> followed:
>>  xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE, at = 
>> c(10^1,10^2, 10^2.5, 10^3
>>
>
> How so? Looks OK to me.
>
> -Deepayan
>
>
>>
>>
>>  
>>  From: Gabor Grothendieck [ggrothendi...@gmail.com]
>>  Sent: Saturday, May 16, 2009 6:11 PM
>>  To: Afshartous, David
>>  Cc: r-help@r-project.org
>>  Subject: Re: [R] Lattice scales question: using "at" when log = TRUE
>>
>>
>>  Your parentheses are wrong.  It should be
>>
>>  y = list(log = TRUE, at = ...)
>>
>>
>>  On Sat, May 16, 2009 at 5:11 PM, Afshartous, David
>>   wrote:
>>  >
>>  > All,
>>  >
>>  > I have a simple lattice plot where I have set log = TRUE for the y scale.
>>  >
>>  > When I attempt to change the tick locations via the "at" argument within
>>  > scales, the supplied numeric vector is not followed. Any suggestions much
>>  > appreciated for the example below:
>>  >
>>  > y = c(10^1.5, 10^2, 10^3, 10^2)
>>  > t = c(1,2,3,4)
>>  > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE)))
>>  >
>>  > ## tick marks not followed for supplied marks below:
>>  > xyplot(y ~ t, type = "b", scales = list(y = list(log = TRUE), at = c(10^1,
>>  > 10^2, 10^2.5, 10^3)))
>>  >
>>  > Cheers,
>>  > David
>>  >
>>  > PS -
>>  > Another thing is that the scale is no longer in scientific notations, but
>>  > that is okay since this can be fixed via the labels argument within 
>> scales:
>>  > e.g., labels = c(expression(10^1), expression(10^2), ...)
>>  > An example of fancy labels for log axes is on p.147 of Deepayan's Lattice
>>  > book.
>>  >
>>  > __
>>  > 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-h...@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] ode first step

2009-05-17 Thread Benoit Boulinguiez

Thanks to Dieter Menne and Spencer Graves I started to get my way through
lsoda()
Now I need to use it in the nls() to assess the parameter.

I've tried with a basic example
dy/dt = K1*conc

I try to assess the value of K1 from a simulated data set with a K1 close to
2.

I'm not sure that I'm using nls() and lsoda() correctly.
Here is (I think) the best code that I've done so far even though it crashes
when I call nls()


--
x<-seq(0,10,,100)
y<-exp(2*x)
y<-rnorm(y,y,0.3*y)

test.model<-function(t,conc,parms){
dy.dt = parms["K1"]*conc
list(dy.dt)
}

require(deSolve)
foo<-lsoda(c(conc=1),times=seq(0,10,,100),test.model,parms=c(K1=2))
foo
#use of nls

func<-function(K1) {
foo<-lsoda(c(conc=1),times=seq(0,10,,100),test.model,parms=c(K1=K1))
foo[,"conc"]
}
nls(foo~func(K1),start=list(K1=1),data=data.frame(foo=y))

# have a look on the SSD
# y is the vector of real data 
SSD<-function(K1) {
sum((y-func(K1))^2)
}
data<-seq(1.5,2.1,,100)
plot(data,sapply(data,SSD),type="l")
--


Regards/Cordialement


Benoit Boulinguiez 


-Message d'origine-
De : spencerg [mailto:spencer.gra...@prodsyse.com] 
Envoyé : vendredi 15 mai 2009 05:28
À : Benoit Boulinguiez
Cc : dieter.me...@menne-biomed.de; r-help@r-project.org
Objet : Re: [R] ode first step

  Have you looked at the vignette in the deSolve package? 


   (deS <- vignette('compiledCode')) # opens a "pdf" file
   Stangle(deS$file) # writes an R script file to "getwd()" 


  In spite of the name, this vignette includes an example entirely in R.
By comparing it with your code, I see that you do NOT provide a connection
between y, parms, K1, C0, m, V, K2 and q.  Something like the following
might work: 

kinetic.model<-function(t,y,parms){
dq.dt = parms['K1']*y['C0'] - (parms['K1']*y['m']/y['V']+
parms['K2'])*y['q']
list(dq.dt)
}


  This may not be correct, but I hope the changes will help you see how
to make it work. 


  Bon Chance. 
  Spencer Graves


Benoit Boulinguiez wrote:
> As I do not thoroughly understand the way 'lsoda' works, I face some
> difficulties to 'get' myself into the function(), though I changed the
code
> as follows:
>
> --
> require(deSolve)
>
> qm<-0.36
> y0<-c(0)
> parms<-c("K1","K2")
> times<-seq(0,1,1)
> kinetic.model<-function(t,y,parms){
>   dq.dt = K1*C0 - (K1*m/V+ K2)*q
>   list(dq.dt)
>   }
>
> foo<-lsoda(y0,times,kinetic.model,parms)
>   Error in func(time, state, parms, ...) : object 'K1' not found
> --
>
> 'K1' and 'K2' are parameters but 'C' is not a parameter, it's a dependant
> variable of the time.
> I actually express it as a function of q(t) to get this new equation
>   dq/dt= K1*C0 - (K1*m/V+ K2)*q(t)
> where K1 and K2 are the unknown but desired parameters and {C0,m,V} are
> constant known values.
>
> Nevertheless, I still get this 'Error about object 'K1' not found'.
>
>
>
>
>
> Regards/Cordialement
>
>
> Benoit Boulinguiez 
>
>
> -Message d'origine-
> De : Dieter Menne [mailto:dieter.me...@menne-biomed.de] 
> Envoyé : jeudi 14 mai 2009 12:12
> À : 'Benoit Boulinguiez'
> Objet : RE: [R] ode first step
>
> Try to hide yourself inside the function(). What would you see? No K1, for
> sure, no C, no  K2.
> These are passed through parms, so parms["K1"] would work, but not for C,
> you should add it.
>
> -Original Message-
> From: Benoit Boulinguiez [mailto:benoit.boulingu...@ensc-rennes.fr]
> Sent: Thursday, May 14, 2009 11:53 AM
> To: 'Dieter Menne'
> Subject: RE: [R] ode first step
>
> --
> qm<-0.36
> y0<-c(0)
> parms<-c(K1=1,K2=1)
> times<-seq(0,1,1)
> kinetic.model<-function(t,y,parms){
>   dq.dt<- K1*C*(qm-q)-K2*q
>   list(dq.dt)
>   }
>
> require(deSolve)
> nls(foo<-lsoda(y0,times,kinetic.model,parms)
>
> __
> 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] Output of binary representation

2009-05-17 Thread Ted Harding
I am interested in studying the binary representation of numerics
(doubles) in R, so am looking for possibilities of output of the
internal binary representations. sprintf() with format "a" or "A"
is halfway there:

  sprintf("%A",pi)
# [1] "0X1.921FB54442D18P+1"

but it is in hex. 

The following illustrate the sort of thing I want:

1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
times 2

11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000

0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
times 4

(without the spaces -- only put in above for clarity).

While I could take the original output "0X1.921FB54442D18P+1" from
sprintf() and parse it out into binary using gsub() or the like,
of submit it to say an 'awk' script via an external file, this would
be a tedious business!

Is there some function already in R which outputs the bits in the
binary representation directly?

I see that Dabid Hinds asked a similar question on 17 Aug 2005:
"Raw data type transformations"

  http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html

(without, apparently, getting any response -- at any rate within
the following 3 months).

With thanks for any suggestions,
Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 17-May-09   Time: 18:23:49
-- XFMail --

__
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] bagged importance estimates in earth problem

2009-05-17 Thread Max Kuhn
>> I was trying to produced bagged importance estimates of attributes in earth 
>> using the caret package with the following commands:
>>
>>  fit2 <- bagEarth(loyalty ~ ., data=model1, B = 10)
>>  bagImpGCV <- varImp(fit2,value="gcv")
>>
>> My bootstrap estimates are produced however the second command "varImp" 
>> produces the following error:
>>
>>  Error in UseMethod("varImp") : no applicable method for "varImp"
>>
>> Not sure what is going on, any advice would be appreciated,

If you want to send me the data (off-list please) or a reproducible
example, I will take a look at it.

Max

__
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 summary and some automated t.tests.

2009-05-17 Thread David Freedman

You might want to try using a non-parametric test, such as wilcox.test.

How about some modification of the following:

d=data.frame(grp=rep(1:2,e=5),replicate(10,rnorm(100))); head(d)
lapply(d[,-1],function(.column)wilcox.test(.column~grp,data=d))

David Freedman


stephen sefick wrote:
> 
> Up and down are the treatments.  These are replicates within date for
> percent cover of habiat.  This is habitat data for a stream
> restoration - up is the unrestored and dn is the restored.  I have
> looked at the density plots and they do not look gaussian - you are
> absolutely right.  Even log(n+1) transformed they do not look
> Gaussian.  Is there some other way that I would test for a difference
> that you can think of?  My thoughts were to run a Permutation t.test,
> but I am very new to permutations, and don't know if this applies.
> The other thing that I was thinking was to use a npmanova (adonis in
> vegan) to test if the centroids of the habitat classifications were
> different.  I am in the process of working up my thesis data for
> publication in a journal (there are other very interesting pieces to
> the data set that I am working with, and this is one of the last
> things that I need to wrap up before I can start editing/rewriting my
> masters work).  Any thoughts would be greatly appreciated.
> thanks,
> 
> Stephen Sefick
> 
> 2009/5/16 Uwe Ligges :
>>
>>
>> stephen sefick wrote:
>>>
>>> I would like to preform a t.test to each of the measured variables
>>> (sand.silt etc.)
>>
>> I am a big fan of applying t.test()s, but in this case: Are you really
>> sure?
>> The integers and particularly boxplot(x) do not indicate very well that
>> the
>> variables are somehow close to Gaussian ...
>>
>>
>>> with a mean and sd for each of the treatments
>>
>> And what is the treatment???
>>
>> Best,
>> Uwe Ligges
>>
>>
>>> (up or
>>> down), and out put this as a table  I am having a hard time
>>> starting- maybe it is to close to lunch.  Any suggestions would be
>>> greatly appreciated.
>>>
>>> Stephen Sefick
>>>
>>> x <- (structure(list(sample. = structure(c(1L, 7L, 8L, 9L, 10L, 11L,
>>> 12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 1L, 7L, 8L, 9L, 10L, 11L,
>>> 12L, 13L, 14L, 2L, 3L, 4L, 5L, 6L, 25L, 28L, 29L, 30L, 31L, 32L,
>>> 33L, 34L, 35L, 26L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
>>> 26L, 27L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 26L, 15L,
>>> 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 16L, 15L, 17L, 18L, 19L,
>>> 20L, 21L, 22L, 23L, 24L, 16L, 36L, 39L, 40L, 41L, 42L, 43L, 44L,
>>> 45L, 46L, 37L, 36L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 37L,
>>> 38L), .Label = c("0805-r1", "0805-r10", "0805-r11", "0805-r12",
>>> "0805-r13", "0805-r14", "0805-r2", "0805-r3", "0805-r4", "0805-r5",
>>> "0805-r6", "0805-r7", "0805-r8", "0805-r9", "0805-u1", "0805-u10",
>>> "0805-u2", "0805-u3", "0805-u4", "0805-u5", "0805-u6", "0805-u7",
>>> "0805-u8", "0805-u9", "1005-r1", "1005-r10", "1005-r11", "1005-r2",
>>> "1005-r3", "1005-r4", "1005-r5", "1005-r6", "1005-r7", "1005-r8",
>>> "1005-r9", "1005-u1", "1005-u10", "1005-u11", "1005-u2", "1005-u3",
>>> "1005-u4", "1005-u5", "1005-u6", "1005-u7", "1005-u8", "1005-u9"
>>> ), class = "factor"), date = structure(c(2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label =
>>> c("10/1/05",
>>> "8/29/05"), class = "factor"), Replicate = c(1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
>>> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L
>>> ), site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
>>> 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
>>> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("dn", "up"
>>> ), class = "factor"), sand.silt = c(20L, 45L, 90L, 21L, 80L,
>>> 77L, 30L, 80L, 36L, 9L, 62L, 71L, 20L, 65L, 10L, 70L, 50L, 80L,
>>> 90L, 97L, 94L, 82L, 30L, 10L, 65L, 80L, 90L, 70L, 10L, 50L, 60L,
>>> 40L, 10L, 45L, 10L, 10L, 15L, 10L, 8L, 35L, 10L, 40L, 10L, 10L,
>>> 28L, 5L, 45L, 35L, 2L, 10L, 40L, 2L, 70L, 40L, 20L, 30L, 50L,
>>> 60L, 10L, 100L, 98L, 98L, 90L, 87L, 87L, 40L, 97L, 92L,

Re: [R] Output of binary representation

2009-05-17 Thread Gabor Grothendieck
gsubfn of the gsubfn package is like gsub but can take a function,
list or proto object
as the replacement instead of a character string and with a list it
can be used to
readily turn hex to binary:

> library(gsubfn)
> binary.digits <-
+ list("0"= "", "1"= "0001", "2"= "0010", "3"= "0011",
+  "4"= "0100", "5"= "0101", "6"= "0110", "7"= "0111",
+  "8"= "1000", "9"= "1001", "A"= "1010", "B"= "1011",
+  "C"= "1100", "D"= "1101", "E"= "1110", "F"= "")
>
> gsubfn("[0-9A-F]", binary.digits, "0X1.921FB54442D18P+1")
[1] "X0001.1001001110110101010001000110110100011000P+0001"


On Sun, May 17, 2009 at 1:23 PM, Ted Harding
 wrote:
> I am interested in studying the binary representation of numerics
> (doubles) in R, so am looking for possibilities of output of the
> internal binary representations. sprintf() with format "a" or "A"
> is halfway there:
>
>  sprintf("%A",pi)
> # [1] "0X1.921FB54442D18P+1"
>
> but it is in hex.
>
> The following illustrate the sort of thing I want:
>
> 1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
> times 2
>
> 11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000
>
> 0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
> times 4
>
> (without the spaces -- only put in above for clarity).
>
> While I could take the original output "0X1.921FB54442D18P+1" from
> sprintf() and parse it out into binary using gsub() or the like,
> of submit it to say an 'awk' script via an external file, this would
> be a tedious business!
>
> Is there some function already in R which outputs the bits in the
> binary representation directly?
>
> I see that Dabid Hinds asked a similar question on 17 Aug 2005:
> "Raw data type transformations"
>
>  http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html
>
> (without, apparently, getting any response -- at any rate within
> the following 3 months).
>
> With thanks for any suggestions,
> Ted.
>
> 
> E-Mail: (Ted Harding) 
> Fax-to-email: +44 (0)870 094 0861
> Date: 17-May-09                                       Time: 18:23:49
> -- XFMail --
>
> __
> 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] Newton's method for finding roots

2009-05-17 Thread spencerg
 "Search" on the left under "www.r-project.org" provide 5 different 
search engines devoted to R.  The R-help archives for 4/20/2009 (+/-1 
depending on your local time zone and mine) contains an interesting 
discussion of this issue, Subj:  "Re: [R] Two or more dimensional root 
(Zero) finding". 



 Hope this helps. 
 Spencer


Kon Knafelman wrote:

Hey guys, i have a relatively simple problem.

I need to use netwon's method to find the root of a polynomial, lets say 
x^3-2x-1

i start off with

p <- function(x) x^3-2*x-1

My method, which im sure is very amateur, is to type another function, which is 
the derivative of p, and after picking an initial value to start off with, i 
follow the steps of newton's method manually, but i dont think that is what the 
question is asking.

I've done some research on wikipedia, but i cant seem to find any code that 
will help me.

Can someone help?

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] package for /usr/lib64/R/library/tkrplot/libs/tkrplot.so

2009-05-17 Thread Dirk Eddelbuettel

On 17 May 2009 at 12:53, Juergen Rose wrote:
| 'revdep-rebuild' under GENTOO shows me
| that /usr/lib64/R/library/tkrplot/libs/tkrplot.so, which was installed
| at April 24th, is broken.
| 'ldd /usr/lib64/R/library/tkrplot/libs/tkrplot.so' shows me that
| tkrplot.so needs libtcl8.4.so and libtk8.4.so, which is no more
| installed since the installation of tcl,tk-8.5.7, which has happened at
| april 26th.
| But revdep-rebuild can't find out a gentoo-package for tkrplot.so.
| That's why I assume, that tkrplot.so belongs to a CRAN package.
| Also update.packages() inside R does not no that tkrplot.so is broken.
| 
| How can I find out, which CRAN package installs tkrplot.so?

There are two clues:

 i)  R always installs all files for package 'foo' in a top-level directory
 'foo' below the entry of the library paths select -- if not set, it uses
 the default which is the first element returned by .libPaths()

 in your case:  'tkrplot' below  /usr/lib64/R/library/

 ii) For every package foo with to-be-compiled source code, R (on Linux)
 always creates a shared library libs/foo.so in the per-package directory
 tree. 

 in your case:  'tkrplot'

As an added bonus, can can always Google for the file itself. That would have
led you to tkrplot too.

Dirk

-- 
Three out of two people have difficulties with fractions.

__
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] plotting a chisquare

2009-05-17 Thread Harry P

Dear R-users,
I have a problem in making a chi-square density function curve.
I have sth like curve(dchisq(x, df))
from help, x is vector of quantiles, df is the degree of freedom.
I do not understand what vector of quantiles is, what do I need to put in?
Thanks!
-- 
View this message in context: 
http://www.nabble.com/plotting-a-chisquare-tp23585369p23585369.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] What's a Data Frame?

2009-05-17 Thread cls59



prixel wrote:
> 
>  im completely confused. could someone please help.
> 
> i have a series of data (0,0,0,0,1,1,0,0,0) and i need to create a data
> frame with it. but what is a data frame?
> 
> thankyou :)
> 

A data frame is similar to a matrix- however each column may be of a
different data type (character, number, logical, factor, ect.) and each
column has a name. Using the names a data frame may be manipulated as a
collection of vectors of the same length.

Look at ?data.frame for more information on data frames. The function
as.data.frame may be able to convert your data into a data frame object.

However, I cannot say if the object created by as.data.frame would satisfy
your needs without further manipulation since you did not specify why you
need a data frame. Are you calling some function that demands a data frame
as an input? If so, which function?

Good luck!

-Charlie

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/What%27s-a-Data-Frame--tp23580613p23586709.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] Output of binary representation

2009-05-17 Thread jim holtman
Are you looking for how the floating point is represented in the IEEE-754
format?  If so, you can use writeBin:

> writeBin(pi,raw(),endian='big')
[1] 40 09 21 fb 54 44 2d 18


On Sun, May 17, 2009 at 1:23 PM, Ted Harding
wrote:

> I am interested in studying the binary representation of numerics
> (doubles) in R, so am looking for possibilities of output of the
> internal binary representations. sprintf() with format "a" or "A"
> is halfway there:
>
>  sprintf("%A",pi)
> # [1] "0X1.921FB54442D18P+1"
>
> but it is in hex.
>
> The following illustrate the sort of thing I want:
>
> 1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
> times 2
>
> 11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000
>
> 0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
> times 4
>
> (without the spaces -- only put in above for clarity).
>
> While I could take the original output "0X1.921FB54442D18P+1" from
> sprintf() and parse it out into binary using gsub() or the like,
> of submit it to say an 'awk' script via an external file, this would
> be a tedious business!
>
> Is there some function already in R which outputs the bits in the
> binary representation directly?
>
> I see that Dabid Hinds asked a similar question on 17 Aug 2005:
> "Raw data type transformations"
>
>  http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html
>
> (without, apparently, getting any response -- at any rate within
> the following 3 months).
>
> With thanks for any suggestions,
> Ted.
>
> 
> E-Mail: (Ted Harding) 
> Fax-to-email: +44 (0)870 094 0861
> Date: 17-May-09   Time: 18:23:49
> -- XFMail --
>
> __
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Output of binary representation

2009-05-17 Thread Ted Harding
Many thankis, Gabor! That looks both interesting and powerful.
Indeed, it seems to implement with one stroke what I had been
thinking of implementing piecemeal.
Best wishes,
Ted.

On 17-May-09 17:48:00, Gabor Grothendieck wrote:
> gsubfn of the gsubfn package is like gsub but can take a function,
> list or proto object as the replacement instead of a character
> string and with a list it can be used to readily turn hex to binary:
> 
>> library(gsubfn)
>> binary.digits <-
> + list("0"= "", "1"= "0001", "2"= "0010", "3"= "0011",
> +  "4"= "0100", "5"= "0101", "6"= "0110", "7"= "0111",
> +  "8"= "1000", "9"= "1001", "A"= "1010", "B"= "1011",
> +  "C"= "1100", "D"= "1101", "E"= "1110", "F"= "")
>>
>> gsubfn("[0-9A-F]", binary.digits, "0X1.921FB54442D18P+1")
> [1]
> "X0001.1001001110110101010001000110110100011000P+0001"
> 
> 
> On Sun, May 17, 2009 at 1:23 PM, Ted Harding
>  wrote:
>> I am interested in studying the binary representation of numerics
>> (doubles) in R, so am looking for possibilities of output of the
>> internal binary representations. sprintf() with format "a" or "A"
>> is halfway there:
>>
>> _sprintf("%A",pi)
>> # [1] "0X1.921FB54442D18P+1"
>>
>> but it is in hex.
>>
>> The following illustrate the sort of thing I want:
>>
>> 1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
>> times 2
>>
>> 11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000
>>
>> 0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
>> times 4
>>
>> (without the spaces -- only put in above for clarity).
>>
>> While I could take the original output "0X1.921FB54442D18P+1" from
>> sprintf() and parse it out into binary using gsub() or the like,
>> of submit it to say an 'awk' script via an external file, this would
>> be a tedious business!
>>
>> Is there some function already in R which outputs the bits in the
>> binary representation directly?
>>
>> I see that Dabid Hinds asked a similar question on 17 Aug 2005:
>> "Raw data type transformations"
>>
>> _http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html
>>
>> (without, apparently, getting any response -- at any rate within
>> the following 3 months).
>>
>> With thanks for any suggestions,
>> Ted.
>>
>> 
>> E-Mail: (Ted Harding) 
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 17-May-09 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Time: 18:23:49
>> -- XFMail --
>>
>> __
>> 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.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 17-May-09   Time: 21:09:12
-- XFMail --

__
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] build CONTENTS or 00Index.html without installing whole package

2009-05-17 Thread Jonathan Baron
To maintain my R site, I'm trying to install html help files only, but
also keep track of the version (with DESCRIPTION).  I have the
following bash script, which works except for 00Index.html.  That is
not a huge problem because the help files are still searchable, but
I'd like to fix it.

A long time ago I asked the same question, and Brian Ripley said to
use --index as an option to build-help.pl, but that isn't an option
anymore.  It seems that the 00Index.html file is built from the
CONTENTS file, but I can't find how to construct that either.  Here's
the script so far.  It works pretty much.  (I'm not sure what happens
if the pdf vignettes don't exist already: so far they have all existed
and it works for those.  And the last line doesn't work, so I just
install a package and then the indices get rebuilt.)

#!/bin/bash
# makes indexable help files for R packages, including pdf vignettes
# usage inst.bat "[files]"
  for PKG in `ls $1`
do
  echo $PKG
  tar xfz $PKG
  PK=`echo $PKG | /bin/sed -e 's/.tar.gz//' | cut -d"_" -f1`
  echo $PK
  mkdir -pv /usr/lib/R/library/$PK
  mkdir -pv /usr/lib/R/library/$PK/html
# copy description (which contains version number) and CONTENTS (for index)
  cp $PK/DESCRIPTION /usr/lib/R/library/$PK
# build and move vignettes if present
  if [ -d $PK/inst/doc ]; then
   mkdir -pv /usr/lib/R/library/$PK/doc
R CMD buildVignettes\($PK,$PK\)
cp $PK/inst/doc/* /usr/lib/R/library/$PK/doc
  fi
# make html files
  R CMD perl /usr/share/R/perl/build-help.pl --html /home/baron/$PK 
/usr/lib/R/library
  rm -rf $PK
done
# rebuild indices (doesn't work)
R CMD make.packages.html

__
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] Chow test(1960)/Structural change test

2009-05-17 Thread Axel Leroix
Hi,
 
A question on something which normally should be easy !
 
I perform a linear regression using lm function:
 
> reg1 <- lm (a b+c+d, data = database1)
 
Then I try to perform the Chow (1960) test (structural change test) on my 
regression. I know the breakpoint date. I try the following code like it is 
described in the “Examples” section of the “strucchange” package :
 
> sctest(reg1, data = database1, type = "Chow",  point = 20, asymptotic = 
> FALSE)
 
Unfortunately, this does not work and I have the following error message:
 
Error in UseMethod("sctest") : No applied method for "sctest".
 
I guess that I should compute fs statistics first (Fisher statistics) but I’m 
not sure about my guess. Moreover, in case my guess is true I do know how to do 
it although I have read the package documentation!
On the basis of this documentation I’m able to perform other structural 
change test (CUSUM, MOSUM…) but I’m particularly interested in the Chow 
(1960) test. So please is there someone who can help me in implementing it. 
 
Many thanks in advance.
 
 


  
[[alternative HTML version deleted]]

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


Re: [R] Output of binary representation

2009-05-17 Thread Ted Harding
Thanks, Jim. While that is still in hex, I find I can get the binary
represntation using Gabor's gsubfn() function, provided the A-F isw
changed to a-f in setting up his 'binary.digits', and the output is
explicitly cast to character:

gsubfn("[0-9a-f]", binary.digits,
   as.character(writeBin(pi,raw(),endian='big')

Ted.

On 17-May-09 20:04:58, jim holtman wrote:
> Are you looking for how the floating point is represented in the
> IEEE-754
> format?  If so, you can use writeBin:
> 
>> writeBin(pi,raw(),endian='big')
> [1] 40 09 21 fb 54 44 2d 18
> 
> 
> On Sun, May 17, 2009 at 1:23 PM, Ted Harding
> wrote:
> 
>> I am interested in studying the binary representation of numerics
>> (doubles) in R, so am looking for possibilities of output of the
>> internal binary representations. sprintf() with format "a" or "A"
>> is halfway there:
>>
>>  sprintf("%A",pi)
>> # [1] "0X1.921FB54442D18P+1"
>>
>> but it is in hex.
>>
>> The following illustrate the sort of thing I want:
>>
>> 1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
>> times 2
>>
>> 11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000
>>
>> 0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
>> times 4
>>
>> (without the spaces -- only put in above for clarity).
>>
>> While I could take the original output "0X1.921FB54442D18P+1" from
>> sprintf() and parse it out into binary using gsub() or the like,
>> of submit it to say an 'awk' script via an external file, this would
>> be a tedious business!
>>
>> Is there some function already in R which outputs the bits in the
>> binary representation directly?
>>
>> I see that Dabid Hinds asked a similar question on 17 Aug 2005:
>> "Raw data type transformations"
>>
>>  http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html
>>
>> (without, apparently, getting any response -- at any rate within
>> the following 3 months).
>>
>> With thanks for any suggestions,
>> Ted.
>>
>> 
>> E-Mail: (Ted Harding) 
>> Fax-to-email: +44 (0)870 094 0861
>> Date: 17-May-09   Time: 18:23:49
>> -- XFMail --
>>
>> __
>> 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> sting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 
> 
> -- 
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
> 
> What is the problem that you are trying to solve?


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 17-May-09   Time: 22:06:59
-- XFMail --

__
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] Output of binary representation

2009-05-17 Thread Gabor Grothendieck
Also note that one can use toupper in place of as.character
in which case no other changes are required.

On Sun, May 17, 2009 at 5:07 PM, Ted Harding
 wrote:
> Thanks, Jim. While that is still in hex, I find I can get the binary
> represntation using Gabor's gsubfn() function, provided the A-F isw
> changed to a-f in setting up his 'binary.digits', and the output is
> explicitly cast to character:
>
> gsubfn("[0-9a-f]", binary.digits,
>       as.character(writeBin(pi,raw(),endian='big')
>
> Ted.
>
> On 17-May-09 20:04:58, jim holtman wrote:
>> Are you looking for how the floating point is represented in the
>> IEEE-754
>> format?  If so, you can use writeBin:
>>
>>> writeBin(pi,raw(),endian='big')
>> [1] 40 09 21 fb 54 44 2d 18
>>
>>
>> On Sun, May 17, 2009 at 1:23 PM, Ted Harding
>> wrote:
>>
>>> I am interested in studying the binary representation of numerics
>>> (doubles) in R, so am looking for possibilities of output of the
>>> internal binary representations. sprintf() with format "a" or "A"
>>> is halfway there:
>>>
>>>  sprintf("%A",pi)
>>> # [1] "0X1.921FB54442D18P+1"
>>>
>>> but it is in hex.
>>>
>>> The following illustrate the sort of thing I want:
>>>
>>> 1.1001 0010 0001  1011 0101 0100 0100 0100 0010 1101 0001 1000
>>> times 2
>>>
>>> 11.0010 0100 0011  0110 1010 1000 1000 1000 0101 1010 0011 000
>>>
>>> 0.1100 1001   1101 1010 1010 0010 0010 0001 0110 1000 1100 0
>>> times 4
>>>
>>> (without the spaces -- only put in above for clarity).
>>>
>>> While I could take the original output "0X1.921FB54442D18P+1" from
>>> sprintf() and parse it out into binary using gsub() or the like,
>>> of submit it to say an 'awk' script via an external file, this would
>>> be a tedious business!
>>>
>>> Is there some function already in R which outputs the bits in the
>>> binary representation directly?
>>>
>>> I see that Dabid Hinds asked a similar question on 17 Aug 2005:
>>> "Raw data type transformations"
>>>
>>>  http://finzi.psych.upenn.edu/R/Rhelp02/archive/59900.html
>>>
>>> (without, apparently, getting any response -- at any rate within
>>> the following 3 months).
>>>
>>> With thanks for any suggestions,
>>> Ted.
>>>
>>> 
>>> E-Mail: (Ted Harding) 
>>> Fax-to-email: +44 (0)870 094 0861
>>> Date: 17-May-09                                       Time: 18:23:49
>>> -- XFMail --
>>>
>>> __
>>> 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>> sting-guide.html>
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Jim Holtman
>> Cincinnati, OH
>> +1 513 646 9390
>>
>> What is the problem that you are trying to solve?
>
> 
> E-Mail: (Ted Harding) 
> Fax-to-email: +44 (0)870 094 0861
> Date: 17-May-09                                       Time: 22:06:59
> -- XFMail --
>
> __
> 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] Chow test(1960)/Structural change test

2009-05-17 Thread Achim Zeileis

On Sun, 17 May 2009, Axel Leroix wrote:


Hi,
 
A question on something which normally should be easy !
 
I perform a linear regression using lm function:
 

reg1 <- lm (a b+c+d, data = database1)

 
Then I try to perform the Chow (1960) test (structural change test) on my 
regression. I know the breakpoint date. I try the following code like it is 
described in the “Examples” section of the “strucchange” package :
 

sctest(reg1, data = database1, type = "Chow",  point = 20, asymptotic = FALSE)


You just need the formula, not the fitted model:

sctest(a ~ b + c + d, data = database1, type = "Chow", point = 20)

If you want to perform it "by hand", then the following should work: 
fit the nested model and then perform the model comparison calling anova()

(or lrtest() from "lmtest" for the asymptotic version).

reg2 <- lm(a ~ factor(1:nrow(database1) <= 20) / (b + c + d),
  data = database1)

anova(reg1, reg2)

hth,
Z


 
Unfortunately, this does not work and I have the following error message:
 
Error in UseMethod("sctest") : No applied method for "sctest".
 
I guess that I should compute fs statistics first (Fisher statistics) but I’m 
not sure about my guess. Moreover, in case my guess is true I do know how to do 
it although I have read the package documentation!
On the basis of this documentation I’m able to perform other structural 
change test (CUSUM, MOSUM…) but I’m particularly interested in the Chow 
(1960) test. So please is there someone who can help me in implementing it.
 
Many thanks in advance.
 
 



[[alternative HTML version deleted]]

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


Re: [R] package for /usr/lib64/R/library/tkrplot/libs/tkrplot.so

2009-05-17 Thread Juergen Rose
Am Sonntag, den 17.05.2009, 13:16 -0500 schrieb Dirk Eddelbuettel:
> On 17 May 2009 at 12:53, Juergen Rose wrote:
> | 'revdep-rebuild' under GENTOO shows me
> | that /usr/lib64/R/library/tkrplot/libs/tkrplot.so, which was installed
> | at April 24th, is broken.
> | 'ldd /usr/lib64/R/library/tkrplot/libs/tkrplot.so' shows me that
> | tkrplot.so needs libtcl8.4.so and libtk8.4.so, which is no more
> | installed since the installation of tcl,tk-8.5.7, which has happened at
> | april 26th.
> | But revdep-rebuild can't find out a gentoo-package for tkrplot.so.
> | That's why I assume, that tkrplot.so belongs to a CRAN package.
> | Also update.packages() inside R does not no that tkrplot.so is broken.
> | 
> | How can I find out, which CRAN package installs tkrplot.so?
> 
> There are two clues:
> 
>  i)  R always installs all files for package 'foo' in a top-level directory
>  'foo' below the entry of the library paths select -- if not set, it uses
>  the default which is the first element returned by .libPaths()
> 
>  in your case:  'tkrplot' below  /usr/lib64/R/library/
> 
>  ii) For every package foo with to-be-compiled source code, R (on Linux)
>  always creates a shared library libs/foo.so in the per-package directory
>  tree. 
> 
>  in your case:  'tkrplot'
> 
> As an added bonus, can can always Google for the file itself. That would have
> led you to tkrplot too.

So easy. Thank you.

> Dirk

Juergen

__
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] sprintf() question

2009-05-17 Thread Daniel Nordlund
When I type the following, I get results different from what I expected. 

> sprintf('%a',3)
[1] "0x1.8"

Shouldn't the result be

[1] "0x1.8p+2"

I read through the help ?sprintf and didn't find anything that changed my 
expectation.  What am I misunderstanding?  I am using R-2.9.0 binary from CRAN 
on Windows XP Pro, and my session info is


> sessionInfo()
R version 2.9.0 (2009-04-17) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

Thanks for any enlightenment.

Dan

Daniel Nordlund
Bothell, WA  USA

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


Re: [R] sprintf() question

2009-05-17 Thread Ted Harding
On 17-May-09 22:03:19, Daniel Nordlund wrote:
> When I type the following, I get results different from what I
> expected. 
> 
>> sprintf('%a',3)
> [1] "0x1.8"
> 
> Shouldn't the result be
> 
> [1] "0x1.8p+2"

Well, not "p+2" but "p+1"
  (0x1.8 = 1.1000[2] ; *2 = 11.000[2] = 3[10]) ;
however, I get:

  sprintf('%a',3)
  # [1] "0x1.8p+1"

which is indeed correct.

  R version 2.9.0 (2009-04-17) ## Same as yours
  platform  i486-pc-linux-gnu  ## Different from yours ...

which perhaps suggests that there may be a mis-compilation in the
Windows version.

Ted.

> I read through the help ?sprintf and didn't find anything that changed
> my expectation.  What am I misunderstanding?  I am using R-2.9.0 binary
> from CRAN on Windows XP Pro, and my session info is
> 
> 
>> sessionInfo()
> R version 2.9.0 (2009-04-17) 
> i386-pc-mingw32 
> 
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> States.1252;LC_MONETARY=English_United
> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base   
>> 
> 
> Thanks for any enlightenment.
> 
> Dan
> 
> Daniel Nordlund
> Bothell, WA  USA
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 17-May-09   Time: 23:32:19
-- XFMail --

__
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] One Sample Nonparametric

2009-05-17 Thread Charles Van deZande
Hi!
I'm doing one and two sample nonparametric tests for the median using wilcox
test.  For a one-sample test I  use: 
> wilcox.test(x, mu =50 (or whatever), y=NULL,correct=TRUE)
For two-sample test I use: 
> wilcox.test(x,y,correct=TRUE)
The problem is when I try to duplicate problems from textbooks, I get
p-values that are much different from the examples from the literature. 
They are off by as much as 30% to 40%.  Not even close.
Using an "exact" argument doesn't change the p-value.
What am I doing wrong?  Thanks for any help.
cvandy
   
Charles H Van deZande
[[alternative HTML version deleted]]

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


Re: [R] ggplot2: annotating plot with mathematical formulae

2009-05-17 Thread Paul Murrell

Hi

Would a basic call to grid.text() do what you want here?

Paul


Paul Emberson wrote:

Hi Baptiste,

I think on this occasion I'll edit manually in inkscape with the textext
plugin which is a somewhat clumsy but simple option.  Thanks for the
link to the wiki which I wasn't aware of until now.

Paul

baptiste auguie wrote:

If you're desperate for a workaround, you might want to try this
example using pgfSweave,

http://ggplot2.wik.is/Mathematical_annotations

On a similar vein, you could try psfrag replacements with a postscript
device (there is some code for this on the list archives).

Feel free to comment / edit on the wiki page.

HTH,

baptiste

On 16 May 2009, at 14:48, Paul Emberson wrote:


Hi Stephen,

The problem is that the label on the graph doesn't get rendered with a
superscript.  I want the label on the graph to be rendered the same way
as the label you have put on the axis.

I am plotting a piecewise function and I wanted to label each section
of it.

Paul

stephen sefick wrote:

how about this

a <- 1:10
b <- 1:10
d <- paste("x","^","{n-1}")
qplot(a,b, xlab=expression(x^{n-1}))+geom_text(aes(4,8, label=d))

On Fri, May 15, 2009 at 10:02 PM, Paul Emberson
 wrote:


Hi,

Is there a way of annotating a ggplot plot with mathematical formulae?

I can do

geom_text(aes(label="some text", ...

but I can't do

geom_text(aes(label=expression(x^{n-1}), ...

It gives the error

Error: geom_text requires the following missing aesthetics: label

Is there a convenient equivalent?

Cheers,

Paul

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

_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
__



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


--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
p...@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

__
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] sprintf() question

2009-05-17 Thread Daniel Nordlund
> -Original Message-
> From: Ted Harding [mailto:ted.hard...@manchester.ac.uk] 
> Sent: Sunday, May 17, 2009 3:32 PM
> To: Daniel Nordlund
> Cc: r-help@r-project.org
> Subject: RE: [R] sprintf() question
> 
> On 17-May-09 22:03:19, Daniel Nordlund wrote:
> > When I type the following, I get results different from what I
> > expected. 
> > 
> >> sprintf('%a',3)
> > [1] "0x1.8"
> > 
> > Shouldn't the result be
> > 
> > [1] "0x1.8p+2"
> 
> Well, not "p+2" but "p+1"
>   (0x1.8 = 1.1000[2] ; *2 = 11.000[2] = 3[10]) ;
> however, I get:
> 
>   sprintf('%a',3)
>   # [1] "0x1.8p+1"
> 
> which is indeed correct.
> 
>   R version 2.9.0 (2009-04-17) ## Same as yours
>   platform  i486-pc-linux-gnu  ## Different from yours ...
> 
> which perhaps suggests that there may be a mis-compilation in the
> Windows version.
> 
> Ted.
> 
> > I read through the help ?sprintf and didn't find anything 
> that changed
> > my expectation.  What am I misunderstanding?  I am using 
> R-2.9.0 binary
> > from CRAN on Windows XP Pro, and my session info is
> > 
> > 
> >> sessionInfo()
> > R version 2.9.0 (2009-04-17) 
> > i386-pc-mingw32 
> > 
> > locale:
> > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
> > States.1252;LC_MONETARY=English_United
> > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> > 
> > attached base packages:
> > [1] stats graphics  grDevices utils datasets  
> methods   base   
> >> 
> > 
> > Thanks for any enlightenment.
> > 

Thanks Ted!

Enlightenment is what I asked for, and it is what I got.  I was having a
senior moment I guess.  I was picturing 8 as binary 0100, when obviously it
is binary 1000.  So yes, the required power of 2 is 1, and it is fine with
me that Windows implementation does not display it.  Thanks again.

Dan

Daniel Nordlund
Bothell, WA  USA

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


[R] Measures

2009-05-17 Thread Rafael Marconi Ramos
Dear colleagues in R,

Has anybody implemented the

1) (Goodman & Kruskal) lambda
2) (Thiel's) uncertainty coefficient


Tanks

Rafael M Ramos

[[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] About " Error: C stack usage is too close to the limit"

2009-05-17 Thread goon83
Hi everyone!
   I meet one problem when embedding R in C code, when I run the the R code in 
one child thread , 
   it always print error info: 
Error: C stack usage is too close to the limit

   I also try to set R_CStackLimit = (uintptr_t)-1 to disable the C stack check 
as the R-ext doc say,
   but it still does not work. 

   it is interesting that if i put the R code in the main thread(don't create 
any thread), it work.

   so, can anybody give some help or suggestion about this problem,
   any response will be appreciated, tks in advance.
   
***
Bin Dong
BUAA, Beijing PR China
goo...@126.com
***

   ps: my code, system info and error information list behand 

   - 
   1, my example code lists here:
   -
   #include 
 
   void *ts_thread(){
 SEXP e, tmp;
 int  hadError;
 int argc = 0;
 char *argv[1];
 ParseStatus status;

 init_R(argc, argv);

PROTECT(tmp = mkString("{print(lh)}"));
PROTECT(e = R_ParseVector(tmp, 1, &status, R_NilValue));
PrintValue(e);
R_tryEval(VECTOR_ELT(e,0), R_GlobalEnv, &hadError);
   
   UNPROTECT(2);
   end_R();
}

int main(int argc, char *argv[]){
pthread_t th1;
int iret1;

iret1 = pthread_create(&th1, NULL, ts_thread,NULL);
pthread_join(th1, NULL);
printf("Thread 1 return:%d\n", iret1);
 
return 0;
}
---   
2, My os and compiler is:
---
Linux debian 2.6.26-1-686 #1 SMP Sat Jan 10 18:29:31 UTC 2009 i686 GNU/Linux
gcc version 4.3.2 (Debian 4.3.2-1.1) 

---
3, the error info:

g...@debian:~/library/R-source/R-2.9.0/tests/Embedding$ ./Rar 
Error: C stack usage is too close to the limit
Error: C stack usage is too close to the limit

R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

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.

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.

expression({
print(lh)
})
Error: C stack usage is too close to the limit
Thread 1 return:0
--


[[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] asymmetric t-copula in R

2009-05-17 Thread Roslina Zakaria
Hi R-users,

Where can I find the code for asymmetric t-copula in R?

Thank you for any help given.


  
[[alternative HTML version deleted]]

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


[R] How to run Rcmdr in Mac Os X Tiger?

2009-05-17 Thread Jenny Tan (Dr J)
This question might been asked previously (I googled), but I can't find a
workable solution in the archives.

My question is: how to run Rcdmr in Mac Os X?

The error message when I launched Rcmdr fresh from a R session is:

Version of R:
R 2.8.1 GUI 1.27 Tiger build 32-bit (5301)

> library(Rcmdr)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Loading required package: car
Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class =
"tclObj") :
  [tcl] invalid command name "font".

In addition: Warning message:
In fun(...) : couldn't connect to display ":0"
Error : .onAttach failed in 'attachNamespace'
Error: package/namespace load failed for 'Rcmdr'


jenny

[[alternative HTML version deleted]]

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


[R] How do you save in R?

2009-05-17 Thread prixel

I know it sounds like a silly question but whenever i click on "save to file"
it doesn't save. whenever i use the function attach(___) it doesn't work,
and says object can not be found. i have a series of data (0,0,0,1,1) that i
need to save, then i want to attach(...) it in another R window.

Please help.
Thanks
-- 
View this message in context: 
http://www.nabble.com/How-do-you-save-in-R--tp23590795p23590795.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] How to save R "clean" sessions in BATCH mode?

2009-05-17 Thread Emmanuel Charpentier
Le samedi 16 mai 2009 à 17:21 +0200, mcnda...@mncn.csic.es a écrit :
> Thanks a lot for all of you that have reply me about opening and  
> ending R workspaces in BATCH mode. However replies were a king general  
> and I’m afraid I could not take the entire message from them.  
> Therefore I chose to expose here a representative fraction of my work.
> 
> I have 50 Rdata files (F1,F2,F3,F4,…,F50) with objects inside.
> I need to:
> 
> open F1:
> - perform some simple operations with the objects
> - export the solution with write.table
> - end F1 session
> open F2
> repeat procedures as F1
> …
> open F50
> repeat procedures as F1
> …
> 
> My difficulty here is to end a workspace and open one from the scratch  
> to avoid mixing files from consecutive worksessions, and thus using R  
> memory unnecessarily. I could use rm() to delete objects from the  
> previous sessions but it seems not an efficient task.

And re-loading R, rebuilding a whole process context, re-allocating
memory is an efficient one ?

Hah !

> Any suggestions on how to perform this in Batch Mode? An examplified  
> help would be nice!

Why not encapsulate your procedures in a function taking the filename as
its argument and loopîng on the filenames list ? Anything created in the
function, being local to the function, will be (efficiently) cleaned up
at the function exit. Magic...

Exemple :

> ls()
character(0)
> Foo<-runif(10,0,1)
> ls()
[1] "Foo"
> ?save.image
> save.image("Foo1.RData")
> ls()
[1] "Foo"
> rm(list=ls())
> Foo<-letters[round(runif(10,min=1,max=26))]
> Foo
 [1] "v" "m" "b" "y" "g" "u" "r" "f" "y" "q"
> save.image("Foo2.RData")
> rm(list=ls())
> bar<-edit()
bar<-edit()
Waiting for Emacs...
> bar
function(filename) {
  load(file=filename)
  print(ls())
  print(Foo)
  invisible(NULL)
}
> ls()
[1] "bar"
> bar("Foo1.RData")
[1] "filename" "Foo" # Note : by default, ls() list the function's
# environment, not the global one... **> no "bar" here...
 [1] 0.8030422 0.6326055 0.8188481 0.6161665 0.5917206 0.6631358
0.7290200
 [8] 0.2970315 0.2016259 0.4473244
> ls()
[1] "bar"   # Bar is still in the global environment...
> bar("Foo2.RData")
[1] "filename" "Foo" 
 [1] "v" "m" "b" "y" "g" "u" "r" "f" "y" "q"
> ls()
[1] "bar"
> 

Good enough for you ?

HTH,

Emmanuel Charpentier

__
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] Measures

2009-05-17 Thread Dieter Menne
Rafael Marconi Ramos  gmail.com> writes:

> 
> 
> 1) (Goodman & Kruskal) lambda
> 2) (Thiel's) uncertainty coefficient

Dear Rafael,

have you tried to search for "Goodman Kruskal" (solution be J Baron) and
Thiel (comments by Marc Schwartz and Frank Harrell)?

Dieter

__
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] One Sample Nonparametric

2009-05-17 Thread Dieter Menne
Charles Van deZande  gmail.com> writes:

> I'm doing one and two sample nonparametric tests for the median using wilcox
> test.  For a one-sample test I  use: 
> > wilcox.test(x, mu =50 (or whatever), y=NULL,correct=TRUE)
> For two-sample test I use: 
> > wilcox.test(x,y,correct=TRUE)
> The problem is when I try to duplicate problems from textbooks, I get
> p-values that are much different from the examples from the literature. 
> They are off by as much as 30% to 40%.  Not even close.
> Using an "exact" argument doesn't change the p-value.

> What am I doing wrong? 

You have not posted the textbook example you tested. You can use
dput to compactly post the data samples. Also check package coin.

Dieter

__
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] sprintf() question

2009-05-17 Thread Ei-ji Nakama
Hi

The result of Windows is clearly strange.

 my Linux machine = good ===
> sessionInfo()
R version 2.9.0 (2009-04-17)
x86_64-pc-linux-gnu

locale:
LC_CTYPE=ja_JP.EUC-JP;LC_NUMERIC=C;LC_TIME=ja_JP.EUC-JP;LC_COLLATE=ja_JP.EUC-JP;
LC_MONETARY=C;LC_MESSAGES=ja_JP.EUC-JP;LC_PAPER=ja_JP.EUC-JP;LC_NAME=C;LC_ADDRES
S=C;LC_TELEPHONE=C;LC_MEASUREMENT=ja_JP.EUC-JP;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base
> sprintf("%a",1:8)
[1] "0x1p+0"   "0x1p+1"   "0x1.8p+1" "0x1p+2"   "0x1.4p+2" "0x1.8p+2" "0x1.cp+2"
[8] "0x1p+3"

 my Windows machine = OMG ==
> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=Japanese_Japan.932;LC_CTYPE=Japanese_Japan.932;LC_MONETARY=Japanese_Japan.932;LC_NUMERIC=C;LC_TIME=Japanese_Japan.932

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base
> sprintf("%a",1:8)
[1] "0x1p+0""0x1"   "0x1.8"
"0x1p+4294967294"
[5] "0x1.4p+4294967294" "0x1.8p+4294967294" "0x1.cp+4294967294"
"0x1p+4294967293"

The result improved when I changed handling of uExponent as follows

http://prs.ism.ac.jp/~nakama/working/sprintf_format_a.patch



2009/5/18 Daniel Nordlund :
>> -Original Message-
>> From: Ted Harding [mailto:ted.hard...@manchester.ac.uk]
>> Sent: Sunday, May 17, 2009 3:32 PM
>> To: Daniel Nordlund
>> Cc: r-help@r-project.org
>> Subject: RE: [R] sprintf() question
>>
>> On 17-May-09 22:03:19, Daniel Nordlund wrote:
>> > When I type the following, I get results different from what I
>> > expected.
>> >
>> >> sprintf('%a',3)
>> > [1] "0x1.8"
>> >
>> > Shouldn't the result be
>> >
>> > [1] "0x1.8p+2"
>>
>> Well, not "p+2" but "p+1"
>>   (0x1.8 = 1.1000[2] ; *2 = 11.000[2] = 3[10]) ;
>> however, I get:
>>
>>   sprintf('%a',3)
>>   # [1] "0x1.8p+1"
>>
>> which is indeed correct.
>>
>>   R version 2.9.0 (2009-04-17) ## Same as yours
>>   platform  i486-pc-linux-gnu  ## Different from yours ...
>>
>> which perhaps suggests that there may be a mis-compilation in the
>> Windows version.
>>
>> Ted.
>>
>> > I read through the help ?sprintf and didn't find anything
>> that changed
>> > my expectation.  What am I misunderstanding?  I am using
>> R-2.9.0 binary
>> > from CRAN on Windows XP Pro, and my session info is
>> >
>> >
>> >> sessionInfo()
>> > R version 2.9.0 (2009-04-17)
>> > i386-pc-mingw32
>> >
>> > locale:
>> > LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>> > States.1252;LC_MONETARY=English_United
>> > States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>> >
>> > attached base packages:
>> > [1] stats graphics  grDevices utils datasets
>> methods   base
>> >>
>> >
>> > Thanks for any enlightenment.
>> >
>
> Thanks Ted!
>
> Enlightenment is what I asked for, and it is what I got.  I was having a
> senior moment I guess.  I was picturing 8 as binary 0100, when obviously it
> is binary 1000.  So yes, the required power of 2 is 1, and it is fine with
> me that Windows implementation does not display it.  Thanks again.
>
> Dan
>
> Daniel Nordlund
> Bothell, WA  USA
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>

-- 
EI-JI Nakama  
"\u4e2d\u9593\u6804\u6cbb"  

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