[R] R command line: need intelligent command history recall?

2006-02-04 Thread Michael
Hi all,

I am not sure if this feature exists in the R-console command line prompt:

In Matlab, if I want to enter a command which is similar to what I have
entered before,

I can enter a few prefix, then press -, the previous command that matches
with this prefix will then appear on this command line, and it saves a lot
of our time.

For example:

 abline(lm(new~old))
 cor(new, old)
...
...
... many lines entered
...
...

now I want to reuse abline(lm(new~old)),

R-console provides - functionality to recall old commands, but it trace
back one by one, it is slow if abline is way back, say 50 lines above my
current command line... it is too slow.

In Matlab, I just need to enter ab, then press -, if there is no other
ab** between the abline and my current command line, then the
console will intelligently recall abline back to me... Very convinient.

Does this feature exist in R?

Any other good Integrated Developement Environment for R?

Perhaps R users are mathematicians and statisticians; but as a software
engineer myself, I found a Visual C++-like integrated developement
environment is really efficient and time-saving. It and Borland C++ Builder
basically sets standard for modern UI design for programming IDEs.

To be a good IDE, it really needs to have an embedded inline debugger. I've
asked a statistician, he said he never debugged using a break-point,
line-by-line execution debugger -- I cannot imagine this. Where is the
productivity?

I've used Tinn-R. Frankly it is quite creative. It solved the line-by-line
execution problem by copying the line and pasted it to R-console
automatically. But a lot of times clipboard generates error. And often times
the copy and paste within Tinn editor itself are problemetic. For example, I
have been never able to select a portion of a line. When I paste a
paragraph, it always erases the current line and the following lines,
instead of inserting, ...  and if I want to select one line, it always
select two lines for me... etc.

Anyway, I hope there is IDEs that are better than Tinn-R.

Thanks a lot!

[[alternative HTML version deleted]]

__
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


Re: [R] R command line: need intelligent command history recall?

2006-02-04 Thread Philippe Grosjean
Michael wrote:
 Hi all,
 
 I am not sure if this feature exists in the R-console command line prompt:
 
 In Matlab, if I want to enter a command which is similar to what I have
 entered before,
 
 I can enter a few prefix, then press -, the previous command that matches
 with this prefix will then appear on this command line, and it saves a lot
 of our time.
 
 For example:
 
 
abline(lm(new~old))
cor(new, old)
 
 ...
 ...
 ... many lines entered
 ...
 ...
 
 now I want to reuse abline(lm(new~old)),
 
 R-console provides - functionality to recall old commands, but it trace
 back one by one, it is slow if abline is way back, say 50 lines above my
 current command line... it is too slow.
 
 In Matlab, I just need to enter ab, then press -, if there is no other
 ab** between the abline and my current command line, then the
 console will intelligently recall abline back to me... Very convinient.
 
 Does this feature exist in R?
 
 Any other good Integrated Developement Environment for R?
 
 Perhaps R users are mathematicians and statisticians; but as a software
 engineer myself, I found a Visual C++-like integrated developement
 environment is really efficient and time-saving. It and Borland C++ Builder
 basically sets standard for modern UI design for programming IDEs.
 
 To be a good IDE, it really needs to have an embedded inline debugger. I've
 asked a statistician, he said he never debugged using a break-point,
 line-by-line execution debugger -- I cannot imagine this. Where is the
 productivity?
 
 I've used Tinn-R. Frankly it is quite creative. It solved the line-by-line
 execution problem by copying the line and pasted it to R-console
 automatically. But a lot of times clipboard generates error. And often times
 the copy and paste within Tinn editor itself are problemetic. For example, I
 have been never able to select a portion of a line. When I paste a
 paragraph, it always erases the current line and the following lines,
 instead of inserting, ...  and if I want to select one line, it always
 select two lines for me... etc.
 
 Anyway, I hope there is IDEs that are better than Tinn-R.
 
 Thanks a lot!

Please, submit a bug report to Tinn-R authors, if you want to see it 
improved.
Best,

Philippe Grosjean

__
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


Re: [R] rgl install problem on Solaris 10 X86

2006-02-04 Thread Prof Brian Ripley
On Fri, 3 Feb 2006, Duncan Murdoch wrote:

 On 2/3/2006 6:37 PM, Dongseok Choi wrote:
 Hi,

   Could you help me to install the rgl package on Solaris 10 x86?

 No, but there have been a lot of changes to it since the last upload to
 CRAN.  You might want to grab a new copy from
 http://rgl.neoscientists.org/About.html by getting the latest Subversion
 checkout.

I tried to reproduce this, but our Solaris box does not have GL installed. 
My understanding is that the real problem seems to be that Color.cpp is 
using undeclared ISO C functions and needs to include

#include stdlib.h // for realoc and free
#include string.h // for memcpy

so please try adding them.

As for the -dalign messages, I presume you included them (like -xlibmil) 
in CXXFLAGS.  They are supported by our SunPro compiler, so which version 
is yours?  (In any case, you need to remove it, if I guessed right.)


 Duncan Murdoch


   I tried and got the following error messages.
   When I compiled my R as 64bit, I used the SUN ProW compilers.
   However, gcc seems to being used below as well as missing some information.

 Thank you in advance,
 Dongseok

 install.packages(rgl)
 --- Please select a CRAN mirror for use in this session ---
 * Installing *source* package 'rgl' ...
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking for X... libraries /usr/openwin/lib, headers /usr/openwin/include

 checking for libpng-config... yes
 configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 CC -xtarget=generic64 -I/export/home/choid/bin/R2.2.1/lib/R/include 
 -I/usr/openwin/include -DHAVE_PNG_H -I/usr/include/libpng12 
 -I/mounts/devel/SUNWspro/prd/include 
 -I/mounts/devel/GNU/repoz/readline43/include   -KPIC  -O -xlibmil -dalign 
 -I/mounts/devel/SUNWspro/prod/include -c api.cpp -o api.o
 CC: Warning: Option -dalign passed to ld, if ld is invoked, ignored otherwise
 CC -xtarget=generic64 -I/export/home/choid/bin/R2.2.1/lib/R/include 
 -I/usr/openwin/include -DHAVE_PNG_H -I/usr/include/libpng12 
 -I/mounts/devel/SUNWspro/prd/include 
 -I/mounts/devel/GNU/repoz/readline43/include   -KPIC  -O -xlibmil -dalign 
 -I/mounts/devel/SUNWspro/prod/include -c Background.cpp -o Background.o
 CC: Warning: Option -dalign passed to ld, if ld is invoked, ignored otherwise
 Background.cpp, line 54: Warning: boundingBox hides Shape::boundingBox.
 1 Warning(s) detected.
 CC -xtarget=generic64 -I/export/home/choid/bin/R2.2.1/lib/R/include 
 -I/usr/openwin/include -DHAVE_PNG_H -I/usr/include/libpng12 
 -I/mounts/devel/SUNWspro/prd/include 
 -I/mounts/devel/GNU/repoz/readline43/include   -KPIC  -O -xlibmil -dalign 
 -I/mounts/devel/SUNWspro/prod/include -c BBoxDeco.cpp -o BBoxDeco.o
 CC: Warning: Option -dalign passed to ld, if ld is invoked, ignored otherwise
 CC -xtarget=generic64 -I/export/home/choid/bin/R2.2.1/lib/R/include 
 -I/usr/openwin/include -DHAVE_PNG_H -I/usr/include/libpng12 
 -I/mounts/devel/SUNWspro/prd/include 
 -I/mounts/devel/GNU/repoz/readline43/include   -KPIC  -O -xlibmil -dalign 
 -I/mounts/devel/SUNWspro/prod/include -c Color.cpp -o Color.oCC: Warning: 
 Option -dalign passed to ld, if ld is invoked, ignored otherwise
 Color.cpp, line 142: Error: The function realloc must have a prototype.
 Color.cpp, line 159: Error: The function realloc must have a prototype.
 Color.cpp, line 160: Error: The function memcpy must have a prototype.
 Color.cpp, line 168: Error: The function free must have a prototype.
 Color.cpp, line 175: Error: The function realloc must have a prototype.
 Color.cpp, line 196: Error: The function realloc must have a prototype.
 Color.cpp, line 247: Error: The function realloc must have a prototype.
 7 Error(s) detected.
 *** Error code 7
 make: Fatal error: Command failed for target `Color.o'
 ERROR: compilation failed for package 'rgl'
 ** Removing '/export/home/choid/bin/R2.2.1/lib/R/library/rgl'

 The downloaded packages are in
 /tmp/Rtmp9Yaawc/downloaded_packages



  [[alternative HTML version deleted]]

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,

Re: [R] R command line: need intelligent command history recall?

2006-02-04 Thread Prof Brian Ripley
I guess you are using Windows, as you do not tell us.

History search facilities are available in Rterm.exe, and also in readline 
as used in the interface on Unix-alikes.  Many people use Emacs+ESS.  (In 
all cases I think the search mode is slicker than you describe for 
Matlab.) And RGui has another mechanism (read on) that is more suited to a 
GUI.

If you would like a history search in RGui.exe, please contribute the code 
to do so.  R is a volunteer project, and this was deliberately not 
implemented as no Windows user expressed an interest.

I think you will find `the productivity' is in using a higher-level 
language than C.  R does have a line-by-line debugger (called debug, so 
not hard to find).  If you want to set breakpoints etc, see package 
`debug' on CRAN.  And the `Writing R Extensions' manual in the R-devel 
version of R (to become 2.3.0) has a chapter on `Debugging'.

I teach 50 or so people to use R/S a year.  They end up with different 
patterns of working.  Some use script windows all the time, some use 
Emacs+ESS, some use a Linux command line/Rterm.exe.  I believe it is a 
mistake to think that `one size fits all'.

