Re: [R] Variables from a Dataframe

2011-12-12 Thread Paul Menzel
Dear Jose, Am Montag, den 12.12.2011, 19:44 + schrieb Jose Bustos Melo: > Hello everyone, > > I want make a variable selection from a dataframe, but when I build this new > object (using cbind) the new table (which is a matrix) I lost all the > original factor names in the variables. I get

Re: [R] [solved] littler: Use for batch processing of data sets: How to pass filename?

2011-12-12 Thread Paul Menzel
Am Montag, den 12.12.2011, 09:41 -0500 schrieb R. Michael Weylandt : > Why can't you just replace "temp/data" with filename (no quotes)? I'm not > sure I get the question... … no I am feeling silly and I do not know where I screwed up before. Here is the full working example. #!/usr/bin/

[R] littler: Use for batch processing of data sets: How to pass filename?

2011-12-12 Thread Paul Menzel
Dear R folks, I have several data sets I want to process automatically using R. I found littler [1] and thought this will do the trick. 1. Read in data file to a data frame using `scan()`. 2. Do linear regression. 3. Write the data and the coefficients back to a file. #!/usr/bin/env r

[R] Any packages or ways available providing un-/a-/non-symmetric centered distributions?

2011-12-11 Thread Paul Menzel
Dear R folks, I would like to use un-/a-/non-symmetric centered, i. e. the expectation vanishes/is zero, distributions. Searching for that is not that easy since all three words un-, a-, non-symmetric seem to be common. Do I need to create such a distribution myself by for example composing a d

[R] How to find the parameter of a power function to fit simulation data to it for the tail?

2011-08-02 Thread Paul Menzel
Dear R folks, having simulation data in a vector n2off, I know that they should be similar to a power function f [1], f(n) = n^(-1/r), r ∈ ℕ\{0}, and I want to find the value for r best fitting the simulation data. Furthermore I know that this is only true for big n, that means n2off(n) ~ f(n) ⇔

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-08-02 Thread Paul Menzel
Dear Dennis and Steve, Am Sonntag, den 31.07.2011, 23:32 -0400 schrieb Steve Lianoglou: […] > How about trying to write the of this `f4` function below using the > rcpp/inline combo. The C/C++ you will need to write looks to be quite > trivial, let's change f4 to accept an x argument as a vecto

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-08-01 Thread Paul Menzel
Am Montag, den 01.08.2011, 12:43 -0400 schrieb R. Michael Weylandt : > I've only got a 20 minute layover, but three quick remarks: > > 1) Do a sanity check on your data size: if you want a million walks of > a thousand steps, that already gets you to a billion integers to > store--even at a very l

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-08-01 Thread Paul Menzel
Am Sonntag, den 31.07.2011, 23:32 -0500 schrieb R. Michael Weylandt : > Glad to help -- I haven't taken a look at Dennis' solution (which may be far > better than mine), but if you do want to keep going down the path outlined > below you might consider the following: I will try Dennis’ solution ri

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-07-31 Thread Paul Menzel
Am Mittwoch, den 27.07.2011, 19:59 -0400 schrieb R. Michael Weylandt : > Some more skilled folks can help with the curve fitting, but the general > answer is yes -- R will handle this quite ably. Great to read that. > Consider the following code: > > <<-->> >

Re: [R] [solved] How to count numbers of a vector and use them as index values?

2011-07-31 Thread Paul Menzel
Am Sonntag, den 31.07.2011, 15:19 -0700 schrieb Jeffrey Dick: > Here's an attempt using sapply: > > > x <- c(2, 2, 3, 3, 4, 6) > > ys <- 1:8 > > sapply(ys, function(y) { length(which(x==y)) } ) > [1] 0 2 2 1 0 1 0 0 The last piece for my trials missing was `sapply()` which I overlooked reading `?

Re: [R] [solved] How to count numbers of a vector and use them as index values?

2011-07-31 Thread Paul Menzel
Dear Sarah, Am Sonntag, den 31.07.2011, 18:10 -0400 schrieb Sarah Goslee: > I would use something like this: > > > x <- c(2,2,3,3,4,6) > > table(x) > x > 2 3 4 6 > 2 2 1 1 > > x <- factor(x, levels=1:8) > > table(x) > x > 1 2 3 4 5 6 7 8 > 0 2 2 1 0 1 0 0 awesome. Thank you. Looking further I

[R] How to count numbers of a vector and use them as index values?

2011-07-31 Thread Paul Menzel
Dear R folks, I am sorry to ask this simple question, but my search for the right way/command was unsuccessful. I have a vector > x <- c(2, 2, 3, 3, 4, 6) Now the values of x should be considered the index of another vector with possible greater length, say 8, and the value should be how often

[R] Methods stopping calculations when a first element is found? (was: Is R the right choice for simulating first passage times of random walks?)

