[R] Plot link points

2009-01-10 Thread Kitty Lee
Hi. This may be a straight-forward question...

I have a time series from 1950 to 2000 (by year) with missing values. 

Sometimes only a year has value and the adjacent years have missing data, e.g.

1950 2.7
1951 
1952
1953 3.4
1954
1955
1956 2.9
1957 3.6
1958 2.7


When I use plot (type='l'), the line can't connect the 'stand-alone' years. Is 
there a way I have have R to skip over the NA and draw a line with the points 
available?

Thanks!

k.

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


Re: [R] Plot link points

2009-01-10 Thread Jim Lemon

Kitty Lee wrote:

Hi. This may be a straight-forward question...

I have a time series from 1950 to 2000 (by year) with missing values. 


Sometimes only a year has value and the adjacent years have missing data, e.g.

1950 2.7
1951 
1952

1953 3.4
1954
1955
1956 2.9
1957 3.6
1958 2.7


When I use plot (type='l'), the line can't connect the 'stand-alone' years. Is 
there a way I have have R to skip over the NA and draw a line with the points 
available?

  

Hi Kitty,
Assuming that the above is a data frame with two columns, the second of 
which is named value:


plot(my.data.frame[!is.na(my.data.frame$value),],type=l)

Jim

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


[R] Clinical significance estimation

2009-01-10 Thread Jim Lemon

Hi all,
On a request from a colleague, I programmed an implementation of the 
clinical significance estimation suggested by Jacobson and Truax some 
years ago, with a few generalizations and a couple of plot functions. I 
have wrapped this up in a package, but I am reluctant to further clutter 
CRAN with a package containing one function with print and plot methods. 
If anyone out there would like to include this function in a suitable 
package, please let me know.


Jim

Jacobson, N.S.  Truax, P. (1991) Clinical significance: a statistical 
approach to defining meaningful change in psychotherapy research. 
Journal of Consulting and Clinical Psychology, 59(1): 12-19.


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


Re: [R] Plot link points

2009-01-10 Thread gledson picharski
try to use xyplot of latice package. If you have a data.frame called data,
whit coluns called year and x, you could do something like:

require(lattice)
xyplot(x~year,data,
   type = a,
   auto.key =
   list(space = right, points = FALSE, lines = TRUE))



___
Gledson Luiz Picharski
PET Estatística - UFPR
http://www.leg.ufpr.br/~gledson http://www.leg.ufpr.br/%7Egledson
http://www.leg.ufpr.br/pet




2009/1/10 Jim Lemon j...@bitwrit.com.au

 Kitty Lee wrote:

 Hi. This may be a straight-forward question...

 I have a time series from 1950 to 2000 (by year) with missing values.
 Sometimes only a year has value and the adjacent years have missing data,
 e.g.

 1950 2.7
 1951 1952
 1953 3.4
 1954
 1955
 1956 2.9
 1957 3.6
 1958 2.7


 When I use plot (type='l'), the line can't connect the 'stand-alone'
 years. Is there a way I have have R to skip over the NA and draw a line with
 the points available?



 Hi Kitty,
 Assuming that the above is a data frame with two columns, the second of
 which is named value:

 plot(my.data.frame[!is.na(my.data.frame$value),],type=l)

 Jim


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


[[alternative HTML version deleted]]

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


[R] Help needed for Loading tm package

2009-01-10 Thread Kum-Hoe Hwang
Howdy Gurus again

Thanks to  Tony.Breyal, I was able to writing the following script for
analyzing a text document.
But I got an error with tm' package. I don't why I got the error from the R
script below. I think I followed proccess of R tm manual.

I use R v2.8.1. and tm_0.3-3.zip under Win XP.

Thanks in advance,

Kum Hwang

 # setting directory
 my.path -'C:\\_work\\Daddys\\myProjects\\2009
defaultProject\\R\\textfile\\'

 # text miner pakacge
 library(tm)
Loading required package: Snowball
Loading required package: RWeka
-
Error in .jinit(system.file(jar, c(weka.jar, RWeka.jar), package =
pkgname,  :
  Cannot create Java virtual machine (-1)
Error : .onLoad failed in 'loadNamespace' for 'RWeka'
Error: package 'RWeka' could not be loaded
 my.corpurs -Corpus(DirSource(my.path), readerControl =
list(reader=readPlain))
Error: could not find function Corpus
 my.tdm - TermDocMatrix(my.corpus)
Error: could not find function TermDocMatrix
 my.tdm[1,]
Error: object my.tdm not found


-- 
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.com

[[alternative HTML version deleted]]

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


Re: [R] Help needed for Loading tm package

2009-01-10 Thread Prof Brian Ripley

On Sat, 10 Jan 2009, Kum-Hoe Hwang wrote:


Howdy Gurus again

Thanks to  Tony.Breyal, I was able to writing the following script for
analyzing a text document.
But I got an error with tm' package. I don't why I got the error from the R
script below. I think I followed proccess of R tm manual.


Please do read the messages you got.  I see


Error in .jinit(system.file(jar, c(weka.jar, RWeka.jar), package =
pkgname,  :
 Cannot create Java virtual machine (-1)


so the problem is with your Java installation and RWeka, not 'tm'.

First make sure you have a working installation of RWeka -- I suspect 
you do not even have Java installed, but it could be a version or path 
issue (but very unlikely to be an R issue).




I use R v2.8.1. and tm_0.3-3.zip under Win XP.

Thanks in advance,

Kum Hwang


# setting directory
my.path -'C:\\_work\\Daddys\\myProjects\\2009

defaultProject\\R\\textfile\\'


# text miner pakacge
library(tm)

Loading required package: Snowball
Loading required package: RWeka
-
Error in .jinit(system.file(jar, c(weka.jar, RWeka.jar), package =
pkgname,  :
 Cannot create Java virtual machine (-1)
Error : .onLoad failed in 'loadNamespace' for 'RWeka'
Error: package 'RWeka' could not be loaded

my.corpurs -Corpus(DirSource(my.path), readerControl =

list(reader=readPlain))
Error: could not find function Corpus

my.tdm - TermDocMatrix(my.corpus)

Error: could not find function TermDocMatrix

my.tdm[1,]

Error: object my.tdm not found


--
Kum-Hoe Hwang, Ph.D.

Phone : 82-31-250-3516
Email : phdhw...@gmail.com

[[alternative HTML version deleted]]

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rpart with interval censored data crashes R

2009-01-10 Thread David Winsemius

On a Leopard Mac with the Urbanek compiled 64 bit R, one sees this:

 library(rpart)
 library(survival)
Loading required package: splines
 fit-rpart(Surv(N,Y,type=interval2)~Salt+pH+Temp, data=myD)

 *** caught segfault ***
address 0x0, cause 'memory not mapped'

Traceback:
 1: .C(C_rpartexp2, as.integer(length(dtimes)),  
as.double(dtimes), as.double(.Machine$double.eps), keep =  
integer(length(dtimes)))

 2: (get(paste(rpart, method, sep = .)))(Y, offset, , wt)
 3: rpart(Surv(N, Y, type = interval2) ~ Salt + pH + Temp, data =  
myD)


Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Choosing 4 does save the workspace.
--
David Winsemius

On Jan 9, 2009, at 9:04 AM, Keith Jewell wrote:


Hi Everyone,

This example code results in R 'crashing'; that is the R application  
closes

with no warnings or error messages.
#---
myD - read.table(stdin(), header=TRUE, nrows=20)
Broth Salt   pH TempN  Y Growth
13109.0 2.92  10 90.0 NA0
26156.0 7.82  30  1.0  21
32172.0 7.34  10  7.0  81
4338   10.0 4.44  10 90.0 NA0
52404.0 7.33  10 20.0 211
6336   10.0 3.90  10 90.0 NA0
72797.0 6.73  10 90.0 NA0
8   10219.0 5.03  45  8.0  91
99747.0 4.01  45 90.0 NA0
10   2657.0 2.93  10 90.0 NA0
11   9344.0 5.28  45  0.1  11
12   6699.0 5.03  30 90.0 NA0
13   875   10.0 6.24  37  1.0  21
14   3852.0 5.84  20  1.0  21
15   5622.0 5.84  30  0.1  11
16   7180.5 5.54  37  0.1  11
17   8459.0 5.03  37  3.0  61
18   9132.0 5.84  45  0.1  11
19   5774.0 4.10  30 90.0 NA0
20200.5 7.44   8 24.0 271

library(rpart)
library(survival)
fit-rpart(Surv(N,Y,type=interval2)~Salt+pH+Temp, data=myD)
#-

Professor Ripley helpfully pointed out that the documentation does  
not say
that interval censoring is supported, and indeed this seems only to  
happen

with interval censored data.

?rpart indicates that the dependent variable may be a survival object.
Neither ?rpart nor An Introduction to Recursive Partitioning Using  
the
RPART Routines (Therneau et al 1997) suggest that the dependent  
variable

may contain interval censored data, but neither do they suggest it
shouldn't; i.e. as far as I'm aware (!) this restriction is not  
documented.


This post has three purposes:

1) Bring this behaviour - especially the crash in response to 'bad'  
data -

to the attention of the authors.

2) Seek an explanation of the restriction (if intentional). In my
simplicity, it seems that interval censored data should be easier to  
handle
than left or right censored - after all the information content is  
greater.


3) Seek guidance on how to work around the problem. I'm minded to  
replace
the interval censored data by the mid points of the intervals. Does  
anyone

have any comments on such an approach?

Any comments gratefully received.

Keith Jewell
==
Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = Patched
major = 2
minor = 8.1
year = 2009
month = 01
day = 07
svn rev = 47502
language = R
version.string = R version 2.8.1 Patched (2009-01-07 r47502)

Windows Server 2003 x64 (build 3790) Service Pack 2

Locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

Search Path:
.GlobalEnv, package:stats, package:graphics, package:grDevices,
package:utils, package:datasets, package:methods, Autoloads,  
package:base


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


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


[R] ATT Researchers and the New York Times

2009-01-10 Thread Alan Zaslavsky


I've submitted a posting to the NY Times blog mentioned by David Smith, 
specifically mentioning John, Rick and Allan.  (Now awaiting moderation.)

Of course there are many others deserving credit but far to numerous to
list so I didn't get started.

On Thu, Jan 8, 2009 at 5:58 PM, Robert Wilkins irishhac...@gmail.comwrote:

Is anyone in the leadership of the R-project going to contact the New
York Times and clarify that the article gave remarkably short shrift
to the people who designed the user interface for R, to a large extent
ATT researchers from an earlier generation? It would be the
appropriate thing to do.


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


Re: [R] The R Inferno

2009-01-10 Thread Tom Backer Johnsen
Extremely nice.  Tons of useful information presented in a very 
entertaining way.  Thanks!


Tom

Patrick Burns wrote:

The R Inferno is now on the Burns Statistics website at

http://www.burns-stat.com/pages/Tutor/R_inferno.pdf

Abstract: If you are using R and you think you're in hell,
this is a map for you.

Also, I've expanded the outline concerning R on the
Burns Statistics 'Links' page. Suggestions (off-list) for
additional items are encouraged.


Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of The R Inferno and A Guide for the Unwilling S User)

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

and provide commented, minimal, self-contained, reproducible code.



--
++
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185Fax : +47-5558-9879 |
| Email : bac...@psych.uib.noURL : http://www.galton.uib.no/ |
++

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


Re: [R] The R Inferno

2009-01-10 Thread Jason Morgan
Excellent read, Patrick. A very useful and clear guide.

On 2009.01.09 16:14:49, Patrick Burns wrote:
 The R Inferno is now on the Burns Statistics website at
 
 http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
 
 Abstract: If you are using R and you think you're in hell,
 this is a map for you.
 
 Also, I've expanded the outline concerning R on the
 Burns Statistics 'Links' page. Suggestions (off-list) for
 additional items are encouraged.
 
 
 Patrick Burns
 patr...@burns-stat.com
 +44 (0)20 8525 0696
 http://www.burns-stat.com
 (home of The R Inferno and A Guide for the Unwilling S User)
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
~ Jason Morgan

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


Re: [R] Ashlee Vance's article on R in the New York Times

2009-01-10 Thread Stavros Macrakis
On Thu, Jan 8, 2009 at 1:26 AM, Robert Wilkins irishhac...@gmail.comwrote:

 ...The user interface for R, otherwise known as the S programming language
 has the same origins as C and Unix


We could take this one step further, and note that C's design (its user
interface?) was based on BCPL, which was developed at Cambridge University
and MIT (which was in turn loosely based on CPL).  But BCPL declined into
obscurity, while we're still stuck witxxx benefitting from C.

As for Unix, most of its ideas came from Multics (developed mostly at MIT,
but with Bell Labs and GE). And some of the core ideas and utilities of
Multics came from CTSS (also MIT) -- Unix roff/nroff/troff was a knock-off
of CTSS's runoff, for example.  But Multics failed and Unix succeeded.

Fast forward a few years, and Unix itself was (alas) fading into marginality
until GNU/Linux* came around. (I had a front-row seat at this decline as a
staffer at OSF.) As with R/S, the specification was of course important, but
the dynamics were completely changed by the development of a free and open
version.  The NYT reporter correctly focussed on the success of R.

I do agree that the core of R could use renewal and rethinking, and that
many free/open projects have been reimplementations of existing designs. But
there is also innovation within the framework of R, such as Hadley Wickham's
ggplot2.

Is it enough?  It never is

-s

* Speaking of giving credit where credit is due, Stallman is absolutely
right when he insists on recognition for the huge contribution of the GNU
project to GNU/Linux, though it's no doubt to late to insist on the full
name

[[alternative HTML version deleted]]

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


[R] Print specific matrix value???

2009-01-10 Thread Nidhi Kohli
Hello All,

I'm trying to print specific row and column for Observed_Scores matrix, 
however, when I execute the command Observed_Scores[1,1], I get the message 
Error in Observed_Scores[1, 1] : incorrect number of dimensions. Could you 
please help and let me know where is the mistake? Here is my program:


library(ltm)
library(psych)

# Settting the working directory path to C:/NCME

path=C:/NCME
setwd(path)

#IRT Data Simulation Routine#

n.exams = 500   #Sets number of examinees to be generated#
n.items = 20 #Sets number of items to be generated#

#The following intialize empty (NA) vectors or matrices#
beta.values = rep(NA,n.items)
resp.prob = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)
Observed_Scores = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)