On Sat, 4 Feb 2006, Michael wrote:

 Hi all,

 I am not sure if this feature exists in the R-console command line prompt:

 In Matlab, if I want to enter a command which is similar to what I have
 entered before,

 I can enter a few prefix, then press -, the previous command that matches
 with this prefix will then appear on this command line, and it saves a lot
 of our time.

 For example:

 abline(lm(new~old))
 cor(new, old)
 ...
 ...
 ... many lines entered
 ...
 ...

 now I want to reuse abline(lm(new~old)),

Try history().  This pops up a window from which you can submit one or 
more command lines (or parts of lines).

 R-console provides - functionality to recall old commands, but it trace
 back one by one, it is slow if abline is way back, say 50 lines above my
 current command line... it is too slow.

 In Matlab, I just need to enter ab, then press -, if there is no other
 ab** between the abline and my current command line, then the
 console will intelligently recall abline back to me... Very convinient.

 Does this feature exist in R?

Yes.

 Any other good Integrated Developement Environment for R?

 Perhaps R users are mathematicians and statisticians; but as a software
 engineer myself, I found a Visual C++-like integrated developement
 environment is really efficient and time-saving. It and Borland C++ Builder
 basically sets standard for modern UI design for programming IDEs.

That is a matter of opinion.  If you want us to accept your opinion, you 
need to give your credentials, and you haven't even told us your name and 
affiliation.

 To be a good IDE, it really needs to have an embedded inline debugger. I've
 asked a statistician, he said he never debugged using a break-point,
 line-by-line execution debugger -- I cannot imagine this. Where is the
 productivity?

 I've used Tinn-R. Frankly it is quite creative. It solved the line-by-line
 execution problem by copying the line and pasted it to R-console
 automatically. But a lot of times clipboard generates error. And often times
 the copy and paste within Tinn editor itself are problemetic. For example, I
 have been never able to select a portion of a line. When I paste a
 paragraph, it always erases the current line and the following lines,
 instead of inserting, ...  and if I want to select one line, it always
 select two lines for me... etc.

 Anyway, I hope there is IDEs that are better than Tinn-R.

 Thanks a lot!

   [[alternative HTML version deleted]]

 __
 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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Permanent assignments

2006-02-04 Thread Mikael Anderson
I was wondering if it is possible to have permanent assignments in R pretty
much in the same sense that S-Plus works.The reason I am asking this is that
I was  trying to load  a FORTRAN subroutine to R and for some reason it
didn't work and R crashed and I lost everything which I hadn't saved with
save.image() or other similar functions. I tried adding on.exit(save.image())
to .Last() but it seems that if R crashes it doesn't get executed either.

I am not saying that this should be the default behaviour in R but I was
wondering if one could  have this as an option in R as well.

/Mikael

PS. In case it matters, I run R 2.2.1 under sparc-sun-solaris2.9.

[[alternative HTML version deleted]]

__
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


Re: [R] Permanent assignments

2006-02-04 Thread Prof Brian Ripley
On Sat, 4 Feb 2006, Mikael Anderson wrote:

 I was wondering if it is possible to have permanent assignments in R pretty
 much in the same sense that S-Plus works.

It is not possible (a consequence of the scoping differences is that R 
objects are not self-contained).  If you want S-PLUS, you know where to 
get it.

 The reason I am asking this is that I was trying to load a FORTRAN 
 subroutine to R and for some reason it didn't work and R crashed and I 
 lost everything which I hadn't saved with save.image() or other similar 
 functions. I tried adding on.exit(save.image()) to .Last() but it seems 
 that if R crashes it doesn't get executed either.

Take a look at the R-devel version of R.  That has a signal handler that
allows you to save your work when it catches a segfault etc.  Or you could 
ensure that you call save.image() before doing anything error-prone.

 I am not saying that this should be the default behaviour in R but I was
 wondering if one could  have this as an option in R as well.

 /Mikael

 PS. In case it matters, I run R 2.2.1 under sparc-sun-solaris2.9.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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


Re: [R] Permanent assignments

2006-02-04 Thread Gabor Grothendieck
You may be able to get checkpoint software that will periodically
save the state of the computer, including memory, allowing you
to roll back to any point.   That would not be R specific.  I don't
know specifically where to get it but maybe someone else knows
of or uses such software.

On 2/4/06, Mikael Anderson [EMAIL PROTECTED] wrote:
 I was wondering if it is possible to have permanent assignments in R pretty
 much in the same sense that S-Plus works.The reason I am asking this is that
 I was  trying to load  a FORTRAN subroutine to R and for some reason it
 didn't work and R crashed and I lost everything which I hadn't saved with
 save.image() or other similar functions. I tried adding on.exit(save.image())
 to .Last() but it seems that if R crashes it doesn't get executed either.

 I am not saying that this should be the default behaviour in R but I was
 wondering if one could  have this as an option in R as well.

 /Mikael

 PS. In case it matters, I run R 2.2.1 under sparc-sun-solaris2.9.

[[alternative HTML version deleted]]

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


Re: [R] all.equal() and which()

2006-02-04 Thread Patrick Burns
How about

which(abs(time(data) - 24.211)  1e-7)

or the tolerance of your choice.

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)

tom wright wrote:

Please excuse the lack of a complete dataset here, if its needed I'll be
happy to provide it.
Can anyone show me how to rewrite this?

Browse[1] time(data)[24210:24220]
[1] 24.209 24.210 24.211 24.212 24.213 24.214 24.215 24.216 24.217 
[10] 24.218 24.219

Browse[1] which(time(data)==24.211)
numeric(0)

I'm assuming its an eps fault but
which(all.equal(time(data),24.211))

dosnt seem to work

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


Re: [R] workspace question