2011-07-31 Thread Paul Menzel
Dear responders, thank you very much for all your answers, suggestions and corrections. I will try to give feedback and share my findings. Am Donnerstag, den 28.07.2011, 01:56 + schrieb William Dunlap: […] > You might try using sample(c(-1,1), size=length, replace=TRUE) > instead of sign(r

Re: [R] [solved] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-30 Thread Paul Menzel
Am Freitag, den 29.07.2011, 15:28 +0200 schrieb Paul Menzel: > wanting to compare different implementations of a solution I want to > script it to iterate over the different implementations. Is there a way > to do this in the R shell/command line? > > $ more /tmp/iterf

[R] http://www.r-project.org/contributors.html: display problem, because no character set is defined

2011-07-29 Thread Paul Menzel
Dear R webmasters, my browser defaults to the charset UTF-8 and since [1] seems to be encoded in ISO-8859-1 the umlauts are not displayed correctly. It would be great if the encoding could be added to the header [2]. (Or the page converted to UTF-8 and the problem would be solved for me. ;-) )

Re: [R] plot, graphic

2011-07-29 Thread Paul Menzel
Dear Simon, Am Freitag, den 29.07.2011, 12:32 -0700 schrieb Crock: > i`m trying to use the plot function to show more variable-funktions in one > graphic. so for example i would like to show Chinas Income in different > sectors in one graphic. obviousely typing plot(ChinaIncome) the graphics are

Re: [R] [solved] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-29 Thread Paul Menzel
Dear Eik, Am Freitag, den 29.07.2011, 15:46 +0200 schrieb Eik Vettorazzi: > how about this > for (i in 1:2) { print( do.call(paste("f",i,sep=""),list(2, 3) )) } > > or using get > for (i in 1:2) { print( get(paste("f",i,sep=""))(2, 3) ) } works great for me. Thank you very much. Regarding searc

[R] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-29 Thread Paul Menzel
Dear R folks, wanting to compare different implementations of a solution I want to script it to iterate over the different implementations. Is there a way to do this in the R shell/command line? $ more /tmp/iterf.r f1 <- function(n = 10, l = 10)

Re: [R] ?plot: Add an example on how to plot functions to the help of `plot`.

2011-07-29 Thread Paul Menzel
Am Donnerstag, den 28.07.2011, 09:12 +0200 schrieb Martin Maechler: > >>>>> "PM" == Paul Menzel > >>>>> on Wed, 27 Jul 2011 23:53:51 +0200 writes: […] > PM> So my newest suggestion is to add a comment to > > PM> plot(si

Re: [R] Is R the right choice for simulating first passage times of random walks?

2011-07-27 Thread Paul Menzel
Dear R folks, Am Donnerstag, den 28.07.2011, 01:36 +0200 schrieb Paul Menzel: > I need to simulate first passage times for iterated partial sums. The > related papers are for example [1][2]. > > As a start I want to simulate how long a simple random walk stays > negative, whic

[R] Is R the right choice for simulating first passage times of random walks?

2011-07-27 Thread Paul Menzel
Dear R folks, I need to simulate first passage times for iterated partial sums. The related papers are for example [1][2]. As a start I want to simulate how long a simple random walk stays negative, which should result that it behaves like n^(-½). My code looks like this. 8< c

Re: [R] ?plot: Add an example on how to plot functions to the help of `plot`.

2011-07-27 Thread Paul Menzel
Am Mittwoch, den 27.07.2011, 18:04 -0400 schrieb David Winsemius: > On Jul 27, 2011, at 5:53 PM, Paul Menzel wrote: > > as `plot.function` is not explicitly mentioned in `?plot`. > > Right, but the fact that it _is_ described as a "generic" function > will tell th

Re: [R] ?plot: Add an example on how to plot functions to the help of `plot`.

2011-07-27 Thread Paul Menzel
Am Mittwoch, den 27.07.2011, 17:21 -0400 schrieb David Winsemius: > On Jul 27, 2011, at 4:53 PM, Paul Menzel wrote: > > Am Mittwoch, den 27.07.2011, 13:26 -0700 schrieb Bert Gunter: > >> Paul: > >> No such change is needed. > > > > Well the fact is, tha

Re: [R] ?plot: Add an example on how to plot functions to the help of `plot`.

2011-07-27 Thread Paul Menzel
Dear Bert, Am Mittwoch, den 27.07.2011, 13:26 -0700 schrieb Bert Gunter: > Paul: > No such change is needed. Well the fact is, that I as a beginner was looking for who I could plot normal functions, so one more example would have helped me. > You do not understand S3 methods. That is probably

[R] ?plot: Add an example on how to plot functions to the help of `plot`.

2011-07-27 Thread Paul Menzel
Dear R folks, currently the section Examples contains the following as an example on how to plot a “normal” function. plot(sin, -pi, 2*pi) Since it does not contain the argument for the function it would be helpful to add for example the following. ## plots the graph of f(x) =

Re: [R] [solved] How to search for R related topics in search engines?

2011-07-27 Thread Paul Menzel
Am Mittwoch, den 27.07.2011, 14:36 -0400 schrieb David Winsemius: > On Jul 27, 2011, at 10:12 AM, Paul Menzel wrote: > > I am having problems getting good results when searching for R related > > topics, that means I have not found out yet what keywords I should use > >

[R] How to search for R related topics in search engines?

2011-07-27 Thread Paul Menzel
Dear R folks, I am having problems getting good results when searching for R related topics, that means I have not found out yet what keywords I should use to get only relevant results. Most of the time I get also MATLAB related things and nothing related at all. The nature of this is of course t