#filling item parameters into beta.values
beta.values = runif(n.items,-2,2)

#Calculating Threshold
thresh.values = .5 * beta.values


#for (i in 1:10)
#{

#Using the function to generate the data
GenData - congeneric.sim(N=500, loads = rep(.5,20), err=NULL, short = FALSE)
Observed_Scores = GenData[1]

Regards
Nidhi Kohli

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


[R] Fitting pareto to some data

2009-01-10 Thread Borja Soto Varela
Dear R-users,

I am trying to fit pareto distribution to some data but i've one problem.
Using optim to calculate the maximum of the likelihood function of the
pareto I use as start parameters the moments method(using the distribution
function in the package actuar):

media=mean(x)
var=mean(x^2)-media^2
scale=2*var/(var-media^2)
shape=(scale-1)*media

fitdistr(x,dpareto,list(shape=shape,scale=scale))

The problem is how to initialize the shape and scale parameters when
var=media^2 . When var=media^2 scale and shape parameters are negative
using moments method.
Does anyone know how to initialize the paramaters when var=media^2?

Thanks
Borja

[[alternative HTML version deleted]]

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


[R] Print specific matrix value???

2009-01-10 Thread Nidhi Kohli
Hello All,

I'm trying to print specific row and column for Observed_Scores matrix, 
however, when I execute the command Observed_Scores[1,1], I get the message 
Error in Observed_Scores[1, 1] : incorrect number of dimensions. Could you 
please help and let me know where is the mistake? Here is my program:


library(ltm)
library(psych)

# Settting the working directory path to C:/NCME

path=C:/NCME
setwd(path)

#IRT Data Simulation Routine#

n.exams = 500   #Sets number of examinees to be generated#
n.items = 20 #Sets number of items to be generated#

#The following intialize empty (NA) vectors or matrices#
beta.values = rep(NA,n.items)
resp.prob = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)
Observed_Scores = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)


#filling item parameters into beta.values
beta.values = runif(n.items,-2,2)

#Calculating Threshold
thresh.values = .5 * beta.values


#for (i in 1:10)
#{

#Using the function to generate the data
GenData - congeneric.sim(N=500, loads = rep(.5,20), err=NULL, short = FALSE)
Observed_Scores = GenData[1]

Regards
Nidhi Kohli

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


Re: [R] The R Inferno

2009-01-10 Thread Ajay ohri
Hi ,
I have been trying to convince Pat to come up with a book on this.

He can add in the chapters on *Purgatorio*
(Purgatoryhttp://en.wikipedia.org/wiki/Purgatory),
and *Paradiso* (Paradise http://en.wikipedia.org/wiki/Heaven)


Regards,

Ajay

On Sat, Jan 10, 2009 at 9:33 PM, Jason Morgan jwm-r-h...@skepsi.net wrote:

 Excellent read, Patrick. A very useful and clear guide.

 On 2009.01.09 16:14:49, Patrick Burns wrote:
  The R Inferno is now on the Burns Statistics website at
 
  http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
 
  Abstract: If you are using R and you think you're in hell,
  this is a map for you.
 
  Also, I've expanded the outline concerning R on the
  Burns Statistics 'Links' page. Suggestions (off-list) for
  additional items are encouraged.
 
 
  Patrick Burns
  patr...@burns-stat.com
  +44 (0)20 8525 0696
  http://www.burns-stat.com
  (home of The R Inferno and A Guide for the Unwilling S User)
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 --
 ~ Jason Morgan

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


[[alternative HTML version deleted]]

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


Re: [R] Plot link points

2009-01-10 Thread Roy Mendelssohn

Look at:

http://geography.uoregon.edu/geogr/topics/maps.htm

-Roy

On Jan 10, 2009, at 1:48 AM, Jim Lemon wrote:


Kitty Lee wrote:

Hi. This may be a straight-forward question...

I have a time series from 1950 to 2000 (by year) with missing values.
Sometimes only a year has value and the adjacent years have missing  
data, e.g.


1950 2.7
1951 1952
1953 3.4
1954
1955
1956 2.9
1957 3.6
1958 2.7


When I use plot (type='l'), the line can't connect the 'stand- 
alone' years. Is there a way I have have R to skip over the NA and  
draw a line with the points available?




Hi Kitty,
Assuming that the above is a data frame with two columns, the second  
of which is named value:


plot(my.data.frame[!is.na(my.data.frame$value),],type=l)

Jim

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


**
The contents of this message do not reflect any position of the U.S.  
Government or NOAA.

**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097

e-mail: roy.mendelss...@noaa.gov (Note new e-mail address)
voice: (831)-648-9029
fax: (831)-648-8440
www: http://www.pfeg.noaa.gov/

Old age and treachery will overcome youth and skill.
From those who have been given much, much will be expected

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


Re: [R] Print specific matrix value???

2009-01-10 Thread Stephan Kolassa

Hi Nidhi,

in your very last line, you set
Observed_Scores = GenData[1]

After that, Observed_Scores is not a matrix any more, but a list with a 
single entry Observed_Scores$model, which is in fact a data.frame, but 
with different dimensions than you initially set Observed_Scores to.


HTH,
Stephan


Nidhi Kohli schrieb:

Hello All,

I'm trying to print specific row and column for Observed_Scores matrix, however, when I execute the 
command Observed_Scores[1,1], I get the message Error in Observed_Scores[1, 1] : 
incorrect number of dimensions. Could you please help and let me know where is the mistake? 
Here is my program:


library(ltm)
library(psych)

# Settting the working directory path to C:/NCME

path=C:/NCME
setwd(path)

#IRT Data Simulation Routine#

n.exams = 500   #Sets number of examinees to be generated#
n.items = 20 #Sets number of items to be generated#

#The following intialize empty (NA) vectors or matrices#
beta.values = rep(NA,n.items)
resp.prob = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)
Observed_Scores = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)


#filling item parameters into beta.values
beta.values = runif(n.items,-2,2)

#Calculating Threshold
thresh.values = .5 * beta.values


#for (i in 1:10)
#{

#Using the function to generate the data
GenData - congeneric.sim(N=500, loads = rep(.5,20), err=NULL, short = FALSE)
Observed_Scores = GenData[1]

Regards
Nidhi Kohli

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



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


Re: [R] Fw: Re: R Stacked Histogram

2009-01-10 Thread hadley wickham
Hi Jason,

You can do:

qplot(mpg, wt, data = mtcars, colour = factor(cyl)) +
opts(legend.position = c(0.5, 0.5))

Hadley

On Thu, Jan 8, 2009 at 3:04 PM, Jason Rupert jasonkrup...@yahoo.com wrote:
 Thank you again for your response.

 This worked great.

 Quick question about the legend for qplot.  Instead of being outside the
 plot, is it possible to move the location of the legend to the upper left or
 right corner of the plot?  Could you possibly provide an example.

 Thank you again for your feedback and insights.

 --- On Wed, 1/7/09, hadley wickham h.wick...@gmail.com wrote:

 From: hadley wickham h.wick...@gmail.com
 Subject: Re: Fw: Re: [R] R Stacked Histogram
 To: jasonkrup...@yahoo.com, R-help R-help@r-project.org
 Date: Wednesday, January 7, 2009, 12:17 PM

 Hi Jason,

 Well, one last questions about stack plot (please forgive the lame example
 below).  I thought the below allow me to resize the the title
 of the
 stacked histogram, but no luck.  Any suggestions as to the modificaiton
 necessary to get it to work?  Right now the title is obscured by the plot
 and my boss will be none too happy.  Thanks again.

 Yes, that's a really stupid bug that I accidentally introduced in the
 latest version.  You can fix it with:

 qplot(mpg, wt, data = mtcars, main = My title) + opts(plot.title =
 theme_text(vjust = 0, size = 16))

 or by adding a new line to the end of the title:

 qplot(mpg, wt, data = mtcars, main = My title\n)

 Regards,

 Hadley
 --
 http://had.co.nz/