2006-02-04 Thread Martin Henry H. Stevens
Hi Dave,
Look at save in Help. R automatically loads the workspace called  
.Rdata at the beginning of a session. You could rename workspace,  
and load or save whatever you like.
Hank
On Feb 3, 2006, at 11:20 AM, Afshartous, David wrote:


 All,

 When starting R, how does one prevent the loading the previous
 workspace which was saved?  I'd like to start a new project
 and save the new image in a different directory, but I'd like to
 partition this from the old project.  Does there exist a better
 way than just deleting the files associated w/ the old project
 manually?  I looked in the Intro to R manual and searched for
 workspace and didn't see anything on this aspect.

 Kind regards,
 Dave

 ps - please reply directly to [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-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


Re: [R] Glossay of available R functions

2006-02-04 Thread Martin Henry H. Stevens
Hi Patricia and Alexandre,
Start R help, and select the Search Engine  Keywords link. This will  
take you to a page where keywords (including functions) are arranged  
by topic. It includes base and recommended packages. Also not that  
on the CRAN website (and mirrors) is a link for Task Views. There,  
packages are grouped by topic.
Hank
On Jan 30, 2006, at 6:38 PM, Patricia J. Hawkins wrote:

 ASA == Alexandre Santos Aguiar [EMAIL PROTECTED]  
 writes:

 ASA I am new to R and read this list to learn. It is amazing how
 ASA frequently new functions pop in messages. Useful and timesaving
 ASA functions like subset (above) must be documented somewhere.

 ASA Is there a glossary of functions?

 I'm also new to R, and was wondering the same thing.  Took a bunch of
 tries, but if you run start.help() and then choose Packages, then
 Base, you will get the list of functions.

 As a newcomer, I hesitate to suggest this, but maybe there should be a
 comment on the index page to that effect?

 -- 
 Patricia J. Hawkins
 Hawkins Internet Applications
 www.hawkinsia.com

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


Re: [R] R command line: need intelligent command history recall?

2006-02-04 Thread Duncan Murdoch
On 2/4/2006 3:03 AM, Michael wrote:
 Hi all,
 
 I am not sure if this feature exists in the R-console command line prompt:
 
 In Matlab, if I want to enter a command which is similar to what I have
 entered before,
 
 I can enter a few prefix, then press -, the previous command that matches
 with this prefix will then appear on this command line, and it saves a lot
 of our time.
 
 For example:
 
 abline(lm(new~old))
 cor(new, old)
 ...
 ...
 ... many lines entered
 ...
 ...
 
 now I want to reuse abline(lm(new~old)),
 
 R-console provides - functionality to recall old commands, but it trace
 back one by one, it is slow if abline is way back, say 50 lines above my
 current command line... it is too slow.
 
 In Matlab, I just need to enter ab, then press -, if there is no other
 ab** between the abline and my current command line, then the
 console will intelligently recall abline back to me... Very convinient.
 
 Does this feature exist in R?
 
 Any other good Integrated Developement Environment for R?
 
 Perhaps R users are mathematicians and statisticians; but as a software
 engineer myself, I found a Visual C++-like integrated developement
 environment is really efficient and time-saving. It and Borland C++ Builder
 basically sets standard for modern UI design for programming IDEs.
 
 To be a good IDE, it really needs to have an embedded inline debugger. I've
 asked a statistician, he said he never debugged using a break-point,
 line-by-line execution debugger -- I cannot imagine this. Where is the
 productivity?

Writing such a thing is a little tricky, but should be possible if 
someone devotes enough time to it.  A couple of issues are:

  - R source code currently maintains no connection to the file it came 
from.  That would need to be added for a source level debugger.

  - Not all R functions come from source code in a file; they may have 
been entered at the console, produced as the result returned by another 
function, etc.

  - Such IDEs tend to be very platform-specific.  You can do a lot of 
work to make a nice IDE on Windows, and not be able to re-use much of it 
in other platforms.

Currently I don't know of anyone actively working on such a thing.  I 
agree with you that source-level IDEs are great for productivity, and 
I'd probably switch to one if someone else wrote it.  However, I am 
unlikely to ever have time to do the work myself.

Duncan Murdoch

 
 I've used Tinn-R. Frankly it is quite creative. It solved the line-by-line
 execution problem by copying the line and pasted it to R-console
 automatically. But a lot of times clipboard generates error. And often times
 the copy and paste within Tinn editor itself are problemetic. For example, I
 have been never able to select a portion of a line. When I paste a
 paragraph, it always erases the current line and the following lines,
 instead of inserting, ...  and if I want to select one line, it always
 select two lines for me... etc.
 
 Anyway, I hope there is IDEs that are better than Tinn-R.
 
 Thanks a lot!
 
   [[alternative HTML version deleted]]
 
 __
 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-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


Re: [R] Glossay of available R functions

2006-02-04 Thread Jim Porzak
Alexandre  Patricia,

As Bert Gunter periodically points out:
Newbies (and others!) may find useful the R Reference Card made available by
Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf  or through
the Contributed link on CRAN (where some other reference cards are also
linked). It categorizes and organizes a bunch of R's basic, most used
functions so that they can be easily found. For example, paste() is under
the Strings heading and expand.grid() is under Data Creation. For
newbies struggling to find the right R function as well as veterans who
can't quite remember the function name, it's very handy.

I still keep a hard copy of Tom Short's referncece card handy, as do
most of my colleagues at Loyalty Matrix.

--
HTH,
Jim Porzak
Loyalty Matrix Inc.
San Francisco, CA

On 1/30/06, Patricia J. Hawkins [EMAIL PROTECTED] wrote:
  ASA == Alexandre Santos Aguiar [EMAIL PROTECTED] writes:

 ASA I am new to R and read this list to learn. It is amazing how
 ASA frequently new functions pop in messages. Useful and timesaving
 ASA functions like subset (above) must be documented somewhere.

 ASA Is there a glossary of functions?

 I'm also new to R, and was wondering the same thing.  Took a bunch of
 tries, but if you run start.help() and then choose Packages, then
 Base, you will get the list of functions.

 As a newcomer, I hesitate to suggest this, but maybe there should be a
 comment on the index page to that effect?

 --
 Patricia J. Hawkins
 Hawkins Internet Applications
 www.hawkinsia.com

 __
 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-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] functional programming question

2006-02-04 Thread Erich Neuwirth
Many functional programming languages have a metafunction
which does the following:
it has two arguments, a function and a list of objects, all of the same
type.
The argument function itself has two arguments of the same type as all
the list objects, and the result of this function also is of the same type.
then
metafunction(f,list(x1,x2,xn)) produces
f(x1,f(x2,f(x3,,f(xn-1,xn)))..)
Does R have such a function, or do I need to code it myself?
In Scheme (Mathematica), this metafunction is called fold (Fold).


-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

__
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


Re: [R] functional programming question

2006-02-04 Thread Gabor Grothendieck
See:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/54896.html

On 2/4/06, Erich Neuwirth [EMAIL PROTECTED] wrote:
 Many functional programming languages have a metafunction
 which does the following:
 it has two arguments, a function and a list of objects, all of the same
 type.
 The argument function itself has two arguments of the same type as all
 the list objects, and the result of this function also is of the same type.
 then
 metafunction(f,list(x1,x2,xn)) produces
 f(x1,f(x2,f(x3,,f(xn-1,xn)))..)
 Does R have such a function, or do I need to code it myself?
 In Scheme (Mathematica), this metafunction is called fold (Fold).


 --
 Erich Neuwirth, University of Vienna
 Faculty of Computer Science
 Computer Supported Didactics Working Group
 Visit our SunSITE at http://sunsite.univie.ac.at
 Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

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


Re: [R] Passing additional paramaters to nlsList(nlme) fit function

2006-02-04 Thread Spencer Graves
  The nlsList function does NOT have the common ellipsis (... ) 
argument to support that.

  An alternative is use vector to create an object of mode list of 
