[R] Geometric Brownian Process

2007-01-02 Thread Michael Graber
Dear R People,

Consider I have 3 realizations of an Geometric Brownian process.
Now i want to overlay  the plot of these realizations. In a future point 
in time a probability density curve  in this specific point of time 
should overlay this plot ( view rotated 90°).
I am sorry for not providing any source code. Can anybody point mo to an 
package, or has anybody an idea how to simulate an geometric brownian 
process in R?

Thanks in advance,

Michael Graber

__
R-help@stat.math.ethz.ch 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] Creating a table

2006-11-14 Thread Michael Graber
Dear R List,

I am a new to R,  so my question may be easy to answer for you:

I have a dataframe, for example:

df<-data.frame(loc=c("A","B","A","A","A"), 
year=as.numeric(c("1970","1970","1970","1976","1980")))

and I want to create the following table without using loops:

  1970-74 ; 1975-79 ; 1980-85; rowsum
A 2   1   1  4
B 1   00  1
colsum   31   15

so that the frequencies of df$loc are shown in the table for different 
time intervals.

Thanks in advance for any hint,

Michael Graber

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


Re: [R] R and ViM

2006-05-29 Thread Michael Graber
dear all,

to close the open question i asked more than a month ago, i would like 
to tell you my conclusions:

exchanging emails with larry clapp who wrote funnel.pl, i found out 
that the tasks i wanted to be done by funnel.pl could actually, and 
much more, also be done by

gnuscreen (http://www.gnu.org/software/screen/),

which is a 'a full-screen window manager that multiplexes a physical 
terminal between several processes'. quite interesting thing.

anyway. what i'm doing now to use vim with r is, to open a screen 
session with r and vim running within it:

%screen R

starts screen with R in it. then i open another window with 'ctrl-a c'. 
'ctrl-a' start screen internal commands. in this new shell i can start 
vim normally to edit my .r-file. to change windows i use 'ctrl-a 
space'.

now i can split the window with 'ctrl-a S'. to jump between the 
splitted halfs you can use 'ctrl-a tab'.
i normally resize the r window with 'ctrl-a :resize 8', to make 8 lines 
high.

to send text from one window to another i put into my .screenrc - file:

bind y at R# paste .

this makes it possible to use 'ctrl-a y' to send your buffer to the R 
window.
to get something into your buffer you make use of the screen copy mode

'ctrl-a ['  starts the copy mode. now you can start copying by pressing 
'space', move the cursor and then pressing 'space' again. if you want 
to cut off the line numbers you can press 'v' before pressing 'space' 
the second time.
now you can send the buffer as i told above.

this works pretty well so far!

what i would like to improve further is, to be able to copy whole lines 
and blocks with simple commands, maybe with sending it to r directly. 
any ideas?

best,
michael





On Apr 19, 2006, at 8:42 AM, Martin Maechler wrote:

>> "PD" == Peter Dalgaard <[EMAIL PROTECTED]>
>> on 19 Apr 2006 01:06:02 +0200 writes:
>
> PD> "Jose Quesada" <[EMAIL PROTECTED]> writes:
>>> Hmm, how timely.
>>>
>>> I posted yesterday my solution to integrate R and
>>> vim. The message is in my sent box but I don't think it
>>> showed up in the list... Here it is again:
>>>
>>> Hi All,
>>>
>>> If you use vim to edit R code, you may be interested in
>>> this.  I have put together a personalized syntax file,
>>> some code templates, and a way to send code from Vim to R
>>> using autoHotKeys (windows).
>>>
>>> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
>>>
>>> Actually, the little autoHotKeys can be useful even if
>>> you don't use vim just to send the example R code from
>>> the help pages to the console.
>>>
>>> Best wishes, -Jose
>>>
>>> PS: @list moderators Any idea why my message (from a
>>> @gmail account) appeared in the sent box but never on the
>>> list?
>
> PD> I saw it the first time... Could it be that your mail
> PD> reader is set up to ignore mail from yourself?
>
> PD> Rather than resending stuff, it is preferable to check
> PD> the archives
>
> PD> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
> PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html
>
> PD> which are easily reachable via
>
 R-help@stat.math.ethz.ch mailing list >
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>
> Indeed. Please do check the archives.
>
> Now back to the subject:  Jose, I think your main contribution
> is based on "autoHotKeys"  and that only works on Windoze, right?
> Michael explicitly mentioned he's working in Mac OS X.
>
> Martin
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] boxplots instead of a scatterplot

2006-04-24 Thread Michael Graber
Dear R list,

I am a newbie to R and programming itself, so my question may be easy to 
answer for you.
I wanted to create a scatterplot and i used the following code:

par(mar=c(10, 4.1,4.1,2.1))
plot(q$location,q$points, , las=2, cex.axis=0.5,xlab="", ylab="" )

#location are character strings, there are about 70 locations
#points are numeric, there are more than 4 points for every location

my problem is that this code does not create a simple scatterplot with 
location on the x axis and points on the y axis. Instead of this i get 
"vertical boxplots" for every location.

Thanks for any hint,

Michael Graber

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R and ViM

2006-04-18 Thread Michael Graber
Dear all,

I'm starting to learn R, but I'm already programing for a while, using 
ViM as editor. Therefore I'd like to be able to use R together with 
ViM.

My question now is, whether there are already people out there knowing 
how to do this in a similar easy way as with Emacs, and if those would 
be willing to share this knowledge.
I did already research on the web on this topic, but i couldn't find 
satisfying answers, except one good looking approach on the ViM-website 
with a perl-script called funnel.pl, which I couldn't make running on 
my mac OSX 10.3.9 so far.

I'd be grateful for help.

Thanks,
Michael Graber

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] y-axis in histograms

2005-11-15 Thread Michael Graber
Dear R- list,
I have some data to present with histograms. Therefore I used hist(...). 
I have few values with almost 80% of
the frequencies (totaly 800) and some other values with low frequencies 
( totaly 5 -10 )
that I want to emphasize. Therefore I want to "cut" the y-axis on 100, 
but I
don't know how to deal with this.

Thanks in advance,

Michael Graber

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] data.frame-question

2005-10-25 Thread Michael Graber
Dear R-List,
I am very new to R and programming itself, so my question may be easy to 
answer for you.
I tried a lot and read through the manuals, but I still have the 
following problem:
I have 2 data-frames:
Number<-as.numeric (Number)
Name<-as.character (Name)
TAB1<-data.frame (Name,Number)
- it looks like this:-
Name Number
A 2
A 3
A 6
B 8
B 12
B 7
C 8
D 90
E 12
E 45
…
Name_singular<-as.character (Name_singular)
TAB2<-data.frame (Name_singular)
# it looks like this:
Name_singular
A
B
C
D
E
-My result should be a data-frame, where the first column is 
Name_singular and the second column should be the sum of the numbers 
where Name ==Name_singular.-
For example:
TAB3:
Name_singular Sum
A 11
B 27
…
- I tried it with for-loops, but I think there must be an easier way.-
I would be very grateful for your help,


Michael Graber

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] How to delete rows

2005-07-27 Thread Michael Graber
Dear R-users,

I am very new to R, so maybe my question is very easy to answer.
I have the following table:
TAB1<-data.frame(Name,Number), "Name" and "Number" are all character 
strings,
it looks like this:

Name  Number

ab  2

ab  2

NA 15

NA 15

NA 15

cd  3

ef  1

NA 15

NA 15

gh 15

gh 15

I want to delete all the rows which begin with "NA"
and all the rows where names are duplicates
(for example the second row).
I have tried this, but I only get numbers:

 for (i in 1:ZeileMax )  {if ( TAB1[[1]] [i] != "NA" ) 
{cat(TAB1[[1]][i],file = "Name.txt",fill= TRUE,append = TRUE ,sep = 
"");cat(TAB1[[2]][i], file="Number.txt", fill=TRUE,append=TRUE, sep="")}}
Name<-readLines("Name.txt")
Number<-readLines("Number.txt")
TAB<-data.frame(Name,Number)

 
Thanks in advance,

 

Michael Graber

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] converting an ASCII file to a matrix

2005-05-10 Thread Michael Graber
Dear R-WinEdit users,
I have a simple question, but somehow I cannot find the answer even
though I tried a lot!
I have an unstructured ASCII-file and I want to import it into a matrix
m in R, so that every character is defined by m[i;j]. The rows are not
of the same length.
The file looks like the following shortened abstract example:
name: x 
age: 9.9.99
record number: 999
title: x  xxx
keywords: xxx xx
"white space"
name:  
age: 8.8.88
record number: 8
title:  yy 
keywords: yyy  yyy
"white space"
The result should be for example: m[1;1]=n
I would be very grateful for your help!
Michael Graber
[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] converting an ASCII file to a matrix

2005-05-10 Thread Michael Graber
Dear R-WinEdit users,
I got a simple question, but somehow I cannot find the answer, although 
I have
tried a lot!
I got an ASCII-file and I want to import it into R, so that every
character is defined by [i;j].
The rows are not of the same length.

the file looks like the following shortened abstract example:
name: x 
age: 9.9.99
record number: 999
title: x  xxx
keywords: xxx xx
"white space"
name:  
age: 8.8.88
record number: 8
title:  yy 
keywords: yyy  yyy
"white space"
I would be very grateful for your help!
Michael Graber
[EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html