-- 
http://had.co.nz/

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


Re: [R] R in the NY Times

2009-01-10 Thread Tony Breyal
“We have customers who build engines for aircraft. I am happy they are
not using freeware when I get on a jet.”

The lady who made this comment, Anne H. Milley, director of technology
product marketing at SAS, has written a response to try and clarify
what she meant (funilly enough, i got this link from a SAS mate of
mine who is now going to have a look into R for the first time):

http://blogs.sas.com/sascom/index.php?/archives/434-This-post-is-rated-R.html


[quote]
As for open source and my airplane quote …

My remark reflects a key difference between R and SAS, that of
support, reliability, and validation. Customers value SAS for many
things, including our extensive testing, documentation, 24/7 support,
and training. In contrast, the quality of proliferating R packages is
varied and uneven, especially in complex analytical modules. Mistakes
in these packages can lead to misleading results, even for experienced
users.

The airplane comment was meant to point out this key difference. Not
to condemn open source. In fact, SAS values open-source software. Our
software runs on Linux. We use some open-source tools in development.
And we plan to embrace open source further in the future.

The world has many complex problems. We advocate approaches based on
science, on analysis to address these problems. Making more analytic
methods readily available is a good thing. From SAS; from R; from the
resourceful individuals who innovate with their tools of choice,
regardless of the source.
[end quote]



On 7 Jan, 14:50, Marc Schwartz marc_schwa...@comcast.net wrote:
 on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:



  Zaslavsky, Alan M. wrote:
  This article is accompanied by nice pictures of Robert and Ross.

  Data Analysts Captivated by Power of R
 http://www.nytimes.com/2009/01/07/technology/business-computing/07pro...

  January 7, 2009 Data Analysts Captivated by R’s Power By ASHLEE VANCE

  SAS says it has noticed R’s rising popularity at universities,
  despite educational discounts on its own software, but it dismisses
  the technology as being of interest to a limited set of people
  working on very hard tasks.

  “I think it addresses a niche market for high-end data analysts that
  want free, readily available code, said Anne H. Milley, director of
  technology product marketing at SAS. She adds, “We have customers who
  build engines for aircraft. I am happy they are not using freeware
  when I get on a jet.”

  Thanks for posting.  Does anyone else find the statement by SAS to be
  humourous yet arrogant and short-sighted?

  Kevin

 It is an ignorant comment by a marketing person who has been spoon fed
 her lines...it is also a comment being made from a very defensive and
 insecure posture.

 Congrats to R Core and the R Community. This is yet another sign of R's
 growth and maturity.

 Regards,

 Marc Schwartz

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

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


[R] R version requires Bioconductor 2.3 version

2009-01-10 Thread Andreas Scherer

Dear support,

I am new to R. I installed R 2.8.1 under Windows, and upon starting it I 
get the message that it requires Bioconductor version 2.3.
I thought this was kind of installed in parallel or so. Where can I 
upgrade it ?


Best regards,
Andreas

--
Andreas Scherer, PhD,APM
CEO
Spheromics
Pajutie 3A
81100 Kontiolahti
Finland

Phone   +358 (0)400 138 510
FAX +358 (0)13 731 431
Skype   Andreas1.Scherer

www.Spheromics.com

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


[R] Arguments for Rcmd BATCH

2009-01-10 Thread Andrew Hicks
Sorry to bother you and I hope this will be easy to solve.

 

I am trying to run R scripts in batch, called from another programme, under
Windows XP. I have R 2.4.1

 

I need to be able to pass a list of numeric arguments to the script as well.

 

The Rscript and its input data file are attached.

 

I have been trying the syntax below but it doesn't work:

 

Rcmd BATCH -no-save -no-restore -args parms=c(1,2,3) test01b.R

 

(each of these BATCH options is preceded by 2 - characters, but my Outlook
is munging them together here)

 

The script then accesses (or tries to) the variables as parms[1], parms[2],
etc.

 

I get the respose unable to open input file at the command line and no
other diagnostic output.

 

I got this syntax from p85 of the R-Intro doc and from the website
http://quantitative-ecology.blogspot.com/search/label/scripts. I could not
find any other illustrations or instructions of how to use args with BATCH.

 

Without using any parameter args it otherwise runs fine.

 

Please can you advise what am I doing wrong and how should this command be
structured? Do I also need to change the way the script is accessing the
arguments?

 

Many thanks,

 

Andrew Hicks

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


[R] Applying 'lm' in each group

2009-01-10 Thread Bhargab Chattopadhyay
Hi,


 I want to do regression in each group. I made the group the following way. Now 
I want to run regression in each of the three groups..
Suppose , 
x-c(0.5578196,6.5411662,13.2728619,2.0217271,6.7216176,3.37220617,2.5773252,7.2600583,15.3731026,3.4140288,8.1335874,
    
15..6476637,4.3014084,9.1224379,18.5605355,4.7448394,11.9296663,18.5866354,12.3797674,18.7572812,2.70433816,2.88924220,
    2.94688208,3.37154364,2.26311786,3.31002593)
  
y-c(18.63654,233.55387,152.61107,103.49646,234.55054,14.2767453,160.78742,150.35391,223.89225,168.55567,190.51031,
    227.68339,152.42658,208.70115, 223.91982, 221.70702, 213.71135,168.0199, 
222.69040,228.49353, 164.95750,243.18828,
    229.94688,313.37154364,202.263786,139.31002593)

n-length(x)
m-3;
r-8;
c-r*(m-1);
g1-rep(1:(m-1),each=r);    
g-c(g1,rep(m,n-c))
xg-split(x,g);
yg-split(y,g);

Now if I write lm(yg~xg) then it won't work. Please advice how to proceed.

Thanks in advance.

Bhargab



  
[[alternative HTML version deleted]]

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


[R] Calling C from FORTRAN and vice versa

2009-01-10 Thread Michael Höhle
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dear R-Help,

as I am not sure where to put this suggestion for improving the
documentation in Writing R extensions Section 6.6 (Calling C from
FORTRAN and vice versa) I send it to R-Help as suggested by the R Bug
Report page.

In Sect 6.6 an example is given on how to create .f and .c file in order
to call C from Fortran and vice versa. For better readability and for
preventing ppl calling the .c and the .f file the same base name
(causing multiple definitions of symbol) I suggest that the docu
should provide file names for the two example programs, e.g.:

frand.f:

  subroutine testit()
  double precision normrnd, x
  call rndstart()
  x = normrnd()
  call dblepr(X was, 5, x, 1)
  call rndend()
  end

frand-helper.c:

#include R.h

/* Fortran */
void F77_SUB(rndstart)(void) { GetRNGstate(); }
void F77_SUB(rndend)(void) { PutRNGstate(); }
double F77_SUB(normrnd)(void) { return norm_rand(); }

As a further suggestion, it would also be nice to provide the call for
generating the dynamic library at this point:
R CMD SHLIB frand.f frand-helper.c .

At least this would have helped me in trying to get things to work, but
again - its just a suggestion.

Best regards,

Michael


- --

Michael Höhle, Ph.D.
Department of Statistics
University of Munich
Ludwigstrasse 33
80539 Munich
Germany

Phone:+49 89 2180 6404
Fax:  +49 89 2180 5040

Email: hoe...@stat.uni-muenchen.de
Homepage: http://www.stat.uni-muenchen.de/~hoehle
PGP public key id: 0xA9589121
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJaLoYJenxFqlYkSERAgMeAKCtuX+SByQR4Eo1/xJj8Pg073jM8ACfa56t
7xnDhLzuS4q75ownnESyqek=
=yYKr
-END PGP SIGNATURE-

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


[R] JGR editor setting problem

2009-01-10 Thread tedzzx

Hi all,

I am using the JGR (Java GUI for R ) and I am facing some problem.
I want to use the help agent in the editor. I try to change the setting in
the
preference to use the help agent in editor, but it does not work. Though I
have
apply and save this seting ,it will return to the default seting that only
use
the help agent in the console. Will you help me? Thanks

R version: 2.7.2
JGR:1.6-2


Ted

-- 
View this message in context: 
http://www.nabble.com/JGR-editor-setting-problem-tp21389631p21389631.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Arguments for Rcmd BATCH

2009-01-10 Thread Prof Brian Ripley
Your R is far too old, and in particular too old for the example you 
are trying.


Please do you as asked in the posting guide to do before posting, and 
upgrade.  Then you will have Rscript, as described in the current 'An 
Introduction to R' manual for this purpose (with examples).


On Sat, 10 Jan 2009, Andrew Hicks wrote:


Sorry to bother you and I hope this will be easy to solve.


I am trying to run R scripts in batch, called from another programme, under
Windows XP. I have R 2.4.1



I need to be able to pass a list of numeric arguments to the script as well.



The Rscript and its input data file are attached.



I have been trying the syntax below but it doesn't work:



Rcmd BATCH -no-save -no-restore -args parms=c(1,2,3) test01b.R



(each of these BATCH options is preceded by 2 - characters, but my Outlook
is munging them together here)



The script then accesses (or tries to) the variables as parms[1], parms[2],
etc.



I get the respose unable to open input file at the command line and no
other diagnostic output.



I got this syntax from p85 of the R-Intro doc and from the website
http://quantitative-ecology.blogspot.com/search/label/scripts. I could not
find any other illustrations or instructions of how to use args with BATCH.



Without using any parameter args it otherwise runs fine.



Please can you advise what am I doing wrong and how should this command be
structured? Do I also need to change the way the script is accessing the
arguments?



Many thanks,



Andrew Hicks




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Setting a contingency table

2009-01-10 Thread Bhargab Chattopadhyay
Hi,

I want to set a make a contingency table which will look like this.. The 
problem is that I can't  set the table like the following. 


 col1 col2   Total
    row1  a b n10
 rp1   rp2    100
 cp1   cp2   rtp1
  -
    row2 c d n20
 rp3   rp4   100
 cp3   cp4   rtp2
  -
    Total    n01   n02 n
 ctp1  ctp2   100
 100   100    100


Suppose 

a-67; b-10; c-79; d-67;
n-a+b+c+d;
  n10-a+b;
  n01-a+c;
  n20-n-n10;
  n02-n-n01;
  rp1-(a/n10)*100;
  rp2-100-rp1;
  rp3-(c/n20)*100;
  rp4-100-rp3;
  cp1-(a/n01)*100;
  cp2-100-cp1;
  cp3-(c/n02)*100;
  cp4-100-cp3;
  rtp1-(n10/n)*100;
  rtp2-100-rtp1;
  ctp1-(n01/n)*100;
  ctp2-100-ctp1;

After this I can't procced in a meaningful way. Can anyone help me out?
Thanks in advance.

Bhargab


  
[[alternative HTML version deleted]]

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


Re: [R] R in the NY Times