the desired length, then in a loop call nls (which does support ...) 
and store the results in a list.  However, this won't produce an object 
of class nlsList, which means that the methods writted for nlsList 
will not be available to you.

  If it were my problem, I might make a local copy of the nlsList 
function and try to modify it to work, at least for my problem.  In this 
case, nlsList is merely a call to UseMethods.  To get beyond that, I 
requested 'methods(nlsList)' with the following result:

  nlsList.formulanlsList.selfStart*

  If you supply your own starting values, you don't need 
nlsList.selfStart.  If you do need it, you can get it via 
'getAnywhere(nlsList.selfStart)';  the asterisk (*) says that this 
function is non-visible, which means that just typing its name won't 
get it.  Then I might use debug to figure out what it's doing and what 
I want to change.

  hope this helps.
  spencer graves

Dieter Menne wrote:

 Hello, nls-users,
 
 is it possible to pass additional parameters to the model function that are
 known and groupwise constant with nlsList? I could not find something like a
 keep this fixed option in the documentation and the code (my fault...?)
 
 The current workaround is to break the problem down into groups and use
 globals to pass the constant parameters, but it is ugly code and won't work
 when an over-all nlme is needed.
 
 Dieter Menne
 
 __
 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-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] Refreshing X11 plots

2006-02-04 Thread Ted Harding
Hi Folks,

This question (or very similar) seems to have been
asked before, acorsding to R Site Search:

Timur Elzhov on June 23 2003
David B. Dahl on March 01 2002
(though the latter appears to have date April 10 2003 according
to the search result, but the above is the archive date).

Situation: I plot a lot of stuff in an X11 window (device #2),
and then with X11() open a new X11 wibdow (device #3) and plot
a lot of similar stuff. So, at this stage, device 3 is active.

Now I move away from that screen (switching to a different
desktop), to do something else; and when I move back to
where I was the active display (#3) refreshes itself, but
the inactive one (#2) is blank and I have found no trick to
get it to refresh itself short of replaying all the commands
needed to draw the plot in the first place.

This is a similar issue to the one stated in the two mails referred
to above, neither of which seems to have received an answer.

Is there a way to refresh the plot without re-plotting it from
scratch? (R on Linux with X11).

With thanks, and best wishes to all,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 04-Feb-06   Time: 19:47:42
-- XFMail --

__
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


Re: [R] Refreshing X11 plots

2006-02-04 Thread Ted Harding
Correction to description: see below.

On 04-Feb-06 Ted Harding wrote:
 Hi Folks,
 
 This question (or very similar) seems to have been
 asked before, acorsding to R Site Search:
 
 Timur Elzhov on June 23 2003
 David B. Dahl on March 01 2002
 (though the latter appears to have date April 10 2003 according
 to the search result, but the above is the archive date).
 
 Situation: I plot a lot of stuff in an X11 window (device #2),
 and then with X11() open a new X11 wibdow (device #3) and plot
 a lot of similar stuff. So, at this stage, device 3 is active.
 
 Now I move away from that screen (switching to a different
 desktop), to do something else; and when I move back to
 where I was the active display (#3) refreshes itself, but
 the inactive one (#2) is blank and I have found no trick to
 get it to refresh itself short of replaying all the commands
 needed to draw the plot in the first place.

In fact it is apparently the plot on device #2 (the first device
opened) which refreshes itself, and the second plot (on device #3)
which goes blank and stays blank, regardless of the order in which
the plots are created and which device is currently active. Apologies!

 This is a similar issue to the one stated in the two mails referred
 to above, neither of which seems to have received an answer.
 
 Is there a way to refresh the plot without re-plotting it from
 scratch? (R on Linux with X11).
 
 With thanks, and best wishes to all,
 Ted.
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 04-Feb-06   Time: 19:47:42
 -- XFMail --


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 04-Feb-06   Time: 20:11:18
-- XFMail --

__
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] srt relative to figure

2006-02-04 Thread ivo welch
Dear R wizards:

I would love to write a general function that matches the slope of a plotted
line in an xy-plot at a particular x,y location.  something like

   x- (1:10)^2; y- 40:50;
   plot( x,y, type=l, xlim=c(0,90) )
   srt.at5 = text.at.current.plot.with.slope( x, y,  5);
   text( x[5],y[5], pos=3, srt=srt.at.5);

to do this, I first need to compute the function slope around x[5], which is
an easy task.  alas, the harder task is that I need to scale this by the
plot aspect ratio and the axes.  How can a function read this from the
current plot?

(Has someone written such a function, perhaps more embellished, to save me
the debugging effort?)

Or, is there an alternative to srt, which slopes the text relative to the
existing scale?

help appreciated.

sincerely,

/ivo welch

[[alternative HTML version deleted]]

__
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


Re: [R] Passing additional paramaters to nlsList(nlme) fit function

2006-02-04 Thread Dieter Menne
Original question...

  is it possible to pass additional parameters to the model function that are
  known and groupwise constant with nlsList? I could not find something like a
  keep this fixed option in the documentation and the code (my fault...?)

Spencer Graves spencer.graves at pdf.com writes:

 
 The nlsList function does NOT have the common ellipsis (... ) 
 argument to support that.
...
 If it were my problem, I might make a local copy of the nlsList 
 function and try to modify it to work, at least for my problem.  In this 
 case, nlsList is merely a call to UseMethods.  To get beyond that, I 
 requested 'methods(nlsList)' with the following result:
 
 nlsList.formulanlsList.selfStart*

Thanks, Spencer. When I studied the quinModel example (page 380, 
Pinheiro/Bates) I noted that it is possible to pass non-varying parameters to 
nlme by not including them in the fixed=... parameter. As quite a few examples 
in PB used nlsList for the first approximation (and, as far I understand, nlme 
does it internally anyway) I had missed this feature of nlme, even if the PB-
book heavily use-stained.

Dieter

__
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] srt --- slope text with function?

2006-02-04 Thread ivo welch
[resent, plus small addition; I do not understand why gmail sent a
weird charset.]

Dear R wizards:

I would love to write a general function that matches the slope of a plotted
line in an xy-plot at a particular x,y location.  something like

   x- (1:10)^2; y- 40:50;
   plot( x,y, type=l, xlim=c(0,90) )
   srt.at5 = text.at.current.plot.with.slope( x, y,  5);
   text( x[5],y[5], pos=3, srt=srt.at.5);

to do this, I first need to compute the function slope around x[5], which is
an easy task.  alas, the harder task is that I need to scale this by the
plot aspect ratio and the axes.  How can a function read this from the
current plot?

(Has someone written such a function, perhaps more embellished, to save me
the debugging effort?)

Or, is there an alternative to srt, which slopes the text relative to the
existing scale?

  *** come to think of it, what I would really like is the ability of
text to 'snake' itself along the line itself.  I doubt that this is
easily possible, but I just wanted to ask.

help appreciated.

sincerely,

/ivo welch

__
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] image() and text

2006-02-04 Thread Andrej Kastrin
Dear useRs,

I have 4×4 symmetrical matrix ; then I use

image(log(my.matrix)) to visualise it.

Is there any 'simple' way to add text labels into each cell lie on 
diagonal of the image plot? Thanks for any pointers...

Cheers, Andrej

__
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

Re: [R] srt --- slope text with function?

2006-02-04 Thread Duncan Murdoch
On 2/4/2006 3:50 PM, ivo welch wrote:
 [resent, plus small addition; I do not understand why gmail sent a
 weird charset.]
 
 Dear R wizards:
 
 I would love to write a general function that matches the slope of a plotted
 line in an xy-plot at a particular x,y location.  something like
 
x- (1:10)^2; y- 40:50;
plot( x,y, type=l, xlim=c(0,90) )
srt.at5 = text.at.current.plot.with.slope( x, y,  5);
text( x[5],y[5], pos=3, srt=srt.at.5);
 
 to do this, I first need to compute the function slope around x[5], which is
 an easy task.  alas, the harder task is that I need to scale this by the
 plot aspect ratio and the axes.  How can a function read this from the
 current plot?

I haven't done this, but you can presumably work it out from the 
conversions implied by the fig, fin, plt, and/or usr values.
 
 (Has someone written such a function, perhaps more embellished, to save me
 the debugging effort?)
 
 Or, is there an alternative to srt, which slopes the text relative to the
 existing scale?
 
   *** come to think of it, what I would really like is the ability of
 text to 'snake' itself along the line itself.  I doubt that this is
 easily possible, but I just wanted to ask.

Using strsplit and strwidth you should be able to do it, but it will 
probably look quite ugly.

Duncan Murdoch

__
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


Re: [R] srt --- slope text with function?

2006-02-04 Thread ivo welch
Thank you, Duncan.  This led me to the info I needed.  Here is a
simple utility function that does what I needed---maybe it will come
in helpful for others.


 native.slope computes a suitable srt from a function around
 a point on a function.  This is useful until text() gets
 an srt parameter that is relative to the coordinate system.
   (Ideally, R would be able to slope along a function.)


native.slope - function( x, y, where.i,
 xlim = par()$xaxp, ylim= par()$yaxp,
 asp.ratio = (par()$fin)[1]/(par()$fin)[2] ) {
  if (where.i=1) { return(0); }
  if (where.i=length(y)) { return(0); }
  if (length(x)!=length(y)) {
stop(native.slope: Sorry, but x and y must have equal dimensions,
not , length(x),  and , length(y), \n); }

  # native slope in a 1:1 coordinate system
  d= ( (y[where.i-1]-y[where.i+1])/(x[where.i-1]-x[where.i+1]) );
  if (is.na(d)) return(0); # we do not know how to handle an undefined
spot at a function!

  d.m= (ylim[2]-ylim[1])/(xlim[2]-xlim[1]); # now adjust by the axis scale
  if (is.na(d)) stop(native.slope: internal error, I do not have
sensible axis dimensions (, xlim, ylim, )\n);

  if (is.na(asp.ratio)) stop(native.slope: internal error, I do not
have a reasonable drawing aspect ratio);

  net.slope= d/asp.ratio/d.m;
  return(slope = atan(net.slope)/pi*180.0 )
}


# some test code
x- seq(-10,20,by=0.1)
y- x*x;

plot( x, y, type=l );

display= ((1:length(y))%%40 == 0)

for (i in 1:(length(y))) {
  if (display[i]) {
points(x[i],y[i], pch=19);
srt= native.slope( x, y, i );
text( x[i], y[i], paste(i,=,x[i],=,srt), srt=srt, cex=0.9 );
  }
}



On 2/4/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 2/4/2006 3:50 PM, ivo welch wrote:
  [resent, plus small addition; I do not understand why gmail sent a
  weird charset.]
 
  Dear R wizards:
 
  I would love to write a general function that matches the slope of a plotted
  line in an xy-plot at a particular x,y location.  something like
 
 x- (1:10)^2; y- 40:50;
 plot( x,y, type=l, xlim=c(0,90) )
 srt.at5 = text.at.current.plot.with.slope( x, y,  5);
 text( x[5],y[5], pos=3, srt=srt.at.5);
 
  to do this, I first need to compute the function slope around x[5], which is
  an easy task.  alas, the harder task is that I need to scale this by the
  plot aspect ratio and the axes.  How can a function read this from the
  current plot?

 I haven't done this, but you can presumably work it out from the
 conversions implied by the fig, fin, plt, and/or usr values.
 
  (Has someone written such a function, perhaps more embellished, to save me
  the debugging effort?)
 
  Or, is there an alternative to srt, which slopes the text relative to the
  existing scale?
 
*** come to think of it, what I would really like is the ability of
  text to 'snake' itself along the line itself.  I doubt that this is
  easily possible, but I just wanted to ask.

 Using strsplit and strwidth you should be able to do it, but it will
 probably look quite ugly.

 Duncan Murdoch


__
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


Re: [R] srt --- slope text with function?

2006-02-04 Thread ivo welch
Some more experimentation reveals that I need to also adjust for the
plot dimensions.  (And there are other issues I probably do not know
yet and totally misprogrammed...just trying to be helpful.)

native.slope - function( x, y, where.i,
 xlim = par()$xaxp, ylim= par()$yaxp,
 asp.ratio = (par()$fin)[1]/(par()$fin)[2],
 debug =0) {
  if (where.i=1) { return(0); }
  if (where.i=length(y)) { return(0); }
  if (length(x)!=length(y)) {
stop(native.slope: Sorry, but x and y must have equal dimensions,
not , length(x),  and , length(y), \n); }

  # native slope in a 1:1 coordinate system
  d= ( (y[where.i-1]-y[where.i+1])/(x[where.i-1]-x[where.i+1]) );
  if (is.na(d)) return(0); # we do not know how to handle an undefined
spot at a function!

  d.m= (ylim[2]-ylim[1])/(xlim[2]-xlim[1]); # now adjust by the axis scale
  if (is.na(d)) stop(native.slope: internal error, I do not have
sensible axis dimensions (, xlim, ylim, )\n);

  if (is.na(asp.ratio)) stop(native.slope: internal error, I do not
have a reasonable drawing aspect ratio);

  ## alas, we also need to take into account the plot region:
  pq= par()$plt; plt.distort= (pq[2]-pq[1])/(pq[4]-pq[3]);

  net.slope= d/asp.ratio/d.m / plt.distort;

  slope = atan(net.slope)/pi*180.0;


  if (debug) {
cat(xlim=, par()$xaxp, \n);
cat(ylim=, par()$yaxp, \n\n);

cat(native.slope: d=, d,  (,y[where.i-1],y[where.i+1],
x[where.i-1], x[where.i+1],),
d.m=,d.m,  (, ylim[2],ylim[1],xlim[2],xlim[1], ),
asp.ratio=, (par()$fin)[1], :, (par()$fin)[2], ==, net.slope,
=, slope, deg\n);
  }

  return( slope = slope );
}





On 2/4/06, ivo welch [EMAIL PROTECTED] wrote:
 Thank you, Duncan.  This led me to the info I needed.  Here is a
 simple utility function that does what I needed---maybe it will come
 in helpful for others.

 
  native.slope computes a suitable srt from a function around
  a point on a function.  This is useful until text() gets
  an srt parameter that is relative to the coordinate system.
    (Ideally, R would be able to slope along a function.)
 
  [old function deleted]

 # some test code
 x- seq(-10,20,by=0.1)
 y- x*x;

 plot( x, y, type=l );

 display= ((1:length(y))%%40 == 0)

 for (i in 1:(length(y))) {
   if (display[i]) {
 points(x[i],y[i], pch=19);
 srt= native.slope( x, y, i );
 text( x[i], y[i], paste(i,=,x[i],=,srt), srt=srt, cex=0.9 );
   }
 }



 On 2/4/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
  On 2/4/2006 3:50 PM, ivo welch wrote:
   [resent, plus small addition; I do not understand why gmail sent a
   weird charset.]
  
   Dear R wizards:
  
   I would love to write a general function that matches the slope of a 
   plotted
   line in an xy-plot at a particular x,y location.  something like
  
  x- (1:10)^2; y- 40:50;
  plot( x,y, type=l, xlim=c(0,90) )
  srt.at5 = text.at.current.plot.with.slope( x, y,  5);
  text( x[5],y[5], pos=3, srt=srt.at.5);
  
   to do this, I first need to compute the function slope around x[5], which 
   is
   an easy task.  alas, the harder task is that I need to scale this by the
   plot aspect ratio and the axes.  How can a function read this from the
   current plot?
 
  I haven't done this, but you can presumably work it out from the
  conversions implied by the fig, fin, plt, and/or usr values.
  
   (Has someone written such a function, perhaps more embellished, to save me
   the debugging effort?)
  
   Or, is there an alternative to srt, which slopes the text relative to the
   existing scale?
  
 *** come to think of it, what I would really like is the ability of
   text to 'snake' itself along the line itself.  I doubt that this is
   easily possible, but I just wanted to ask.
 
  Using strsplit and strwidth you should be able to do it, but it will
  probably look quite ugly.
 
  Duncan Murdoch
 


__
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


Re: [R] srt --- slope text with function?

2006-02-04 Thread Duncan Murdoch
I don't think it's got the slope exactly right - you'll see this if you 
go to a really extreme aspect ratio by changing the shape of a window to 
be long and thin before you call your code.  To fix this:

  - use usr rather than xaxp and yaxp to get the limits of the 
plot region in user coordinates; those two refer to the ticks, not the 
whole plot region as usr does.

- fin is the whole figure region, not just the plot region; you need 
to use plt to modify it to find the plot region within it.  So I think 
the aspect ratio should really be done as

   pars - par(fin, plt)

   asp.ratio - (diff(pars$plt)[1]*pars$fin[1]) /
(diff(pars$plt)[3]*pars$fin[2])

Some other suggestions:

  - split the function into two:  one that determines a slope from the 
data, and one that converts a slope to an angle suitable for srt.  (I 
think the latter would have pretty wide use; the former is pretty 
specialized for data the way you're using it).

  - use the fact that defaults in a function call can be local variables 
in the function, so that you only need one call to par() instead of 4. 
(The 4 calls probably take a negigible amount of time, but it just looks 
wasteful to make them.)

Duncan Murdoch

On 2/4/2006 5:19 PM, ivo welch wrote:
 Thank you, Duncan.  This led me to the info I needed.  Here is a
 simple utility function that does what I needed---maybe it will come
 in helpful for others.
 
 
  native.slope computes a suitable srt from a function around
  a point on a function.  This is useful until text() gets
  an srt parameter that is relative to the coordinate system.
    (Ideally, R would be able to slope along a function.)
 
 
 native.slope - function( x, y, where.i,
xlim = par()$xaxp, ylim= par()$yaxp,
asp.ratio = (par()$fin)[1]/(par()$fin)[2] ) {
   if (where.i=1) { return(0); }
   if (where.i=length(y)) { return(0); }
   if (length(x)!=length(y)) {
 stop(native.slope: Sorry, but x and y must have equal dimensions,
 not , length(x),  and , length(y), \n); }
 
   # native slope in a 1:1 coordinate system
   d= ( (y[where.i-1]-y[where.i+1])/(x[where.i-1]-x[where.i+1]) );
   if (is.na(d)) return(0); # we do not know how to handle an undefined
 spot at a function!
 
   d.m= (ylim[2]-ylim[1])/(xlim[2]-xlim[1]); # now adjust by the axis scale
   if (is.na(d)) stop(native.slope: internal error, I do not have
 sensible axis dimensions (, xlim, ylim, )\n);
 
   if (is.na(asp.ratio)) stop(native.slope: internal error, I do not
 have a reasonable drawing aspect ratio);
 
   net.slope= d/asp.ratio/d.m;
   return(slope = atan(net.slope)/pi*180.0 )
 }
 
 
 # some test code
 x- seq(-10,20,by=0.1)
 y- x*x;
 
 plot( x, y, type=l );
 
 display= ((1:length(y))%%40 == 0)
 
 for (i in 1:(length(y))) {
   if (display[i]) {
 points(x[i],y[i], pch=19);
 srt= native.slope( x, y, i );
 text( x[i], y[i], paste(i,=,x[i],=,srt), srt=srt, cex=0.9 );
   }
 }
 
 
 
 On 2/4/06, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 2/4/2006 3:50 PM, ivo welch wrote:
 [resent, plus small addition; I do not understand why gmail sent a
 weird charset.]

 Dear R wizards:

 I would love to write a general function that matches the slope of a plotted
 line in an xy-plot at a particular x,y location.  something like

x- (1:10)^2; y- 40:50;
plot( x,y, type=l, xlim=c(0,90) )
srt.at5 = text.at.current.plot.with.slope( x, y,  5);
text( x[5],y[5], pos=3, srt=srt.at.5);

 to do this, I first need to compute the function slope around x[5], which is
 an easy task.  alas, the harder task is that I need to scale this by the
 plot aspect ratio and the axes.  How can a function read this from the
 current plot?
 I haven't done this, but you can presumably work it out from the
 conversions implied by the fig, fin, plt, and/or usr values.
 (Has someone written such a function, perhaps more embellished, to save me
 the debugging effort?)

 Or, is there an alternative to srt, which slopes the text relative to the
 existing scale?

   *** come to think of it, what I would really like is the ability of
 text to 'snake' itself along the line itself.  I doubt that this is
 easily possible, but I just wanted to ask.
 Using strsplit and strwidth you should be able to do it, but it will
 probably look quite ugly.

 Duncan Murdoch


__
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] saving a character vector

2006-02-04 Thread Taka Matzmoto
Hi R users

I wrote a function that generates some character strings.

generate.index-function(n.item){
for (i in 1:n.item)
{
for (j in ((i+1):n.item))
{

cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)

}

}
}

I like to save what appears on the screen when I run using 
generate.index(10) as a character vector

I used
temp - generate.index(10)

but it didn't work.

Could you provide some advice on this issue?

Thanks in advance

TM

__
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] Mixed models and missing p-value...

2006-02-04 Thread Simon Blanchet
Dear R-users,

I computed a simple mixed models which was:

 mod-lmer(nb ~ site + (1|patelle),tr)

The output was:

Linear mixed-effects model fit by REML
Formula: nb ~ site + (1 | patelle)
Data: tr
   AIC  BIClogLik MLdeviance REMLdeviance
  1157.437 1168.686 -574.7184   1164.523 1149.437
Random effects:
  Groups   NameVariance Std.Dev.
  patelle  (Intercept)  34.995   5.9157
  Residual 744.736  27.2899
# of obs: 123, groups: patelle, 33

Fixed effects:
 Estimate Std. Error t value
(Intercept)  60.3483 4.3929 13.7378
siteLCN -20.1969 7.8070 -2.5870
siteLCS -18.2154 6.1514 -2.9612

Correlation of Fixed Effects:
 (Intr) sitLCN
siteLCN -0.563
siteLCS -0.714  0.402

I don't understand why D.F. and p-values associated to the fixed-effects 
coefficients are missing.
Could anyone help me?

When I tried another model (mod2-lmer(nb ~ site + 
(1|patelle),tr,family=poisson)), D.F. and p-values were given...

Thank you in advance.

Very sincerely, Simon



BLANCHET Simon
PhD student
Université Laval - Québec-Océan / CIRSA
Pavillon Alexandre-Vachon
Local 8022
Québec (Québec), Canada G1K 7P4
Téléphone : (418) 656-2131 poste 8022
courriel : [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


Re: [R] saving a character vector

2006-02-04 Thread Dominik Heier
Am Samstag, den 04.02.2006, 17:46 -0600 schrieb Taka Matzmoto:
 Hi R users
 
 I wrote a function that generates some character strings.
 
 generate.index-function(n.item){
 for (i in 1:n.item)
 {
 for (j in ((i+1):n.item))
 {
 
 cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)
   ^
replace cat with return
 }
 
 }
 }
 
 I like to save what appears on the screen when I run using 
 generate.index(10) as a character vector
 
 I used
 temp - generate.index(10)
 
 but it didn't work.
 
 Could you provide some advice on this issue?
 
 Thanks in advance
 
 TM
 
 __
 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-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


Re: [R] saving a character vector

2006-02-04 Thread John Fox
Dear Dominik,

Replacing cat() with return() won't do the trick, I think: First, it will
return only the first time through the inner loop; second, it will call
return with several values.

I think that Taka probably had in mind something like:

generate.index-function(n.item){
result - rep(, n.item*(n.item-1)/2)
index - 0
for (i in 1:(n.item - 1))
{
for (j in ((i+1):n.item))
{
index - index + 1
result[index] - paste(i, formatC(i, digits=2, flag=0),
.,
formatC(j, digits=2, flag=0), sep=)
}
}
result
}

For example:

 generate.index(4)
[1] i001.002 i001.003 i001.004 i002.003 i002.004 i003.004

Note that I corrected the range of the outer (i) loop.

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Dominik Heier
 Sent: Saturday, February 04, 2006 6:57 PM
 To: Taka Matzmoto
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] saving a character vector
 
 Am Samstag, den 04.02.2006, 17:46 -0600 schrieb Taka Matzmoto:
  Hi R users
  
  I wrote a function that generates some character strings.
  
  generate.index-function(n.item){
  for (i in 1:n.item)
  {
  for (j in ((i+1):n.item))
  {
  
  
 cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),
  \n,sep=)
^
 replace cat with return
  }
  
  }
  }
  
  I like to save what appears on the screen when I run using
  generate.index(10) as a character vector
  
  I used
  temp - generate.index(10)
  
  but it didn't work.
  
  Could you provide some advice on this issue?
  
  Thanks in advance
  
  TM
  
  __
  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-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-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