2009-01-10 Thread Florian Lengyel
On Sat, Jan 10, 2009 at 8:11 AM, Tony Breyal tony.bre...@googlemail.com wrote:
 We have customers who build engines for aircraft. I am happy they are
 not using freeware when I get on a jet.

 The lady who made this comment, Anne H. Milley, director of technology
 product marketing at SAS, has written a response to try and clarify
 what she meant (funilly enough, i got this link from a SAS mate of
 mine who is now going to have a look into R for the first time):

 http://blogs.sas.com/sascom/index.php?/archives/434-This-post-is-rated-R.html


 [quote]
 As for open source and my airplane quote …

 My remark reflects a key difference between R and SAS, that of
 support, reliability, and validation. Customers value SAS for many
 things, including our extensive testing, documentation, 24/7 support,
 and training. In contrast, the quality of proliferating R packages is
 varied and uneven, especially in complex analytical modules. Mistakes
 in these packages can lead to misleading results, even for experienced
 users.

 The airplane comment was meant to point out this key difference. Not
 to condemn open source. In fact, SAS values open-source software. Our
 software runs on Linux. We use some open-source tools in development.
 And we plan to embrace open source further in the future.

 The world has many complex problems. We advocate approaches based on
 science, on analysis to address these problems. Making more analytic
 methods readily available is a good thing. From SAS; from R; from the
 resourceful individuals who innovate with their tools of choice,
 regardless of the source.
 [end quote]



Ms. Milley mischaracterizes her remark about the relative
unreliability of freeware
as if she had employed the termopen source.

David A. Wheeler's Why Open Source Software / Free Software (OSS/FS,
FLOSS, or FOSS)? Look at the Numbers! provides quantitative measures
for evaluating open source software, including
market share, reliability, performance, scalability, security, and
total cost of ownership. With respect to
the reliability of open source software, Wheeler writes, There are a
lot of anecdotal stories that OSS/FS is more reliable, but finally
there is quantitative data confirming that mature OSS/FS programs are
often more reliable [than equivalent proprietary software programs].
Wheeler lists among his sources the Fuzz Report
http://pages.cs.wisc.edu/~bart/fuzz/fuzz.html .

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


Re: [R] R in the NY Times

2009-01-10 Thread Barry Rowlingson
2009/1/10 Tony Breyal tony.bre...@googlemail.com:

 [SAS marketroid quote]
 In fact, SAS values open-source software.

 But clearly not enough to open-source SAS itself. It would seem that
SAS values _other_people's_ open source.

 If SAS was open source and free, then SAS would collect on all the
other things Customers value SAS for - support, testing, training,
docs, etc etc. And there would be a lot more people using it.

 Another quote: We advocate approaches based on science - closed
source is closed knowledge and is nearer alchemy than science. I may
use proprietary software for video editing or music production, but
when it comes to science, it's got to be open.

Barru

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


Re: [R] R in the NY Times

2009-01-10 Thread Ajay ohri
more on the reasons R is bad for you
http://www.decisionstats.com/2009/01/top-ten-rrreasons-r-is-bad-for-you/


On Sun, Jan 11, 2009 at 12:01 AM, Barry Rowlingson 
b.rowling...@lancaster.ac.uk wrote:

 2009/1/10 Tony Breyal tony.bre...@googlemail.com:

  [SAS marketroid quote]
  In fact, SAS values open-source software.

  But clearly not enough to open-source SAS itself. It would seem that
 SAS values _other_people's_ open source.

  If SAS was open source and free, then SAS would collect on all the
 other things Customers value SAS for - support, testing, training,
 docs, etc etc. And there would be a lot more people using it.

  Another quote: We advocate approaches based on science - closed
 source is closed knowledge and is nearer alchemy than science. I may
 use proprietary software for video editing or music production, but
 when it comes to science, it's got to be open.

 Barru

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


[[alternative HTML version deleted]]

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


Re: [R] R version requires Bioconductor 2.3 version

2009-01-10 Thread Uwe Ligges



Andreas Scherer wrote:

Dear support,


This is not support, but the R-help mailing list.
Please do read docuemntation on how to upgrade R and contributed 
packages such as those from the Bioconductor project.



I am new to R. I installed R 2.8.1 under Windows, and upon starting it I 
get the message that it requires Bioconductor version 2.3.


So you installed by overwriting some older version?
Anyway, for the Bioconductor project, see
http://www.Bioconductor.org
which has its own mailing list.

You can choose the BioC Repositories from your R GUI and run, for example,

update.packages(checkBuilt=TRUE)

afterwards, which will upgrade your outdated CRAN and BioC packages.

Uwe Ligges



I thought this was kind of installed in parallel or so. Where can I 
upgrade it ?


Best regards,
Andreas



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


Re: [R] Print specific matrix value???

2009-01-10 Thread Uwe Ligges



Nidhi Kohli wrote:

Hello All,

I'm trying to print specific row and column for Observed_Scores matrix, however, when I execute the 
command Observed_Scores[1,1], I get the message Error in Observed_Scores[1, 1] : 
incorrect number of dimensions. Could you please help and let me know where is the mistake? 
Here is my program:


library(ltm)
library(psych)

# Settting the working directory path to C:/NCME

path=C:/NCME
setwd(path)

#IRT Data Simulation Routine#

n.exams = 500   #Sets number of examinees to be generated#
n.items = 20 #Sets number of items to be generated#

#The following intialize empty (NA) vectors or matrices#
beta.values = rep(NA,n.items)
resp.prob = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)
Observed_Scores = matrix(rep(NA,n.exams*n.items),nrow=n.exams,ncol=n.items)


#filling item parameters into beta.values
beta.values = runif(n.items,-2,2)

#Calculating Threshold
thresh.values = .5 * beta.values


#for (i in 1:10)
#{

#Using the function to generate the data
GenData - congeneric.sim(N=500, loads = rep(.5,20), err=NULL, short = FALSE)
Observed_Scores = GenData[1]





Say

  str(Observed_Scores)

and find that Observed_Scores is not a matrix but a list!
If you want to extract the matrix (first element of GenData), then use
  Observed_Scores = GenData[[1]]

Uwe Ligges




Regards
Nidhi Kohli

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


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


Re: [R] bug in R2WinBUGS

2009-01-10 Thread Uwe Ligges



John Smith wrote:

In newest version of R2WinBUGS, the default directory is changed to
working.directory, but never changed back once finished bugs call.



Thank you for the report!
I will see what happened and release a fixed version tomorrow.

Best wishes,
Uwe





[[alternative HTML version deleted]]

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


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


Re: [R] R in the NY Times

2009-01-10 Thread Bert Gunter

I think the substance of the issue is that the more eyes on code, the fewer
the bugs (assuming a well-designed examination and debugging process is in
place, as is typical for large open source projects like R). By this
(obvious?)criterion, both the remarks about the dangers of proprietary code
and the greater unreliability of R's lesser-used specialty packages, which
by their nature tend to be less carefully perused, are valid.

Perhaps an argument is that certain code might not get written at all if it
were not proprietary. Device drivers might be an example. But possibly other
than that, it does seem like SAS needs to reconsider their marketing
strategy and advertising claims.

Anecdotal remark: I orginally moved from S-Plus to R because R provided
**better** documentation, support, and had fewer bugs, which were more
rapidly fixed when found. One of my smarter investment choices.

Cheers to all,
Bert Gunter

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Barry Rowlingson
Sent: Saturday, January 10, 2009 10:32 AM
To: Tony Breyal
Cc: r-help@r-project.org
Subject: Re: [R] R in the NY Times

2009/1/10 Tony Breyal tony.bre...@googlemail.com:

 [SAS marketroid quote]
 In fact, SAS values open-source software.

 But clearly not enough to open-source SAS itself. It would seem that
SAS values _other_people's_ open source.

 If SAS was open source and free, then SAS would collect on all the
other things Customers value SAS for - support, testing, training,
docs, etc etc. And there would be a lot more people using it.

 Another quote: We advocate approaches based on science - closed
source is closed knowledge and is nearer alchemy than science. I may
use proprietary software for video editing or music production, but
when it comes to science, it's got to be open.

Barru

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

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


Re: [R] Applying 'lm' in each group

2009-01-10 Thread Ben Bolker
Bhargab Chattopadhyay bhargab_1 at yahoo.com writes:

 
 Hi,
 
  I want to do regression in each group. I made the group the following way.
Now I want to run regression
 in each of the three groups..
 Suppose , 
 w
 
 Now if I write lm(yg~xg) then it won't work. Please advice how to proceed.
 
 Thanks in advance.
 

 The one-liner is


mapply(function(x,y) lm(y~x,data=data.frame(x,y)),xg,yg,
   SIMPLIFY=FALSE)

Perhaps easier to understand:

results - list()
for (i in seq(along=xg)) {
  results[[i]] - lm(yg[[i]]~xg[[i]])
}

  Ben Bolker

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


Re: [R] Applying 'lm' in each group

2009-01-10 Thread David Winsemius
Did you read the error message? Generally saying doesn't work will  
elicit undesirable responses.


Now would be a good time to read the Posting Guide:

http://www.R-project.org/posting-guide.html

Including:
Say exactly what happened, including any error messages you received. 

 lm(yg~xg)
Error in model.frame.default(formula = yg ~ xg, drop.unused.levels =  
TRUE) :

  invalid type (list) for variable 'yg'

You need to offer lm an object that it can use. You actually shot  
yourself in the foot by turning your data into a list. It's not clear  
what you actually want, but perhaps this will move you a bit further  
along:


 dfg - data.frame(y=unlist(yg), x=unlist(xg), g=g)
 lm(y ~ x | g, data= dfg)

Which would also be the same result as the following (without the  
detour to the yg and xg lists.)


lm(y ~ x + g)

It's also possible that what you really wanted was:

lm(y ~ x + as.factor(g)) # which estimates mean differences of grp=2  
and grp=3 from grp=1 with a common estimated slope of y on x.


Or even lm(y ~ x * as.factor(g)) which gives you separate slopes and  
mean differences from those estimated for group 1 for groups 2 and 3  
and is most consistent with the phrase separate regressions in each  
of three groups.


--
David Winsemius
Heritage Laboratories

On Jan 10, 2009, at 12:55 PM, Bhargab Chattopadhyay wrote:


Hi,


 I want to do regression in each group. I made the group the  
following way. Now I want to run regression in each of the three  
groups..

Suppose ,
x- 
c 
(0.5578196,6.5411662,13.2728619,2.0217271,6.7216176,3.37220617,2.5773252,7.2600583,15.3731026,3.4140288,8.1335874 
,
 
15 
.. 
6476637,4.3014084,9.1224379,18.5605355,4.7448394,11.9296663,18.5866354,12.3797674,18.7572812,2.70433816,2.88924220 
,

2.94688208,3.37154364,2.26311786,3.31002593)

y- 
c 
(18.63654,233.55387,152.61107,103.49646,234.55054,14.2767453,160.78742,150.35391,223.89225,168.55567,190.51031 
,
227.68339,152.42658,208.70115, 223.91982, 221.70702,  
213.71135,168.0199, 222.69040,228.49353, 164.95750,243.18828,

229.94688,313.37154364,202.263786,139.31002593)