Re: [R] saving a character vector

2006-02-04 Thread Dominik Heier
Sorry. Forget my last post. I seem to be brain dead. Going to bed now
(its late in Germany). Sorry again.. 



Am Sonntag, den 05.02.2006, 00:56 +0100 schrieb Dominik Heier:
 Am Samstag, den 04.02.2006, 17:46 -0600 schrieb Taka Matzmoto:
  Hi R users
  
  I wrote a function that generates some character strings.
  
  generate.index-function(n.item){
  for (i in 1:n.item)
  {
  for (j in ((i+1):n.item))
  {
  
  cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)
^
 replace cat with return
^
WRONG!! Append it to an array or list and return it at the end of the
function (wich R does by its self)


  }
  
  }
  }
  
  I like to save what appears on the screen when I run using 
  generate.index(10) as a character vector
  
  I used
  temp - generate.index(10)
  
  but it didn't work.
  
  Could you provide some advice on this issue?
  
  Thanks in advance
  
  TM
  
  __
  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-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-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


Re: [R] saving a character vector

2006-02-04 Thread Ferdinand Alimadhi
In order to use something like
temp-generate.index(10)
your function should return something.
See ?return for more information, especially this
 If the end of a function is reached without calling 'return', the
 value of the last evaluated expression is returned.

The following code might be what you want.  (P.S Simple replacing cat 
with return will not work because return requires expression as argument)

HTH

generate.index-function(n.item){
  res-
  for (i in 1:n.item)
{
  for (j in ((i+1):n.item))
{
 
  
res-paste(res,i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)
 
}
 
}
  return(res)
}




Dominik Heier wrote:

Am Samstag, den 04.02.2006, 17:46 -0600 schrieb Taka Matzmoto:
  

Hi R users

I wrote a function that generates some character strings.

generate.index-function(n.item){
for (i in 1:n.item)
{
for (j in ((i+1):n.item))
{

cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)


   ^
replace cat with return
  

}

}
}

I like to save what appears on the screen when I run using 
generate.index(10) as a character vector

I used
temp - generate.index(10)

but it didn't work.

Could you provide some advice on this issue?

Thanks in advance

TM

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



-- 
Ferdinand Alimadhi
Programmer / Analyst
Harvard University
The Institute for Quantitative Social Science
(617) 496-0187
[EMAIL PROTECTED]
www.iq.harvard.edu


[[alternative HTML version deleted]]

__
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


Re: [R] saving a character vector

2006-02-04 Thread jim holtman
Is this what you want?  It returns a character vector with the values:

 generate.index-function(n.item){
+ .return - character()  # initialize vector
+ for (i in 1:n.item)
+{
+for (j in ((i+1):n.item))
+{
+ # concatenate the results
+ .return - c(.return,
paste(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),sep=))
+
+}
+
+}
+.return
+  }


 generate.index(10)
 [1] i001.002 i001.003 i001.004 i001.005 i001.006 i001.007
 [7] i001.008 i001.009 i001.010 i002.003 i002.004 i002.005
[13] i002.006 i002.007 i002.008 i002.009 i002.010 i003.004
[19] i003.005 i003.006 i003.007 i003.008 i003.009 i003.010
[25] i004.005 i004.006 i004.007 i004.008 i004.009 i004.010
[31] i005.006 i005.007 i005.008 i005.009 i005.010 i006.007
[37] i006.008 i006.009 i006.010 i007.008 i007.009 i007.010
[43] i008.009 i008.010 i009.010 i010.011 i010.010




On 2/4/06, Taka Matzmoto [EMAIL PROTECTED] wrote:

 Hi R users

 I wrote a function that generates some character strings.

 generate.index-function(n.item){
 for (i in 1:n.item)
{
for (j in ((i+1):n.item))
{


 cat(i,formatC(i,digits=2,flag=0),.,formatC(j,digits=2,flag=0),\n,sep=)

}

}
}

 I like to save what appears on the screen when I run using
 generate.index(10) as a character vector

 I used
 temp - generate.index(10)

 but it didn't work.

 Could you provide some advice on this issue?

 Thanks in advance

 TM

 __
 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




--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

[[alternative HTML version deleted]]

__
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 extract predicted values from a quantreg fit?

2006-02-04 Thread Denis Chabot
Hi,

I have used package quantreg to estimate a non-linear fit to the  
lowest part of my data points. It works great, by the way.

But I'd like to extract the predicted values. The help for  
predict.qss1 indicates this:

predict.qss1(object, newdata, ...)
and states that newdata is a data frame describing the observations  
at which prediction is to be made.

I used the same technique I used to extract predicted values of GAM  
fits with mgcv package: if I fit a GAM using x as the x variable on  
which I smooth, I then create such a dataframe like this

MyX - data.frame(x=seq(-1,60))

This works fine with GAM (mgcv) but not with quantreg:

  y - rnorm(500, 10, 5)
  x - rep(seq(1,50,1), 10)
  My.data - data.frame(x, y)
  My.x - data.frame(x=seq(5,45))
 
  fit - rqss(y ~ qss(x, lambda=5), tau=0.05)
  pred - predict.qss1(fit, My.x)

Could someone please help me creating a dataframe newdata that  
would satisfy predict.qss1?

Thanks in advance,

Denis Chabot

__
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] Application of R with Multinomial Probit Model

2006-02-04 Thread Andy Wong
Dear All,

I still cannot solve the error (see attached printed pdf file).  Can
somebody give me some advice?  I have also attached my data file in Excel
and text formats for your reference.  I have already assigned the
y1,y2,x1,x12,z1,z2.z14 as V1V23 but still can't work.  Please
try out and advise.  Thanks.

Andy


result.pdf
Description: Adobe PDF document
__
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] generating strings in a tricky order

2006-02-04 Thread Taka Matzmoto
Hi R users

I like to generate some strings (a character vector) in a special way like

If i have 5 variables

002.001,
003.001, 003.002,
004.001, 004.002, 004.003,
005.001, 005.002, 005.003, 005.004

so the created string vector's elements are

002.001, 003.001, 003.002,004.001, 004.002, 004.003,005.001, 
005.002, 005.003, 005.004

I tried to come up with for loop with two indexes (i and j) but I kept 
failing to generate that kind of order of strings. The order of the element 
in the character vector is very improtant.

Any advice or help would be appreciated

Thanks in advance

TM,

__
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