n-length(x)
m-3;
r-8;
c-r*(m-1);
g1-rep(1:(m-1),each=r);
g-c(g1,rep(m,n-c))
xg-split(x,g);
yg-split(y,g);

Now if I write lm(yg~xg) then it won't work. Please advice how to  
proceed.


Thanks in advance.

Bhargab




[[alternative HTML version deleted]]

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


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


Re: [R] Applying 'lm' in each group

2009-01-10 Thread Chuck Cleland
On 1/10/2009 12:55 PM, Bhargab Chattopadhyay wrote:
 Hi,
 
 
  I want to do regression in each group. I made the group the following way. 
 Now I want to run regression in each of the three groups..
 Suppose , 
 x-c(0.5578196,6.5411662,13.2728619,2.0217271,6.7216176,3.37220617,2.5773252,7.2600583,15.3731026,3.4140288,8.1335874,
 
 15..6476637,4.3014084,9.1224379,18.5605355,4.7448394,11.9296663,18.5866354,12.3797674,18.7572812,2.70433816,2.88924220,
 2.94688208,3.37154364,2.26311786,3.31002593)
   
 y-c(18.63654,233.55387,152.61107,103.49646,234.55054,14.2767453,160.78742,150.35391,223.89225,168.55567,190.51031,
 227.68339,152.42658,208.70115, 223.91982, 221.70702, 213.71135,168.0199, 
 222.69040,228.49353, 164.95750,243.18828,
 229.94688,313.37154364,202.263786,139.31002593)
 
 n-length(x)
 m-3;
 r-8;
 c-r*(m-1);
 g1-rep(1:(m-1),each=r);
 g-c(g1,rep(m,n-c))
 xg-split(x,g);
 yg-split(y,g);
 
 Now if I write lm(yg~xg) then it won't work. Please advice how to proceed.

mdf - data.frame(y,x,g)

lapply(split(mdf, g), function(X){lm(y ~ x, data = X)})
$`1`

Call:
lm(formula = y ~ x, data = X)

Coefficients:
(Intercept)x
  76.1110.85


$`2`

Call:
lm(formula = y ~ x, data = X)

Coefficients:
(Intercept)x
166.6933.580


$`3`

Call:
lm(formula = y ~ x, data = X)

Coefficients:
(Intercept)x
218.412   -0.735

 Thanks in advance.
 
 Bhargab
 
 
 
   
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


Re: [R] R in the NY Times

2009-01-10 Thread Kingsford Jones
The reactions to the NYT article have certainly made for some
interesting reading.

Here are some of the links:

http://overdetermined.net/site/content/new-york-times-article-r

http://jackman.stanford.edu/blog/?p=1053

http://ggorjan.blogspot.com/2009/01/new-york-times-on-r.html

several posts on Andrew Gelman's blog:
http://www.stat.columbia.edu/~gelman/blog/

http://www.reddit.com/r/programming/comments/7nwgq/the_new_york_times_notices_the_r_programming/

comments here: http://bits.blogs.nytimes.com/2009/01/08/r-you-ready-for-r/


It's too bad that SAS has reacted to the negative reactions to their
NYT quote with more FUD.  The quote that Tony posted is just a
thinly-veiled jab at R (veiled by a disingenuous we value open
source veneer).  Perhaps SAS is shooting themselves in the foot with
their reactions; aren't they making it harder if they should ever
decide the best thing to do is to embrace R and the philosophies
behind it?  Four years ago, Marc Schwartz posted interesting comments
realted to this:

http://tolstoy.newcastle.edu.au/R/help/04/12/9497.html


On another note, I wonder why in the various conversations there seems
to be pervasive views that a) the FDA won't accept work done in R, and
b) SAS is the only way to effectively handle data?


best,

Kingsford Jones







 On 7 Jan, 14:50, Marc Schwartz marc_schwa...@comcast.net wrote:
 on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:



  Zaslavsky, Alan M. wrote:
  This article is accompanied by nice pictures of Robert and Ross.

  Data Analysts Captivated by Power of R
 http://www.nytimes.com/2009/01/07/technology/business-computing/07pro...

  January 7, 2009 Data Analysts Captivated by R's Power By ASHLEE VANCE

  SAS says it has noticed R's rising popularity at universities,
  despite educational discounts on its own software, but it dismisses
  the technology as being of interest to a limited set of people
  working on very hard tasks.

  I think it addresses a niche market for high-end data analysts that
  want free, readily available code, said Anne H. Milley, director of
  technology product marketing at SAS. She adds, We have customers who
  build engines for aircraft. I am happy they are not using freeware
  when I get on a jet.

  Thanks for posting.  Does anyone else find the statement by SAS to be
  humourous yet arrogant and short-sighted?

  Kevin

 It is an ignorant comment by a marketing person who has been spoon fed
 her lines...it is also a comment being made from a very defensive and
 insecure posture.

 Congrats to R Core and the R Community. This is yet another sign of R's
 growth and maturity.

 Regards,

 Marc Schwartz

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

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


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


[R] install.views()

2009-01-10 Thread oscar linares
Dear Rxperts,

Using R 2.8.1 and trying

install.views(Cluster)

getting error

Error: could not find function install.views