Re: [R] generating strings in a tricky order

2006-02-04 Thread jim holtman
Is this what you want?

 n - 5
 result - character()
 for (i in 2:n){
+ for (j in 1:(i - 1)){
+ result - c(result, sprintf(%03d:%03d, i, j))
+ }
+ }
 result
 [1] 002:001 003:001 003:002 004:001 004:002 004:003 005:001
 [8] 005:002 005:003 005:004



On 2/4/06, Taka Matzmoto [EMAIL PROTECTED] wrote:

 Hi R users

 I like to generate some strings (a character vector) in a special way like

 If i have 5 variables

 002.001,
 003.001, 003.002,
 004.001, 004.002, 004.003,
 005.001, 005.002, 005.003, 005.004

 so the created string vector's elements are

 002.001, 003.001, 003.002,004.001, 004.002, 004.003,005.001,
 005.002, 005.003, 005.004

 I tried to come up with for loop with two indexes (i and j) but I kept
 failing to generate that kind of order of strings. The order of the
 element
 in the character vector is very improtant.

 Any advice or help would be appreciated

 Thanks in advance

 TM,

 __
 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




--
Jim Holtman
Cincinnati, OH
+1 513 247 0281

What the problem you are trying to solve?

[[alternative HTML version deleted]]

__
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


Re: [R] generating strings in a tricky order

2006-02-04 Thread Gabor Grothendieck
Try this:

x - outer(1:5, 1:5, sprintf, fmt = %03d.%03d)
sort(x[lower.tri(x)])

On 2/4/06, Taka Matzmoto [EMAIL PROTECTED] wrote:
 Hi R users

 I like to generate some strings (a character vector) in a special way like

 If i have 5 variables

 002.001,
 003.001, 003.002,
 004.001, 004.002, 004.003,
 005.001, 005.002, 005.003, 005.004

 so the created string vector's elements are

 002.001, 003.001, 003.002,004.001, 004.002, 004.003,005.001,
 005.002, 005.003, 005.004

 I tried to come up with for loop with two indexes (i and j) but I kept
 failing to generate that kind of order of strings. The order of the element
 in the character vector is very improtant.

 Any advice or help would be appreciated

 Thanks in advance

 TM,

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


Re: [R] How to generate pitch strings

2006-02-04 Thread Atte Tenkanen
 If I calculate a transition probability matrix, first order markov 12x12
 or second order 144x144 from musical pitch classes (0-11), is it possible
 to generate pitch class strings similar as those original strings using
 those probability matrix with R? If, how?

 Atte Tenkanen, Turku, Finland


I found this kind of solution:

j=1; a1=c();
Generated_Melody=c(1); #first note as a seed
a1=sample(1:12, size=1, prob=PT_matrix[j,]) # a seed for the loop following

for (i in 1:100){ # length of the generated melody will be 100
Generated_Melody=c(Generated_Melody,a1)
a1=sample(1:12, size=1, prob=PT_matrix[a1,])
}

# Generated_Melody=Generated_Melody-1;  # to picht classes
# Generated_Melody=Generated_Melody+59; # or to midi pitches


Atte Tenkanen

PS. Here is my page considering the course in which we use R for music
analysis...
http://musiikintutkimus.blogspot.com/

__
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] reading in a tricky computer program output

2006-02-04 Thread Taka Matzmoto
Hi R user

I need to read in some values from a computer program output.

I can't change the output format because the developer of the program 
doesn't allow to change the format of output.

There are two formats.

First one looks like this

if I have 10 variables,

--
   [ 1]  [2]   [3]  [4][5]
[ 1]  0.000
[ 2]  0.001 0.000
[ 3] -0.002 0.019 0.000
[ 4]  0.012-0.004-0.020 0.000
[ 5] -0.015 0.003 0.011 0.008 0.000
[ 6]  0.005-0.008-0.005 0.002 0.005
[ 7]  0.008-0.007 0.013 0.003 0.007
[ 8] -0.014-0.011-0.010-0.025 0.002
[ 9]  0.006 0.003-0.010 0.002-0.020
[10] 0.006 0.010-0.006 0.005 0.008
[ 6]  0.000
[ 7] -0.037 0.000
[ 8]  0.010 0.027 0.000
[ 9]  0.032-0.004 0.008 0.000
[10] -0.008-0.011 0.015-0.020 0.000


NOTE: I put [number] to show that this output is similar to a lower diagonal 
matrix including diagonal. In an ouput there is no [number]


The second format looks like this
--
   [1]  [2] [3]   [4]  [5]
[ 2] -0.002
[ 3]  0.003-0.053
[ 4] -0.026 0.010 0.045
[ 5]  0.023-0.008-0.025-0.016
[ 6] -0.012 0.023 0.013-0.005-0.011
[ 7] -0.031 0.031-0.054-0.013-0.027
[ 8]  0.040 0.042 0.031 0.075-0.007
[ 9] -0.012-0.009 0.023-0.005 0.037
[10] -0.013-0.027 0.014-0.013-0.020
[ 7]  0.127
[ 8] -0.035-0.166
[ 9] -0.083 0.015-0.027
[10]  0.021 0.047-0.052 0.048
-
NOTE: I put [number] to show that this output is similar to a lower diagonal 
matrix without diagonal. In an ouput there is no [number]

The problem of this format is the fixed column length ( 5 columns)

To make matter worse, the number of variables keep changing (10, 20, 30, 40, 
50, 60,70,80,90, and 100) so I need to take into the number of variables 
when I write a R function to read in these numbers.

If the number of variables is 80, the output is very long.

I only came up with this tedious one.

First I read in the output using scan() and then make it a numeric vector

I created 10 character vectors. Creating a 100 variable character vector is 
the most boring things

I have ever done.

one of the character vectors that matchs with the first 10 variable output 
is

first.10-c(
i.001.001,
i.002.001,i.002.002,
i.003.001,i.003.002,i.003.003,
i.004.001,i.004.002,i.004.003,i.004.004,
i.005.001,i.005.002,i.005.003,i.005.004,i.005.005,
i.006.001,i.006.002,i.006.003,i.006.004,i.006.005,
i.007.001,i.007.002,i.007.003,i.007.004,i.007.005,
i.008.001,i.008.002,i.008.003,i.008.004,i.008.005,
i.009.001,i.009.002,i.009.003,i.009.004,i.009.005,
i.010.001,i.010.002,i.010.003,i.010.004,i.010.005,
i.006.006,
i.007.006,i.007.007,
i.008.006,i.008.007,i.008.008,
i.009.006,i.009.007,i.009.008,i.009.009,
i.010.006,i.010.007,i.010.008,i.010.009,i.010.010
   )

one of the character vectors that matchs with the second 10 variable output 
is

second.10-c(
i.002.001,
i.003.001,i.003.002,
i.004.001,i.004.002,i.004.003,
i.005.001,i.005.002,i.005.003,i.005.004,
i.006.001,i.006.002,i.006.003,i.006.004,i.006.005,
i.007.001,i.007.002,i.007.003,i.007.004,i.007.005,
i.008.001,i.008.002,i.008.003,i.008.004,i.008.005,
i.009.001,i.009.002,i.009.003,i.009.004,i.009.005,
i.010.001,i.010.002,i.010.003,i.010.004,i.010.005,
i.007.006,
i.008.006,i.008.007,
i.009.006,i.009.007,i.009.008,
i.010.006,i.010.007,i.010.008,i.010.009
   )

and then assign the character vector to the numeric vector by

names-first.10
first.10 = numeric.vector
combined.one - cbind(names,first.10)
container - diag(10)
for (i in 1:(10*10))
{
k   - as.numeric(substr(combined.one[i,1],7,9))
l   - as.numeric(substr(combined.one [i,1],3,5))
val - as.numeric(combined.one [i,2])
container [k,l] - val
}