Please help:-(


-- 
Oscar
Oscar A. Linares
Molecular Medicine Unit
Bolles Harbor
Monroe, Michigan

[[alternative HTML version deleted]]

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


Re: [R] install.views()

2009-01-10 Thread Kingsford Jones
did you install and load the 'ctv' package?

install.packages('ctv')
library('ctv')

then try your code...




Kingsford Jones

On Sat, Jan 10, 2009 at 1:00 PM, oscar linares wins...@gmail.com wrote:
 Dear Rxperts,

 Using R 2.8.1 and trying

 install.views(Cluster)

 getting error

 Error: could not find function install.views


 Please help:-(


 --
 Oscar
 Oscar A. Linares
 Molecular Medicine Unit
 Bolles Harbor
 Monroe, Michigan

[[alternative HTML version deleted]]

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


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


Re: [R] Setting a contingency table

2009-01-10 Thread David Winsemius

 library(gmodels)
 ?CrossTable# by Marc Schwartz


a-67; b-10; c-79; d-67;


 dft- with(as.data.frame.table(as.table(c(a=77,b=10,c=79,d=67))),  
data.frame(Var1 = rep(Var1,Freq)) )


There are probably more efficient ways to replicate entries. I am just  
drawing a blank right now.


 dft$Rw - with(dft, ifelse((Var1 == a | Var1 == c), 1, 2))
 dft$Cl - with(dft, ifelse((Var1 == a | Var1 == b), 1, 2))


 table(dft$Rw, dft$Cl)

 1  2
  1 77 10
  2 79 67

 CrossTable(dft$Rw,dft$Cl, prop.chisq=FALSE)


   Cell Contents
|-|
|   N |
|   N / Row Total |
|   N / Col Total |
| N / Table Total |
|-|


Total Observations in Table:  233


 | dft$Cl
  dft$Rw | 1 | 2 | Row Total |
-|---|---|---|
   1 |77 |10 |87 |
 | 0.885 | 0.115 | 0.373 |
 | 0.494 | 0.130 |   |
 | 0.330 | 0.043 |   |
-|---|---|---|
   2 |79 |67 |   146 |
 | 0.541 | 0.459 | 0.627 |
 | 0.506 | 0.870 |   |
 | 0.339 | 0.288 |   |
-|---|---|---|
Column Total |   156 |77 |   233 |
 | 0.670 | 0.330 |   |
-|---|---|---|



--
David Winsemius
On Jan 10, 2009, at 11:32 AM, Bhargab Chattopadhyay wrote:


Hi,

I want to set a make a contingency table which will look like this..  
The problem is that I can't  set the table like the following.



 col1 col2   Total
row1  a b n10
 rp1   rp2100
 cp1   cp2   rtp1
  -
row2 c d n20
 rp3   rp4   100
 cp3   cp4   rtp2
  -
Totaln01   n02 n
 ctp1  ctp2   100
 100   100100


Suppose

a-67; b-10; c-79; d-67;
n-a+b+c+d;
  n10-a+b;
  n01-a+c;
  n20-n-n10;
  n02-n-n01;
  rp1-(a/n10)*100;
  rp2-100-rp1;
  rp3-(c/n20)*100;
  rp4-100-rp3;
  cp1-(a/n01)*100;
  cp2-100-cp1;
  cp3-(c/n02)*100;
  cp4-100-cp3;
  rtp1-(n10/n)*100;
  rtp2-100-rtp1;
  ctp1-(n01/n)*100;
  ctp2-100-ctp1;

After this I can't procced in a meaningful way. Can anyone help me  
out?

Thanks in advance.

Bhargab



[[alternative HTML version deleted]]

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


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


Re: [R] install.views()

2009-01-10 Thread David Winsemius

Does your session info show that you have ctv installed?

 sessionInfo()
R version 2.8.0 Patched (2008-11-14 r46932)
i386-apple-darwin9.5.0

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

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

other attached packages:
[1] ctv_0.4-7  gmodels_2.14.1

loaded via a namespace (and not attached):
[1] MASS_7.2-45  gdata_2.4.2  gtools_2.5.0 tools_2.8.0


--
David Winsemius
On Jan 10, 2009, at 3:00 PM, oscar linares wrote:


Dear Rxperts,

Using R 2.8.1 and trying

install.views(Cluster)

getting error

Error: could not find function install.views


Please help:-(


--
Oscar
Oscar A. Linares
Molecular Medicine Unit
Bolles Harbor
Monroe, Michigan

[[alternative HTML version deleted]]

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


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


[R] Hmisc-xtable label

2009-01-10 Thread Felipe Carrillo
Dear all: 
Does anybody know about label conflicts between xtable and Hmisc? I found a 
couple of e-mails similar to this problem but is not clear to me how to get 
around the label problem.
The first table(longtable below) is generated with the latex function from 
Hmisc but for some reason when I try to hyperlink to it,it takes me to the top 
of the document. The second table created with the xtable package(bottom of 
document)hyperlinks OK, but if I would create the bottom table first using 
xtable and then create the longtable using Hmisc then the hyperlink works OK on 
the longtable but not on the other one.  Thanks 
I'am using Sweave and Miktex, windows XP,R-2.8.1 to generate the document below:



\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{floatflt,graphicx,times}
\usepackage[usenames,dvipsnames]{color} 
\usepackage{longtable,pdflscape}
\usepackage{rotating}
\usepackage{verbatim}
\usepackage[ps2pdf,
bookmarks=true,
bookmarksnumbered=false, 
bookmarksopen=false, 
colorlinks=true,
linkcolor=webblue]{hyperref} 

\definecolor{webgreen}{rgb}{0, 0.5, 0} % less intense green
\definecolor{webblue}{rgb}{0, 0, 0.5} % less intense blue
\definecolor{webred}{rgb}{0.5, 0, 0} % less intense red

\usepackage[all]{hypcap} 
\pdfbookmark[1]{Contents}{table}
\title{BROOD-YEAR 2007 WINTER CHINOOK JUVENILE PRODUCTION}
\author{Felipe D. Carrillo}
\date{January 5, 2009}
\pagestyle{headings}
\parskip 7.2pt  
\begin{document}
\setkeys{Gin}{width=1.1\textwidth} 
\maketitle

\tableofcontents
The hyperlink of table 1 doesn't work but the hyperlink of table 2 works OK
\newpage
\listoftables
\listoffigures
\section{Introduction}
\label{sec:introduction}
Winter-run Chinook salmon is one of four distinct runs of Chinook salmon 
(Oncorhynchus tshawytscha)
\section{Study Area}
The Sacramento River is the largest river system in California, flowing south 
through 600 kilometers (km)... 
\section{Methods}
\subsection{Sampling gear}
Sampling was conducted along a transect using four 2.4 m diameter rotary-screw 
traps. 
\subsection{Sampling regimes}
In general, rotary traps sampled continuously throughout 24-hour periods and 
were serviced once daily.  
\subsection{Data collection}
All fish captured were anesthetized, identified to species..

The first table(longtable below) is generated with the latex function from 
Hmisc but for some reason when I try to hyperlink to it
takes me to the top of the document. The second table created with the xtable 
package(bottom of document)hyperlinks OK, but 
 If I would create the bottom table first using xtable and then create the 
longtable using Hmisc then the hyperlink works OK on the
 longtable but not on the other one. Does anybody know about conflicts between 
these two packages? I found a couple of e-mails similar to
 this problem but is not clear to me how to get around the label problem. Thanks
\newpage   
tab.R,echo=FALSE,results=tex=
library(Hmisc)
x - matrix(rnorm(1000), ncol = 10)
x.big - data.frame(x)
latex(x.big,,label=tab:nice,file=,longtable=TRUE, dec=2,landscape=TRUE,
caption='longtable generated with Hmisc.')
@

\section{Results}
\subsection{Sampling effort}
Weekly sampling effort throughout the 2006 brood-year emigration period was 
highly variable and ranged 
from 0.21 to 1.00 (0 = 0.74, N = 52 weeks; Table 1).  Weekly sampling effort 
ranged from 0.21 to 1.00 (0 = 0.73, N = 26 weeks) 
between July and December, the period of greatest juvenile winter Chinook 
emigration, and 0.21 to 1.00 (0 = 0.75, N = 26 weeks) 
during the latter half of the emigration period (Table 1).\\ 
\subsection{Trap efficiency trials}
Eight mark-recapture trials were conducted using naturally produced fall run 
fry sized Chinook 

tab.RR,echo=F,results=tex=
library(xtable)
x - matrix(rnorm(100), ncol = 10)
ci.table - data.frame(x)
ci.table - xtable(x,label='tab:mytable',align=ccc,caption='Table 
created with xtable',digits=0)
print(ci.table,tabular.environment='longtable',include.rownames=FALSE,floating=FALSE)
@
\end{document}


Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish  Wildlife Service  
California, USA

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


Re: [R] R in the NY Times

2009-01-10 Thread Johannes Huesing
Bert Gunter gunter.ber...@gene.com [Sat, Jan 10, 2009 at 08:31:03PM CET]:
[...]
 Perhaps an argument is that certain code might not get written at all if it
 were not proprietary. Device drivers might be an example. 

Device drivers are not an example. Linux is ubiquitous _despite_ device 
manufacturers being secretive about their protocols and interfaces. There's
a whole lot of people out there who seem to take pride, if not joy, in 
reengineering. At the moment I am profiting immensely from the gpsbabel
tool, which translates readily between all different GPS-related formats,
closed or documented.

-- 
Johannes Hüsing   There is something fascinating about science. 
  One gets such wholesale returns of conjecture 
mailto:johan...@huesing.name  from such a trifling investment of fact.  
  
http://derwisch.wikidot.com (Mark Twain, Life on the Mississippi)

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


Re: [R] R in the NY Times

2009-01-10 Thread Gabor Grothendieck
There do exist device manufacturers who GPL their device drivers, e.g.

http://freshmeat.net/projects/wanpipe/?branch_id=73783release_id=290741

On Sat, Jan 10, 2009 at 2:31 PM, Bert Gunter gunter.ber...@gene.com wrote:

 I think the substance of the issue is that the more eyes on code, the fewer
 the bugs (assuming a well-designed examination and debugging process is in
 place, as is typical for large open source projects like R). By this
 (obvious?)criterion, both the remarks about the dangers of proprietary code
 and the greater unreliability of R's lesser-used specialty packages, which
 by their nature tend to be less carefully perused, are valid.

 Perhaps an argument is that certain code might not get written at all if it
 were not proprietary. Device drivers might be an example. But possibly other
 than that, it does seem like SAS needs to reconsider their marketing
 strategy and advertising claims.

 Anecdotal remark: I orginally moved from S-Plus to R because R provided
 **better** documentation, support, and had fewer bugs, which were more
 rapidly fixed when found. One of my smarter investment choices.

 Cheers to all,
 Bert Gunter







 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf Of Barry Rowlingson
 Sent: Saturday, January 10, 2009 10:32 AM
 To: Tony Breyal
 Cc: r-help@r-project.org
 Subject: Re: [R] R in the NY Times

 2009/1/10 Tony Breyal tony.bre...@googlemail.com:

 [SAS marketroid quote]
 In fact, SAS values open-source software.

  But clearly not enough to open-source SAS itself. It would seem that
 SAS values _other_people's_ open source.

  If SAS was open source and free, then SAS would collect on all the
 other things Customers value SAS for - support, testing, training,
 docs, etc etc. And there would be a lot more people using it.

  Another quote: We advocate approaches based on science - closed
 source is closed knowledge and is nearer alchemy than science. I may
 use proprietary software for video editing or music production, but
 when it comes to science, it's got to be open.

 Barru

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

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


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


Re: [R] Hmisc-xtable label (Solved)

2009-01-10 Thread Felipe Carrillo
As soon as I sent the e-mail I found a solution to the hyperlink problem.
I removed the squared brackets and the number 1 from the line below. I don't 
know why I had the number there in the first place.
\pdfbookmark[1]{Contents}{table}

--- On Sat, 1/10/09, Felipe Carrillo mazatlanmex...@yahoo.com wrote:

 From: Felipe Carrillo mazatlanmex...@yahoo.com
 Subject: [R] Hmisc-xtable label
 To: r-h...@stat.math.ethz.ch
 Date: Saturday, January 10, 2009, 1:36 PM
 Dear all: 
 Does anybody know about label conflicts between xtable and
 Hmisc? I found a couple of e-mails similar to this problem
 but is not clear to me how to get around the label problem.
 The first table(longtable below) is generated with the
 latex function from Hmisc but for some reason when I try to
 hyperlink to it,it takes me to the top of the document. The
 second table created with the xtable package(bottom of
 document)hyperlinks OK, but if I would create the bottom
 table first using xtable and then create the longtable using
 Hmisc then the hyperlink works OK on the longtable but not
 on the other one.  Thanks 
 I'am using Sweave and Miktex, windows XP,R-2.8.1 to
 generate the document below:
 
 
 
 \documentclass[11pt]{article}
 
 \usepackage{amsmath}
 \usepackage{floatflt,graphicx,times}
 \usepackage[usenames,dvipsnames]{color} 
 \usepackage{longtable,pdflscape}
 \usepackage{rotating}
 \usepackage{verbatim}
 \usepackage[ps2pdf,
 bookmarks=true,
 bookmarksnumbered=false, 
 bookmarksopen=false, 
 colorlinks=true,
 linkcolor=webblue]{hyperref} 
 
 \definecolor{webgreen}{rgb}{0, 0.5, 0} % less intense
 green
 \definecolor{webblue}{rgb}{0, 0, 0.5} % less intense
 blue
 \definecolor{webred}{rgb}{0.5, 0, 0} % less intense red
 
 \usepackage[all]{hypcap} 
 \pdfbookmark[1]{Contents}{table}
 \title{BROOD-YEAR 2007 WINTER CHINOOK JUVENILE
 PRODUCTION}
 \author{Felipe D. Carrillo}
 \date{January 5, 2009}
 \pagestyle{headings}
 \parskip 7.2pt  
 \begin{document}
 \setkeys{Gin}{width=1.1\textwidth} 
 \maketitle
 
 \tableofcontents
 The hyperlink of table 1 doesn't work but the
 hyperlink of table 2 works OK
 \newpage
 \listoftables
 \listoffigures
 \section{Introduction}
 \label{sec:introduction}
 Winter-run Chinook salmon is one of four distinct
 runs of Chinook salmon (Oncorhynchus
 tshawytscha)
 \section{Study Area}
 The Sacramento River is the largest river system in
 California, flowing south through 600 kilometers (km)... 
 \section{Methods}
 \subsection{Sampling gear}
 Sampling was conducted along a transect using four 2.4 m
 diameter rotary-screw traps. 
 \subsection{Sampling regimes}
 In general, rotary traps sampled continuously throughout
 24-hour periods and were serviced once daily.  
 \subsection{Data collection}
 All fish captured were anesthetized, identified to
 species..
 
 The first table(longtable below) is generated with the
 latex function from Hmisc but for some reason when I try to
 hyperlink to it
 takes me to the top of the document. The second table
 created with the xtable package(bottom of
 document)hyperlinks OK, but 
  If I would create the bottom table first using xtable and
 then create the longtable using Hmisc then the hyperlink
 works OK on the
  longtable but not on the other one. Does anybody know
 about conflicts between these two packages? I found a couple
 of e-mails similar to
  this problem but is not clear to me how to get around the
 label problem. Thanks
 \newpage   
 tab.R,echo=FALSE,results=tex=
 library(Hmisc)
 x - matrix(rnorm(1000), ncol = 10)
 x.big - data.frame(x)
 latex(x.big,,label=tab:nice,file=,longtable=TRUE,
 dec=2,landscape=TRUE,
 caption='longtable generated with Hmisc.')
 @
 
 \section{Results}
 \subsection{Sampling effort}
 Weekly sampling effort throughout the 2006 brood-year
 emigration period was highly variable and ranged 
 from 0.21 to 1.00 (0 = 0.74, N = 52 weeks; Table 1). 
 Weekly sampling effort ranged from 0.21 to 1.00 (0 = 0.73, N
 = 26 weeks) 
 between July and December, the period of greatest juvenile
 winter Chinook emigration, and 0.21 to 1.00 (0 = 0.75, N =
 26 weeks) 
 during the latter half of the emigration period (Table
 1).\\ 
 \subsection{Trap efficiency trials}
 Eight mark-recapture trials were conducted using naturally
 produced fall run fry sized Chinook 
 
 tab.RR,echo=F,results=tex=
 library(xtable)
 x - matrix(rnorm(100), ncol = 10)
 ci.table - data.frame(x)
 ci.table -
 xtable(x,label='tab:mytable',align=ccc,caption='Table
 created with xtable',digits=0)
 print(ci.table,tabular.environment='longtable',include.rownames=FALSE,floating=FALSE)
 @
 \end{document}
 
 
 Felipe D. Carrillo  
 Supervisory Fishery Biologist  
 Department of the Interior  
 US Fish  Wildlife Service  
 California, USA
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, 

[R] how to get the signed distance in SVM?

2009-01-10 Thread Qing Li

Dear all,

In the svm() function in the package e1071, is there anyway to get the 
signed distance of a sample point to the separating hyperplane in the 
feature space? Namely, if the separating hyperplane is given by f(x) = 
h(x)^T * w - rho, is there any way to get f(x)?


Also, in the returned values of the function svm(), what does $coefs 
mean? It is said to be the corresponding coefficients times the 
training labels, but I don't know what is that corresponding 
coefficients denoting?


Thank you very much!

Best,
Qing

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


[R] Problem with compiling shared C/C++ library for loading into R (Linux)

2009-01-10 Thread Samsiddhi Bhattacharjee
I am using the .Call interface to call c++ code from R. For that, I am
trying to create a dynamic library (mylib.so)
using R CMD SHLIB by linking my own c++ code and an external c++
library (blitz++).

The makefile works fine on my Mac, produces mylib.so and I am able to
call .Call() from R,  but on a linux
server (I think Debian),  I got the following error:

--
/usr/bin/ld: /somepath/blitz/lib/libblitz.a(globals.o):
relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
/somepath/blitz/lib/libblitz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
--

I tried recompiling the blitz++ library with the -fPIC flag, and then
linking using -fPIC, it went thorugh without error
producing a mylib.so file.  But when I tried dyn.load(mylib.so)
from R, I got the error:

--
Error in dyn.load(mylib.so) :
  unable to load shared library '/somepath/mylib.so':
  /somepath/mylib.so: undefined symbol: _ZSt4cerr
-

I will really appreciate any help or advice on this problem.

--Samsiddhi

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


[R] Problem with compiling shared C/C++ library for loading into R (Linux)

2009-01-10 Thread Samsiddhi Bhattacharjee
Dear all,
   Sorry about posting this to R-help by mistake. I just realized it
belongs to the r-devel list.
So I am reposting it there.
-

I am using the .Call interface to call c++ code from R. For that, I am
trying to create a dynamic library (mylib.so)
using R CMD SHLIB by linking my own c++ code and an external c++
library (blitz++).

The makefile works fine on my Mac, produces mylib.so and I am able to
call .Call() from R,  but on a linux
server (I think Debian),  I got the following error:

--
/usr/bin/ld: /somepath/blitz/lib/libblitz.a(globals.o):
relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
/somepath/blitz/lib/libblitz.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
--

I tried recompiling the blitz++ library with the -fPIC flag, and then
linking using -fPIC, it went thorugh without error
producing a mylib.so file.  But when I tried dyn.load(mylib.so)
from R, I got the error:

--
Error in dyn.load(mylib.so) :
 unable to load shared library '/somepath/mylib.so':
 /somepath/mylib.so: undefined symbol: _ZSt4cerr
-

I will really appreciate any help or advice on this problem.

--Samsiddhi

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


[R] Rserve/RandomForest does not work with a CSV?

2009-01-10 Thread anthony
Hi all,

We're using Rserve and RandomForest to do classification from within a
Java program.  The total is about 4 lines of R code:

library('randomForest')
x
y
future
fit-randomForest(x,y,no.action=na.roughfix,importance=T,proximity=T)
p-predict(fit, future)

What is very frustrating is that we have tried this two different ways
(both work in R):

1.  Load x, y, and future from a CSV.  If I do this, Rserve throws an
error when randomForest() is called.

2.  Load x, y, and future by using arrays, and manually building them.  If
I do this, randomForest() works fine.

Either way can be done inside of R, and they work great.

Rserve is running as root, and our Java application is running inside of
Tomcat, and is also running as root.

The actual code looks something like:

RConnection conn = new RConnection(127.0.0.1);
conn.voidEval(library('randomForest'));
conn.voidEval(train-read.csv(\ + (outfile.getAbsolutePath()) +
\,header=FALSE));
conn.voidEval(x-train[1: + totalTrainData + ,1:11]);
conn.voidEval(y-as.factor(train[1: + totalTrainData + ,12]));
conn.voidEval(future-train[ + (totalTrainData + 1) + : +
(totalTrainData + totalPredictions) + ,1:11]);
conn.voidEval(fit-randomForest(x,y,no.action=na.roughfix,importance=T,proximity=T));
conn.voidEval(p-predict(fit, future));
conn.voidEval(write.csv(p, file=\ + (filename.getAbsolutePath()) + \));

Every time we use this, it errors on the randomForest() call.

(If I run this in R, it works perfectly fine).

Any ideas why I cannot call randomForest() this way, but if instead, the x
/ y / future values are built using the array command, it works fine?

As a secondary question, is it faster/slower to do it this way?  Certainly
is pretty convenient to use the CSV's.

This one is driving us bonkers!


--
Anthony

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


Re: [R] The R Inferno

2009-01-10 Thread milton ruser
Hi Pat  R-list,
Congratulation for this very informative and funny reading!
I enjoyed so much.

Best wishes,

miltinho astronauta
brazil

On Sat, Jan 10, 2009 at 1:31 PM, Ajay ohri ohri2...@gmail.com wrote:

 Hi ,
 I have been trying to convince Pat to come up with a book on this.

 He can add in the chapters on *Purgatorio*
 (Purgatoryhttp://en.wikipedia.org/wiki/Purgatory),
 and *Paradiso* (Paradise http://en.wikipedia.org/wiki/Heaven)


 Regards,

 Ajay

 On Sat, Jan 10, 2009 at 9:33 PM, Jason Morgan jwm-r-h...@skepsi.net
 wrote:

  Excellent read, Patrick. A very useful and clear guide.
 
  On 2009.01.09 16:14:49, Patrick Burns wrote:
   The R Inferno is now on the Burns Statistics website at
  
   http://www.burns-stat.com/pages/Tutor/R_inferno.pdf
  
   Abstract: If you are using R and you think you're in hell,
   this is a map for you.
  
   Also, I've expanded the outline concerning R on the
   Burns Statistics 'Links' page. Suggestions (off-list) for
   additional items are encouraged.
  
  
   Patrick Burns
   patr...@burns-stat.com
   +44 (0)20 8525 0696
   http://www.burns-stat.com
   (home of The R Inferno and A Guide for the Unwilling S User)
  
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
 
  --
  ~ Jason Morgan
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] Arguments for Rcmd BATCH

2009-01-10 Thread Prof Brian Ripley

I suggested you use Rscript, please do.

R CMD BATCH is the Unix-alike notation.  Rcmd BATCH is the recommended 
way on Windows, but R CMD BATCH is also accepted.


There is nothing to reproduce here, so here is a simple example.

tystie% cat foo.R
args - commandArgs(TRUE)
print(args)

tystie% Rscript foo.R parms=1:33
[1] parms=1:33

You can redirect the output as you wish.

On Sun, 11 Jan 2009, Andrew Hicks wrote:


Dear Professor Ripley,

Firstly, thank you very much for your advice. I was not aware my R was so
old. Sorry I must have missed the instruction on reading the posting
guidelines.

I have updated it and it now runs again. This is a big step forward. However
it is not running properly (or I am doing something wrong).

There are still two problems may I ask for your help with please?

1. When I call the script it fails with the following message in the output
file:


##First read in the arguments listed at the command line
args - commandArgs(TRUE)

Error in commandArgs(TRUE) : unused argument(s) (TRUE)
Execution halted

2. The diagnostic details (that should be going to test01b.ROUT are now
going to strange places, overwriting the test01b.R file if I do not include
the  and  redirectors.

I am now using the following syntax, from the manual:

Rcmd BATCH --no-save --no-restore --args parms=c(1,2,3)  test01b.R 
test01b.ROUT


That's nothing like what is documented.


Currently it is writing the output to parms=c(1,2,3).ROUT

This is attached but says fatal error cannot open file --args

The file test01b.ROUT is created but empty.

I get the same results if I start it with R CMD BATCH ...

Is the a difference between R CMD... and Rcmd... please? The manual is not
very clear on this.

I am sorry to impose on you but guess I am still doing something wrong. I
have looked through the documentation but cannot find much on this or many
examples.

Many thanks,

Andrew Hicks


-Original Message-
From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk]
Sent: 10 January 2009 18:18
To: Andrew Hicks
Cc: r-help@r-project.org
Subject: Re: [R] Arguments for Rcmd BATCH

Your R is far too old, and in particular too old for the example you
are trying.

Please do you as asked in the posting guide to do before posting, and
upgrade.  Then you will have Rscript, as described in the current 'An
Introduction to R' manual for this purpose (with examples).

On Sat, 10 Jan 2009, Andrew Hicks wrote:


Sorry to bother you and I hope this will be easy to solve.


I am trying to run R scripts in batch, called from another programme,

under

Windows XP. I have R 2.4.1



I need to be able to pass a list of numeric arguments to the script as

well.




The Rscript and its input data file are attached.



I have been trying the syntax below but it doesn't work:



Rcmd BATCH -no-save -no-restore -args parms=c(1,2,3) test01b.R



(each of these BATCH options is preceded by 2 - characters, but my Outlook
is munging them together here)



The script then accesses (or tries to) the variables as parms[1],

parms[2],

etc.



I get the respose unable to open input file at the command line and no
other diagnostic output.



I got this syntax from p85 of the R-Intro doc and from the website
http://quantitative-ecology.blogspot.com/search/label/scripts. I could not
find any other illustrations or instructions of how to use args with

BATCH.




Without using any parameter args it otherwise runs fine.



Please can you advise what am I doing wrong and how should this command be
structured? Do I also need to change the way the script is accessing the
arguments?



Many thanks,



Andrew Hicks




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Zipf fitting using R

2009-01-10 Thread Stefan Evert
Hi there,

I haven't seen any answers to your question on the list, so here's a  
rather late response.

I'm not familiar with the VGAM package, but if you just want to fit  
Zipf's law (did you mean Zipf's law or an actual probability  
distribution?) to some data, why not do this directly with nls() or  
optim()?  If you pass the Zipf equation to those functions, they  
should give you estimates for the parameters you're interested in.

If you're particularly interested in low-frequency data (i.e. the long  
tail of the Zipf ranking) and actual probability distributions, you  
could try our zipfR package available from CRAN.  The tutorial and  
background materials at

http://zipfR.R-Forge.R-project.org/

should help you to get started and will also explain how to calculate  
the coefficients of Zipf's law from estimates of the model parameters.


Best regards,
Stefan Evert

[ stefan.ev...@uos.de | http://purl.org/stefan.evert ]



On 27 Dec 2008, at 10:01, Epithemeus wrote:

 Dear R-users,

 I am new to R and would like to use it for fitting the zipf  
 distribution to
 some numeric data that I have. Here's the snippet that I use:

 library(VGAM)

 X - read.table(file(~\\mydata.txt, encoding=latin1))

 w - as.vector(t((X[2])))

 w - w/sum(w)

 y - (1:length(w))

 fit = vglm  (y ~ 1, zipf, tra=TRUE, weight=w)

 zipf(N=NULL, link=loge, earg=w, init.s=NULL)

 coef(fit, matrix=FALSE)




[[alternative HTML version deleted]]

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


Re: [R] Arguments for Rcmd BATCH

2009-01-10 Thread Andrew Hicks
Dear Professor Ripley,

Firstly, thank you very much for your advice. I was not aware my R was so
old. Sorry I must have missed the instruction on reading the posting
guidelines.

I have updated it and it now runs again. This is a big step forward. However
it is not running properly (or I am doing something wrong).

There are still two problems may I ask for your help with please?

1. When I call the script it fails with the following message in the output
file:

 ##First read in the arguments listed at the command line
 args - commandArgs(TRUE)
Error in commandArgs(TRUE) : unused argument(s) (TRUE)
Execution halted

2. The diagnostic details (that should be going to test01b.ROUT are now
going to strange places, overwriting the test01b.R file if I do not include
the  and  redirectors.

I am now using the following syntax, from the manual:

Rcmd BATCH --no-save --no-restore --args parms=c(1,2,3)  test01b.R 
test01b.ROUT

Currently it is writing the output to parms=c(1,2,3).ROUT

This is attached but says fatal error cannot open file --args

The file test01b.ROUT is created but empty.

I get the same results if I start it with R CMD BATCH ...

Is the a difference between R CMD... and Rcmd... please? The manual is not
very clear on this.

I am sorry to impose on you but guess I am still doing something wrong. I
have looked through the documentation but cannot find much on this or many
examples.

Many thanks,

Andrew Hicks


-Original Message-
From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] 
Sent: 10 January 2009 18:18
To: Andrew Hicks
Cc: r-help@r-project.org
Subject: Re: [R] Arguments for Rcmd BATCH

Your R is far too old, and in particular too old for the example you 
are trying.

Please do you as asked in the posting guide to do before posting, and 
upgrade.  Then you will have Rscript, as described in the current 'An 
Introduction to R' manual for this purpose (with examples).

On Sat, 10 Jan 2009, Andrew Hicks wrote:

 Sorry to bother you and I hope this will be easy to solve.


 I am trying to run R scripts in batch, called from another programme,
under
 Windows XP. I have R 2.4.1



 I need to be able to pass a list of numeric arguments to the script as
well.



 The Rscript and its input data file are attached.



 I have been trying the syntax below but it doesn't work:



 Rcmd BATCH -no-save -no-restore -args parms=c(1,2,3) test01b.R



 (each of these BATCH options is preceded by 2 - characters, but my Outlook
 is munging them together here)



 The script then accesses (or tries to) the variables as parms[1],
parms[2],
 etc.



 I get the respose unable to open input file at the command line and no
 other diagnostic output.



 I got this syntax from p85 of the R-Intro doc and from the website
 http://quantitative-ecology.blogspot.com/search/label/scripts. I could not
 find any other illustrations or instructions of how to use args with
BATCH.



 Without using any parameter args it otherwise runs fine.



 Please can you advise what am I doing wrong and how should this command be
 structured? Do I also need to change the way the script is accessing the
 arguments?



 Many thanks,



 Andrew Hicks



-- 
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] temporal join

2009-01-10 Thread mckenzig
I have dataframe a:

sym date val1
===  
foo 20090101 a1
foo 20090102 a2
foo 20090103 a3

and dataframe b:

sym date val2
===  
foo 20090104 b1

I would like to join/merge them to generate the following:

sym date val2 val1
===   
foo 20090104 b1 a3

i.e. an equijoin on column 'sym' and a temporal join on column 'date'
where the closest matching row is retrieved. I have been through the
various regular/irregular timeseries packages and can not see anything
like this.

Regards.

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


[R] problems installing package XML to a computer without an internet connection

2009-01-10 Thread Bob Green

Hello,

I am hoping for some advice regarding how I can install the XML 
package which I require to run package tm.


Normally I would use the install package option, however, I have to 
install the packages to a laptop running XP. The laptop does not have 
an internet connection.


Firstly I tried the file -   XML_1.99-0.tar.gz . Below is the error I received

Error in gzfile(file, r) : cannot open the connection
In addition: Warning messages:
1: In zip.unpack(pkg, tmpDir) : error 1 in extracting from zip file
2: In gzfile(file, r) :
  cannot open compressed file 'XML_1.99-0.tar.gz/DESCRIPTION', 
probable reason 'No such file or directory'


Then I tried XML 1.96-0.zip (from 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/). Below 
is the error I received


Loading required package: XML
Error in loadNamespace(i, c(lib.loc, .libPaths())) :
  there is no package called 'proxy'
Error: package/namespace load failed for 'tm'

Any suggestions are appreciated,

Bob

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


Re: [R] problems installing package XML to a computer without an internet connection

2009-01-10 Thread Gabor Grothendieck
On a computer with an internet connection use your browser to
find and download the XML package zip file.  (Note that this
step does not involve using R.)

Transfer zip file to XP.  Start up R on the XP  use the menus:
   Packages | Install package(s) from local zip file
to install it.

On Sat, Jan 10, 2009 at 9:50 PM, Bob Green bgr...@dyson.brisnet.org.au wrote:
 Hello,

 I am hoping for some advice regarding how I can install the XML package
 which I require to run package tm.

 Normally I would use the install package option, however, I have to install
 the packages to a laptop running XP. The laptop does not have an internet
 connection.

 Firstly I tried the file -   XML_1.99-0.tar.gz . Below is the error I
 received

 Error in gzfile(file, r) : cannot open the connection
 In addition: Warning messages:
 1: In zip.unpack(pkg, tmpDir) : error 1 in extracting from zip file
 2: In gzfile(file, r) :
  cannot open compressed file 'XML_1.99-0.tar.gz/DESCRIPTION', probable
 reason 'No such file or directory'

 Then I tried XML 1.96-0.zip (from
 http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/). Below is the
 error I received

 Loading required package: XML
 Error in loadNamespace(i, c(lib.loc, .libPaths())) :
  there is no package called 'proxy'
 Error: package/namespace load failed for 'tm'

 Any suggestions are appreciated,

 Bob

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


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


[R] I'm looking for a book about spatial point patterns (Diggle, 2003)

2009-01-10 Thread Unangu

To understand some functions about spatial point patterns in spatstat ,I
should know some background about it, and the best way is to read the
monograph, and  Statistical Analysis of Spatial Point Patterns (2nd edt.)
is a better choise. But I can not find it anywhere I can. Who can help me?
Thank you!

-
una...@gmail.com
-- 
View this message in context: 
http://www.nabble.com/I%27m-looking-for-a-book-about-spatial-point-patterns-%28Diggle%2C2003%29-tp21395908p21395908.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] install.views()

2009-01-10 Thread oscar linares
Thanks! Your suggestion did it:-)

OAL

On Sat, Jan 10, 2009 at 3:00 PM, oscar linares wins...@gmail.com wrote:


 Dear Rxperts,

 Using R 2.8.1 and trying

 install.views(Cluster)

 getting error

 Error: could not find function install.views


 Please help:-(


 --
 Oscar
 Oscar A. Linares
 Molecular Medicine Unit
 Bolles Harbor
 Monroe, Michigan




-- 
Oscar
Oscar A. Linares
Molecular Medicine Unit
Bolles Harbor
Monroe, Michigan

[[alternative HTML version deleted]]

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


[R] Convert date/time string to date

2009-01-10 Thread Heston Capital
I am new to R and am trying to import a text file that contains
date/time and various fields.  I want to sort this matrix by date and
also perform calculations on the date field (difference between two
dates etc).

The format of the string looks as follows:

x-c(25/2/2003 0:00:00)

I tried:

as.Date(x,format='%d/%m/%y')
[1] 2020-02-25

Obviously I am doing something wrong here.  I would like to remove the
hh:mm:ss from the end of the string if possible.

Thanks for your help, I have been searching for hours and not getting anywhere.

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


Re: [R] problems installing package XML to a computer without an internet connection

2009-01-10 Thread Bob Green

Hello Gabor,

I believe I used the method you described to download zip files for 
rJava, tm, matrix, filehash etc etc. There is no windows zip file for 
XML, only a gz file which I can't get to load through install local 
zip file. The XML zip file I located on 
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/ resulted 
in the namespace error.



regards

Bob


At 01:23 PM 11/01/2009, Gabor Grothendieck wrote:

On a computer with an internet connection use your browser to
find and download the XML package zip file.  (Note that this
step does not involve using R.)

Transfer zip file to XP.  Start up R on the XP  use the menus:
   Packages | Install package(s) from local zip file
to install it.

On Sat, Jan 10, 2009 at 9:50 PM, Bob Green 
bgr...@dyson.brisnet.org.au wrote:

 Hello,

 I am hoping for some advice regarding how I can install the XML package
 which I require to run package tm.

 Normally I would use the install package option, however, I have to install
 the packages to a laptop running XP. The laptop does not have an internet
 connection.

 Firstly I tried the file -   XML_1.99-0.tar.gz . Below is the error I
 received

 Error in gzfile(file, r) : cannot open the connection
 In addition: Warning messages:
 1: In zip.unpack(pkg, tmpDir) : error 1 in extracting from zip file
 2: In gzfile(file, r) :
  cannot open compressed file 'XML_1.99-0.tar.gz/DESCRIPTION', probable
 reason 'No such file or directory'

 Then I tried XML 1.96-0.zip (from
 http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.7/). Below is the
 error I received

 Loading required package: XML
 Error in loadNamespace(i, c(lib.loc, .libPaths())) :
  there is no package called 'proxy'
 Error: package/namespace load failed for 'tm'

 Any suggestions are appreciated,

 Bob

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

 and provide commented, minimal, self-contained, reproducible code.



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


[R] How to get solution of following polynomial?

2009-01-10 Thread RON70

Hi, I want find all roots for the following polynomial :

a - c(-0.07, 0.17); b - c(1, -4); cc - matrix(c(0.24, 0.00, -0.08,
-0.31), 2); d - matrix(c(0, 0, -0.13, -0.37), 2); e - matrix(c(0.2, 0,
-0.06, -0.34), 2)
A1 - diag(2) + a %*% t(b) + cc; A2 - -cc + d; A3 - -d + e; A4 - -e
fn - function(z)
   {
y - diag(2) - A1*z - A2*z^2 - A3*z^3 - A4*z^4
return(det(y))
   }; uniroot(fn, c(-10, 1))

Using uniroot function, I got only one solution of that. Is there any
function to get all four solutions? I looked at polyroot() function, but I
do not think it will work for my problem, because, my coef. are matrix, nor
number

Thanks
   


-- 
View this message in context: 
http://www.nabble.com/How-to-get-solution-of-following-polynomial--tp21396441p21396441.html
Sent from the R help mailing list archive at Nabble.com.

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