[R] "with" and "by" and NA:

2009-03-25 Thread Aldi Kraja

Hi,

I have a data.frame with many variables for which I am performing the 
mean by subgroup, for a pair of variables at a time, where one of them 
for each pair defines the subgroup. The subgroups in the x$cm1 are 0, 1 
and 2.

x
ph1 cm1
0.2345 2
1. 1
2.0033 0
0. 2
1.0033 1
0.2345 0
1. 2
2.0033 0
0. 1
1.0033 2

> meanbygroup <- as.vector(with(x, by(x$ph1, x$cm1, mean)))
> meanbygroup
if the ph1 has no missing values the above statements work fine:
[1] 1.4137000 0.7418333 0.615

In the moment that I introduce in the ph1 a missing value in the ph1 as NA
x
ph1 cm1
0.2345 2
NA  1
1. 1
.

the above transforms into
[1] 1.4137000 NA 0.615

Question: is there a way I can protect this calculations from the NA 
values in the ph1 (some kind of: na.rm=T)?


TIA,

Aldi


--

__
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] real numeric variable transforms into factor:

2009-04-17 Thread Aldi Kraja
Hi
Test made in: R in windows Vista OS, R version 2.8.1
 From FAQ: 
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f
"It may happen that when reading numeric data into R (usually, when 
reading in a file), they come in as factors. If |f| is such a factor 
object, you can use as.numeric(as.character(f)) to get the numbers back."

1: Why it may happen? Why R transforms x1 from real numeric with decimal 
values into factor???
2: Doesn't it look strange to get "internal numbers" when one applies 
as.numeric(x$x1)?
3. What are the internal numbers mentioned in the FAQ?
Why is needed to write:
as.numeric(as.character(x$x1)) to get finally the right numbers I read 
with read.table?
Are the missing values shown as dot to force R (or the programmer who 
wrote the function read.table) to consider x1 as factor?

Is it possible who is maintaining the read.table function to improve it 
to recognize numbers with decimal places as numeric and not as factors 
and dots as missing values which transform into NA?

The data file saved as text:
test.txt
ob,x1,y1
1,1.1,1/1
2,2.1,1/2
3,3.2,2/2
4,.,0/0
5,4.5,1/1
6,5.1,0/0
7,6.3,1/1
8,.,1/2
reading it from d directory:
x<-read.table(file="d:\\test\\test.txt",header=T,sep=',')
 > x
  ob  x1  y1
1  1 1.1 1/1
2  2 2.1 1/2
3  3 3.2 2/2
4  4   . 0/0
5  5 4.5 1/1
6  6 5.1 0/0
7  7 6.3 1/1
8  8   . 1/2
 > as.numeric(x$x1)
[1] 2 3 4 1 5 6 7 1

 > as.numeric(as.character(x$x1))
[1] 1.1 2.1 3.2  NA 4.5 5.1 6.3  NA
Warning message:
NAs introduced by coercion

Thanks,

Aldi



[[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] real numeric variable transforms into factor:

2009-04-17 Thread Aldi Kraja

Thank you Marc for your detailed and helpful info.

Aldi



Marc Schwartz wrote:

On Apr 17, 2009, at 2:52 PM, Aldi Kraja wrote:


Hi
Test made in: R in windows Vista OS, R version 2.8.1
From FAQ:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f 


"It may happen that when reading numeric data into R (usually, when
reading in a file), they come in as factors. If |f| is such a factor
object, you can use as.numeric(as.character(f)) to get the numbers 
back."


1: Why it may happen? Why R transforms x1 from real numeric with decimal
values into factor???
2: Doesn't it look strange to get "internal numbers" when one applies
as.numeric(x$x1)?
3. What are the internal numbers mentioned in the FAQ?
Why is needed to write:
as.numeric(as.character(x$x1)) to get finally the right numbers I read
with read.table?
Are the missing values shown as dot to force R (or the programmer who
wrote the function read.table) to consider x1 as factor?

Is it possible who is maintaining the read.table function to improve it
to recognize numbers with decimal places as numeric and not as factors
and dots as missing values which transform into NA?

The data file saved as text:
test.txt
ob,x1,y1
1,1.1,1/1
2,2.1,1/2
3,3.2,2/2
4,.,0/0
5,4.5,1/1
6,5.1,0/0
7,6.3,1/1
8,.,1/2
reading it from d directory:
x<-read.table(file="d:\\test\\test.txt",header=T,sep=',')

x

 ob  x1  y1
1  1 1.1 1/1
2  2 2.1 1/2
3  3 3.2 2/2
4  4   . 0/0
5  5 4.5 1/1
6  6 5.1 0/0
7  7 6.3 1/1
8  8   . 1/2

as.numeric(x$x1)

[1] 2 3 4 1 5 6 7 1


as.numeric(as.character(x$x1))

[1] 1.1 2.1 3.2  NA 4.5 5.1 6.3  NA
Warning message:
NAs introduced by coercion

Thanks,

Aldi


Looks like you are taking data from SAS perhaps, where the missing 
value indicator is '.'.  In R, where type.convert() is used to 
determine the data types for incoming text data, you get:


> type.convert(".")
[1] .
Levels: .

That is, a factor.

What you want to do is to set the 'na.strings' argument to 
read.table() to '.' rather than the default 'NA', so that the periods 
are interpreted as missing values and set to NA during import. Thus:


# Create from your data in the clipboard (on OSX)
DF <- read.table(pipe("pbpaste"), header = TRUE, sep = ",", na.strings 
= ".")


> DF
  ob  x1  y1
1  1 1.1 1/1
2  2 2.1 1/2
3  3 3.2 2/2
4  4  NA 0/0
5  5 4.5 1/1
6  6 5.1 0/0
7  7 6.3 1/1
8  8  NA 1/2

> str(DF)
'data.frame':8 obs. of  3 variables:
 $ ob: int  1 2 3 4 5 6 7 8
 $ x1: num  1.1 2.1 3.2 NA 4.5 5.1 6.3 NA
 $ y1: Factor w/ 4 levels "0/0","1/1","1/2",..: 2 3 4 1 2 1 2 3

This is now because:

> type.convert(".", na.strings = ".")
[1] NA


See ?read.table and ?type.convert for more information.

HTH,

Marc Schwartz


--

__
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] A problem of splitting the right screen in 3 or more independent vertical boxes:

2013-05-03 Thread Aldi Kraja

Hi,
Based on par function, I can split the screen into  two parts left and 
right.
I wish x occupies the half left screen, and all plants occupy half right 
screen, which happens right now.


But I wish the right screen, to be split in 3 or more vertical parts 
where each pair of the same type of plant, are together in its own block 
of boxplot, because each plant has its own unit of measure.
Let's say wheat is measured in ton, tomato in pound and cucumbers as 
counts. :-)


x<-rnorm(1000,mean=0,sd=1,main="Right screen")

wheat1<-rnorm(100,mean=0,sd=1)
wheat2<-rnorm(150,mean=0,sd=2)
tomatos3<-rnorm(200,mean=0,sd=3)
tomatos4<-rnorm(250,mean=0,sd=4)
cucumbers5<-rnorm(300,mean=0,sd=5)
cucumbers6<-rnorm(400,mean=0,sd=6)
par(mfrow=c(1,2))

hist(x, main="Left screen OK")

boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)
title ("Right screen: boxplot with plants")

Thank you in advance for any suggestions,

Aldi

--

__
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] A problem of splitting the right screen in 3 or more independent vertical boxes:

2013-05-03 Thread Aldi Kraja

Hmm,
I had a typo paste by mistake in my x vector
It has to be:

x<-rnorm(1000,mean=0,sd=1)
wheat1<-rnorm(100,mean=0,sd=1)
wheat2<-rnorm(150,mean=0,sd=2)
tomatos3<-rnorm(200,mean=0,sd=3)
tomatos4<-rnorm(250,mean=0,sd=4)
cucumbers5<-rnorm(300,mean=0,sd=5)
cucumbers6<-rnorm(400,mean=0,sd=6)
par(mfrow=c(1,2))

hist(x, main="Left screen OK")

boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)
title ("Right screen: boxplot with plants")

Thanks,

Aldi

On 5/3/2013 4:46 PM, Aldi Kraja wrote:

Hi,
Based on par function, I can split the screen into  two parts left and 
right.
I wish x occupies the half left screen, and all plants occupy half 
right screen, which happens right now.


But I wish the right screen, to be split in 3 or more vertical parts 
where each pair of the same type of plant, are together in its own 
block of boxplot, because each plant has its own unit of measure.
Let's say wheat is measured in ton, tomato in pound and cucumbers as 
counts. :-)


x<-rnorm(1000,mean=0,sd=1,main="Right screen")

wheat1<-rnorm(100,mean=0,sd=1)
wheat2<-rnorm(150,mean=0,sd=2)
tomatos3<-rnorm(200,mean=0,sd=3)
tomatos4<-rnorm(250,mean=0,sd=4)
cucumbers5<-rnorm(300,mean=0,sd=5)
cucumbers6<-rnorm(400,mean=0,sd=6)
par(mfrow=c(1,2))

hist(x, main="Left screen OK")

boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)
title ("Right screen: boxplot with plants")

Thank you in advance for any suggestions,

Aldi

--

__
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] A problem of splitting the right screen in 3 or more independent vertical boxes:

2013-05-11 Thread Aldi Kraja

For those that may have this question in the future, here are two solutions:
As suggested from David and Sarah,
One has to remove par function from defining screen splits, instead use 
layout function.

For example:
 layout(matrix(c(1,1,2,3),2,2,byrow=T))
which says, split the screen in 4 blocks, of them use block space 1 and 
2 oriented by row for picture 1, and the two remaining blocks for 
picture 2 and picture 3. Similarly, one can split the screen into 6, 8 
blocks and so on by changing also how many blocks of space you want to 
assign to a specific picture for example.
layout(matrix(c(1,1,1,2,3,4,5),2,3,byrow=T)) ## six splits, of those 
first 3 belong to picture 1
layout(matrix(c(1,1,2,3,4,5,6,7),2,4,byrow=T))  ## 8 splits of those 
first 2 belong to picture 1 and so on.


Dennis Murphey provided also another beautiful solution via ggplot2. See 
following.

Thank you,
Aldi
On 5/3/2013 7:57 PM, Dennis Murphy wrote:

Hi:

Here are a couple of ways you could go using the ggplot2 and gridExtra
packages, but it requires that you rearrange your data.

ggplot2 prefers data frame input, so we convert the histogram data to
a simple data frame and apply a couple of tricks to get an appropriate
data frame for the box plot data.

# Cast x into a data frame
DF0 <- data.frame(x = rnorm(1000,mean=0,sd=1))


wheat1 = rnorm(100,mean=0,sd=1)
wheat2 = rnorm(150,mean=0,sd=2)
tomatos3 = rnorm(200,mean=0,sd=3)
tomatos4 = rnorm(250,mean=0,sd=4)
cucumbers5 <- rnorm(300,mean=0,sd=5)
cucumbers6 <- rnorm(400,mean=0,sd=6)

# commodity is defined so that products are paired
DF1 <- data.frame(
   commodity = factor(rep(c("wheat", "tomatos", "cucumbers"), c(250, 450, 
700))),
   product = factor(rep(c("wheat1", "wheat2", "tomatos3", "tomatos4",
  "cucumbers5", "cucumbers6"),
times = c(100, 150, 200, 250, 300, 400))),
   value = c(wheat1, wheat2, tomatos3, tomatos4, cucumbers5, cucumbers6) )

library(ggplot2)

# Simple histogram with ggplot2
p0 <- ggplot(DF0, aes(x = x)) + geom_histogram()

# Paired box plots by commodity
p1 <- ggplot(DF1, aes(x = product, y = value)) +
   geom_boxplot() +
   facet_wrap( ~ commodity, scales = "free_x", ncol = 3)

# gridExtra lets you combine multiple grid graphics plots together
# (ggplot2 and lattice are both written in grid)
library(gridExtra)
grid.arrange(p0, p1, nrow = 2)   # stack histogram on top of boxplots
grid.arrange(p0, p1, nrow = 1)   # what you asked for

I prefer the former, but it's easy enough to fix the problems with the latter.

Dennis



On 5/3/2013 6:07 PM, David Winsemius wrote:

On May 3, 2013, at 3:21 PM, Sarah Goslee wrote:


Hi Aldi,

You might want
?layout
instead.


Indeed. In particular a matrix argument might be:

matrix(c(1,2,3, 4,4,4)



Sarah

On Fri, May 3, 2013 at 5:54 PM, Aldi Kraja  wrote:

Hmm,
I had a typo paste by mistake in my x vector
It has to be:

x<-rnorm(1000,mean=0,sd=1)
wheat1<-rnorm(100,mean=0,sd=1)
wheat2<-rnorm(150,mean=0,sd=2)
tomatos3<-rnorm(200,mean=0,sd=3)
tomatos4<-rnorm(250,mean=0,sd=4)
cucumbers5<-rnorm(300,mean=0,sd=5)
cucumbers6<-rnorm(400,mean=0,sd=6)
par(mfrow=c(1,2))

hist(x, main="Left screen OK")

boxplot(wheat1,wheat2,tomatos3,tomatos4,cucumbers5,cucumbers6)

I think you will need a separate call to boxplot for each grouping. The 
`boxplot` function will nto be able to access the device specifications.





--

Aldi T. Kraja, DSc, PhDa...@dsgmail.wustl.edu
Research Associate Professor of Genetics
Division of Statistical Genomics http://dsgweb.wustl.edu/aldi
Washington University School of Medicine,Phone:(314)362-2498 
Fax:(314)362-4227
 Forest Park Blvd., Campus Box 8506   Saint Louis, MO, 63110
___
The materials contained in this e-mail are private and confidential and are the 
property  of the sender. If you are not the intended recipient, be advised that 
any unauthorized use, disclosure, copying, distribution, or the taking of any 
action in reliance on the contents of this information is strictly prohibited. 
If you have received this e-mail transmission in error, please immediately 
notify the sender.

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


Re: [R] how to deal with continous and Non continuous mixed variables in factor analysis?

2013-05-11 Thread Aldi Kraja

Hi,

The continues variables can be handled easy via factanal function.
?factanal
Binary or ordinal variables can be handled via ltm package, which 
implements item response theory.

?ltm

Hope this helps.

Aldi

On 5/11/2013 8:06 PM, Klot Lee wrote:

hi,
when I am doing factor analysis, there is continous and Non continuous
variables(classified variables). Does "psych" package handle this?  Is
there any difference between continous variables and non ones or mixed ones
when doing factor analysis? If there is, which packages should I use then?

My data look like this:

a01   a02   a03   a04   a05
14.7  11.9  0.990  4
20.1   5.5   0.98   1  3
11.6   1.9   0.980  7
54.3   5.7  0.360  5
..

variable a01, a02, a03 is continuous and a04, a05 is Non continuous. when I
do factor analysis by psych package, the results is not good enough, so is
there some method handle data like this?



Thanks.

klot

[[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] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Aldi Kraja

Hi,
Using R 2.15.1 on Windows 7. Have installed both versions 32 and 64bit.
In both of them among others I have installed a package rgenoud
When I open R gui of 32bit and write library(rgenoud) it responds by 
showing a functional rgenoud version  5.7-8. The same it does on Rgui 
64bit.


Now I am working in cygwin (v. 1.12.4.0) with xwin. Normally before when 
I had installed a package, I only had to call the library with the name 
of the package and R will find the right one to load.


Now when I apply R CMD BATCH script1.R out1.txt, under cygwin the first 
thing it reports:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
After some generalities it reports
>library(rgenoud)
Error in library(rgenoud) : there is no package called 'rgenoud'
Execution halted

So my question is why under cygwin in a batch mode, it does not find the 
installed package, which is already installed in my laptop's R?


Thank you in advance,

Aldi

__
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] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Aldi Kraja

Thank you Duncan,

No I did not install R from cygwin. R is installed with windows 7.
I am calling R with a symbolic link from /usr/bin part of cygwin paths, 
but my symbolic link is pointing to /usr/bin/R -> 
/cygdrive/d/RHome/bin/R.exe


Is it possible R is lost in forward paths recognized by cygwin?

You are right I need to test further. Thought someone would have had 
this experience and a solution from previous work.


Aldi

On 10/16/2012 11:51 AM, Duncan Murdoch wrote:

On 16/10/2012 12:41 PM, Aldi Kraja wrote:

Hi,
Using R 2.15.1 on Windows 7. Have installed both versions 32 and 64bit.
In both of them among others I have installed a package rgenoud
When I open R gui of 32bit and write library(rgenoud) it responds by
showing a functional rgenoud version  5.7-8. The same it does on Rgui
64bit.

Now I am working in cygwin (v. 1.12.4.0) with xwin. Normally before when
I had installed a package, I only had to call the library with the name
of the package and R will find the right one to load.

Now when I apply R CMD BATCH script1.R out1.txt, under cygwin the first
thing it reports:

R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
After some generalities it reports
  >library(rgenoud)
Error in library(rgenoud) : there is no package called 'rgenoud'
Execution halted

So my question is why under cygwin in a batch mode, it does not find the
installed package, which is already installed in my laptop's R?


I think you'll need to debug this yourself, since you haven't given us 
much to work with.  My guess would be that you have a different path 
so you're finding a different R, but it could be something else.  (You 
aren't using the R distributed by Cygwin, are you?  That one doesn't 
work.  I don't know who put it into the Cygwin distribution, but they 
obviously didn't test it.)


Duncan Murdoch


__
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] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Aldi Kraja
Thank you Richard and Jeff,
There is a difference in the reporting of extra packages in 32bit 64bit, 
see following:
32bit although it does not report the extra package when I call it with 
Rgui it has the rgenoud.
Instead 64bit Rgui it reports that extra package of rgenoud.

More info follows: (in cygwin)
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods base
 > library(rgenoud)
Error in library(rgenoud) : there is no package called 'rgenoud'
Execution halted

*More info in windows:**(64 bit)*
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] rgenoud_5.7-8

*More info in windows (32 bit):*
 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

 > library(rgenoud)
##  rgenoud (Version 5.7-8, Build Date: 2012-06-03)
##  See http://sekhon.berkeley.edu/rgenoud for additional documentation.
##  Please cite software as:
##   Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
##   ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
##   Journal of Statistical Software, 42(11): 1-26.
##

 >




On 10/16/2012 12:23 PM, Richard M. Heiberger wrote:
> I would guess that you installed rgenoud as user, not as 
> administrator.  That would put the
> file inside
> c:/Users/YourName/AppData/Local/VirtualStore/Program Files/R
> instead of where you think it is.  I can imagine that could easily 
> cause confusion.
>
> Rich
>
> On Tue, Oct 16, 2012 at 1:14 PM, Aldi Kraja  <mailto:a...@wustl.edu>> wrote:
>
> Thank you Duncan,
>
> No I did not install R from cygwin. R is installed with windows 7.
> I am calling R with a symbolic link from /usr/bin part of cygwin
> paths, but my symbolic link is pointing to /usr/bin/R ->
> /cygdrive/d/RHome/bin/R.exe
>
> Is it possible R is lost in forward paths recognized by cygwin?
>
> You are right I need to test further. Thought someone would have
> had this experience and a solution from previous work.
>
> Aldi
>
> On 10/16/2012 11:51 AM, Duncan Murdoch wrote:
>
> On 16/10/2012 12:41 PM, Aldi Kraja wrote:
>
> Hi,
> Using R 2.15.1 on Windows 7. Have installed both versions
> 32 and 64bit.
> In both of them among others I have installed a package
> rgenoud
> When I open R gui of 32bit and write library(rgenoud) it
> responds by
> showing a functional rgenoud version  5.7-8. The same it
> does on Rgui
> 64bit.
>
> Now I am working in cygwin (v. 1.12.4.0) with xwin.
> Normally before when
> I had installed a package, I only had to call the library
> with the name
> of the package and R will find the right one to load.
>
> Now when I apply R CMD BATCH script1.R out1.txt, under
> cygwin the first
> thing it reports:
>
> R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
> After some generalities it reports
>   >library(rgenoud)
> Error in library(rgenoud) : there is no package called
> 'rgenoud'
> Execution halted
>
> So my question is why under cygwin in a batch mode, it
> does not find the
> installed package, which is already installed in my
> laptop's R?
>
>
> I think you'll need to debug this yourself, since you haven't
> given us much to work with.  My guess would be that you have a
> different path so you're finding a different R, but it could
> be something else.  (You aren't using the R distributed by
> Cygwin, are you?  That one doesn't work.  I don't know who put
> i

Re: [R] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Aldi Kraja
Here follows also the Sys.getenv():
R Windwos 32bit Rgui run:
==

R_HOME

"D:/RHome"

R_LIBS_USER

"C:\\Users\\aldi\\Documents/R/win-library/2.15"

R_USER

"C:\\Users\\aldi\\Documents"


R cygwin run:
===

 > Sys.getenv()

"/usr/bin/R"

BIBINPUTS

".;;D:/RHome/share/texmf/bibtex/bib;"

BSTINPUTS

".;;D:/RHome/share/texmf/bibtex/bst;"

R_ARCH

"/i386"

R_BZIPCMD

"bzip2"

R_DOC_DIR

"D:/RHome/doc"

R_GZIPCMD

"gzip"

R_HOME

"D:/RHome"

R_INCLUDE_DIR

"D:/RHome/include"

R_LIBS_USER

"D:\\cygwin\\home\\aldi/R/win-library/2.15"

R_OSTYPE

"windows"

R_PAPERSIZE

"a4"

R_RD4PDF

"times,inconsolata,hyper"

R_SHARE_DIR

"D:/RHome/share"

R_UNZIPCMD

"unzip"

R_USER

"D:\\cygwin\\home\\aldi"

R_ZIPCMD

"zip"

SESSIONNAME

"Console"

SHELL

"/bin/bash"

TEXINPUTS

".;;D:/RHome/share/texmf/tex/latex;"

 > library(rgenoud)

Error in library(rgenoud) : there is no package called 'rgenoud'

Execution halted


Thanks,

Aldi


On 10/16/2012 12:33 PM, Aldi Kraja wrote
> Thank you Richard and Jeff,
> There is a difference in the reporting of extra packages in 32bit 64bit,
> see following:
> 32bit although it does not report the extra package when I call it with
> Rgui it has the rgenoud.
> Instead 64bit Rgui it reports that extra package of rgenoud.
>
> More info follows: (in cygwin)
>   > sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods base
>   > library(rgenoud)
> Error in library(rgenoud) : there is no package called 'rgenoud'
> Execution halted
>
> *More info in windows:**(64 bit)*
>   > sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods base
>
> other attached packages:
> [1] rgenoud_5.7-8
>
> *More info in windows (32 bit):*
>   > sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods base
>
>   > library(rgenoud)
> ##  rgenoud (Version 5.7-8, Build Date: 2012-06-03)
> ##  See http://sekhon.berkeley.edu/rgenoud for additional documentation.
> ##  Please cite software as:
> ##   Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
> ##   ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
> ##   Journal of Statistical Software, 42(11): 1-26.
> ##
>
>   >
>
>
>
>
> On 10/16/2012 12:23 PM, Richard M. Heiberger wrote:
>> I would guess that you installed rgenoud as user, not as
>> administrator.  That would put the
>> file inside
>> c:/Users/YourName/AppData/Local/VirtualStore/Program Files/R
>> instead of where you think it is.  I can imagine that could easily
>> cause confusion.
>>
>> Rich
>>
>> On Tue, Oct 16, 2012 at 1:14 PM, Aldi Kraja > <mailto:a...@wustl.edu>> wrote:
>>
>>  Thank you Duncan,
>>
>>  No I did not install R from cygwin. R is installed with windows 7.
>>  I am calling R with a symbolic link from /usr/bin part of cygwin
>>  paths, but my symbolic link is pointing to /usr/bin/R ->
>>  /cygdrive/d/RHome/bin/R.exe
>>
>>  Is it possible R is lost in forward paths recognized by cygwin?
>>
>>  You are right I need to test further. Thought someone would have
>>  had this experience and a solution from previous work.
>>
>>  Aldi
>>
>>  On 10/16/2012 11:51 AM, Duncan Murdoch wrote:
>>
>>  On 16/10/2012 12:41 PM, Aldi Kraja wrote:
>>
>>  Hi,
>>  Using R 2.15.1 on Windows 7. Have installed both versions
>>  32 a

Re: [R] Windows 7 R (32/64bit) running under cygwin: package not found

2012-10-16 Thread Aldi Kraja

Thank you all including Bert,

In my opinion the library() when is working in cygwin env., does not 
check the additional libraries, where R installed the additional packages.


So the solution for this problem was to define manually in my programs 
where is located the library of additional packages:
(although I was expecting library() itself to know about the additional 
packages


library('rgenoud',lib.loc='C:/Users/aldi/Documents/R/win-library/2.15')
This solved the problem. Now R works again in cygwin. :-)

Thanks,

Aldi

On 10/16/2012 1:19 PM, Bert Gunter wrote:

I do not think that this has anything to do with the issue at hand,
but just to clarify ...

On Tue, Oct 16, 2012 at 10:18 AM, Jeff Newmiller
 wrote:

Probably because when you run it from Cygwin the R_LIBS variable does not point 
to the user and install library directories. I don't know how Rgui knows where 
they are (registry?)

R for Windows need not use the registry at all, and does so optionally
for just a couple of minor issues. See the R for WIndows FAQ 2.17 for
details.

?library
?.libPaths

describe how R sets/gets library paths (including defaults).

Cheers,
Bert



but you can look in the .Library and .Library.site variables to see the results.



In a case like this, posting your sessionInfo() for each case is highly 
recommended.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

Aldi Kraja  wrote:


Hi,
Using R 2.15.1 on Windows 7. Have installed both versions 32 and 64bit.
In both of them among others I have installed a package rgenoud
When I open R gui of 32bit and write library(rgenoud) it responds by
showing a functional rgenoud version  5.7-8. The same it does on Rgui
64bit.

Now I am working in cygwin (v. 1.12.4.0) with xwin. Normally before
when
I had installed a package, I only had to call the library with the name

of the package and R will find the right one to load.

Now when I apply R CMD BATCH script1.R out1.txt, under cygwin the first

thing it reports:

R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
After some generalities it reports

library(rgenoud)

Error in library(rgenoud) : there is no package called 'rgenoud'
Execution halted

So my question is why under cygwin in a batch mode, it does not find
the
installed package, which is already installed in my laptop's R?

Thank you in advance,

Aldi





__
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] 300 dpi and eps:

2010-12-14 Thread Aldi Kraja

Hi,

I have a run of 5 graphs that I want to place them under the same page.
Everything works fine to place them in a pdf file , or eps file, but 
when it comes to have a high quality of
300 dpi these graphs are not good. For example I open the eps file with 
Adobe Illustrator (AI) and it shows that it is a 72dpi graph. If I start 
with a 72dpi graph AI cannot improve this to 300 dpi. Q: HOW CAN A GRAPH 
IN R DIRECTLY SAVED AS 300dpi? What options do I need to add to the 
postscript function to have a 1 page graph that has these 5 plots and is 
a 300 dpi graph? Thank you in advance, Aldi


Here is what I am using right now:
> 
postscript(file='./plotST.eps',paper='special',width=10,height=10,horizontal=FALSE)

> par(mfrow=c(5 ,1))
> plot(sortord , X1 , cex=0.5 ,pch=21 , ylim=c(1.02 , 8.08771 ), 
xlab='ST: 1-5 position (unit)',ylab='ylabel',font.lab = 1, cex.lab = 
1,cex.main=0.5 +0.4, col=chrom )

> text(midpointsbyc+minadj+5,0-5,chnum ,cex=0.5 +0.2 ,col=chnum+1 )
> abline(h = -1*log10(9.7e-08 ), lty = 2,col = 'gray' )
> # Draw the legend
> legend('topright',legend=c('X1'))
> plot(sortord , X2

> # Put a box around the plot
> box(lwd = 1)
> dev.off()

--

__
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] 300 dpi and eps:

2010-12-14 Thread Aldi Kraja

Hi,

I have a run of 5 graphs that I want to place them under the same page.
Everything works fine to place them in a pdf file , or eps file, but 
when it comes to have a high quality of
300 dpi these graphs are not good. For example I open the eps file with 
Adobe Illustrator (AI) and it shows that it is a 72dpi graph. If I start 
with a 72dpi graph AI cannot improve this to 300 dpi. Q: HOW CAN A GRAPH 
IN R DIRECTLY SAVED AS 300dpi? What options do I need to add to the 
postscript function to have a 1 page graph that has these 5 plots and is 
a 300 dpi graph? Thank you in advance, Aldi


Here is what I am using right now:
> 
postscript(file='./plotST.eps',paper='special',width=10,height=10,horizontal=FALSE)

> par(mfrow=c(5 ,1))
> plot(sortord , X1 , cex=0.5 ,pch=21 , ylim=c(1.02 , 8.08771 ), 
xlab='ST: 1-5 position (unit)',ylab='ylabel',font.lab = 1, cex.lab = 
1,cex.main=0.5 +0.4, col=chrom )

> text(midpointsbyc+minadj+5,0-5,chnum ,cex=0.5 +0.2 ,col=chnum+1 )
> abline(h = -1*log10(9.7e-08 ), lty = 2,col = 'gray' )
> # Draw the legend
> legend('topright',legend=c('X1'))
> plot(sortord , X2

> # Put a box around the plot
> box(lwd = 1)
> dev.off()

--

__
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] 300 dpi and eps:

2010-12-15 Thread Aldi Kraja
I have come around several times from R to A. Illustrator, or A. 
photoshop, and between them with PowerPoint. It is possible that the 
last one I reported was from PowerPoint.
So from your postings it was made clear that postscript plot from R 
produces a vector graph.


Can someone recommend some paper that makes clear the relation and 
distinctions between vector and raster graphics, but especially with 
some practical examples in regard to what is the relation between page 
(height and width) and dpi.


For example if I plan to print high resolution graph in an image size of 
the A4 paper (8.5 inch x 11 inch) and from a journal it is required that 
the graph needs to have 300 dpi or more how one tells to the R graphical 
device to produce this setting?


In A. photoshop for example I can define for a graph width in inches, 
height in inches and resolution in pixels/inch color model CMYK and 8 
bit. How one works in R?


Or one saves the graph from postscript function as eps or tiff and you 
tell to the editor of the journal do whatever you want because I am 
done; I provided you already a vector graph that has infinite pixels?:-)


Thank you advance,

Aldi

On 12/15/2010 3:52 AM, Rainer M Krug wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/15/2010 09:31 AM, Philipp Pagel wrote:

Everything works fine to place them in a pdf file , or eps file, but
when it comes to have a high quality of 300 dpi these graphs are not
good. For example I open the eps file with Adobe Illustrator (AI)
and it shows that it is a 72dpi graph.

This is simply not true: it's an eps and thus of essentually infinite
resolution for all practial purposes.

Just to clarify this: eps / ps are vector formats - i.e. it says in the
file "draw a line from point x to point y". In contrast, bmp (and e.g.
jpg, png, tiff) are raster formats: in these formats save the PICTURE of
the line from point x to y.
Consequently, only raster formats have dpi ("dots" per inch).


So your problem is not with
the R-generated eps but somewhere downstream from that. Any
postprocessing, conversion or editing?

Or in Adobe illustrator? It strikes me, that 72dpi is usually the screen
resolution.

Cheers,

Rainer


cu
Philipp



- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation

Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:+33 - (0)9 53 10 27 44
Cell:   +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:  rai...@krugs.de

Skype:  RMkrug
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk0Ij8gACgkQoYgNqgF2egolFwCfbcSKiB4xyc7B/mOzdRRu2/dr
iOEAn1KoMR1C4RgYuRRIixUVtLbXN1zE
=W0bk
-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-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] 300 dpi and eps:

2010-12-15 Thread Aldi Kraja

Thank you Jeff for your advice,
Maybe it was better my email subject to had been "high quality R graphs 
for publication" instead of "300 dpi and eps".


a. In my latest response I was asking for any published paper/book 
(written by anybody in the R list) that describes how R handles vector 
graphs and raster graphs. Must be technical that Jeff did not like it. 
See the end of this email for a suggestion.


But let's come to a more practical question:

b. I was asking also how one handles in R the relation between page 
height, page width and pixels per unit.


For example I find from the discussion list different responses:

"EPS is perfectly acceptable in Word on a PC. The only proviso is that, 
as has been mentioned, Word will only display a low resolution bitmap 
"preview" of EPS image in the document on screen whilst editing. When 
printed to a postscript printer or converted to PDF via something like 
Distiller or via publishers' online submission tools, the figure will be 
in the best possible quality." (Simpson).


"For publication, it would be rare to want to use a bitmapped format 
such as jpg/png, pdf and eps are vector based formats and would be 
generally preferred over the above." (Schwartz)


The practical response I found for point b) is the following (by Wiley 
responding to someone else question):
"You have set the resolution, but you have not set the width/height. The 
res argument generally controls how many pixels per inch (PPI which is 
often used similarly to DPI). So if you want 800 DPI and you want it to 
be a 4 x 4 inch graph something like: tiff(file = "temp.tiff", width = 
3200, height = 3200, units = "px", res = 800); plot(1:10, 1:10); 
dev.off(); This will make a file that is 3200 x 3200 pixels, with an 800 
resolution gives you 3200/800 = 4 inches. I would also recommend 
choosing some sort of compression or you will end up with a rather large 
file."


So I come back to R tiff() function and see this example:
tiff(filename = "Rplot%03d.tif", width = 480, height = 480, units = 
"px", pointsize = 12, compression = c("none", "rle", "lzw", "jpeg", 
"zip"),  that reminds also for the compression importance for large 
graphs produced.


Following Wiley's example, if I use res=300 then I get 3200/300=10.7 
inches for the size of the graph. So I wanted to see how Jeff or other 
listers handle these graph manipulations in R? Why width and height have 
to be the same size based on these examples? What happens if the paper 
is 8.5i. x 11i., what do you do? What is the best advice how to produce 
in R graphs that can be acceptable for publications?


There are many good examples in R News for papers that explain best 
different aspects of plotting, but I would suggest someone competent in 
this area write a great paper to explain technicalities of "how to 
create a high quality R graph for publication" if this does not exist.


TIA,

Aldi

On 12/15/2010 10:24 AM, Jeff Newmiller wrote:

It is possible to embed a raster image inside eps, but AFAIK R does not do 
this. Other than that, your questions do not apply to eps. Rendering resolution 
only comes into play when you put it into a raster software (like photoshop) or 
print it.

Beyond that, we don't know what you are doing with the file after R generates 
it, and this is not a digital publishing mailing list so this isn't the right 
forum to continue this discussion.

"Aldi Kraja"  wrote:


I have come around several times from R to A. Illustrator, or A.
photoshop, and between them with PowerPoint. It is possible that the
last one I reported was from PowerPoint.
So from your postings it was made clear that postscript plot from R
produces a vector graph.

Can someone recommend some paper that makes clear the relation and
distinctions between vector and raster graphics, but especially with
some practical examples in regard to what is the relation between page
(height and width) and dpi.

For example if I plan to print high resolution graph in an image size
of
the A4 paper (8.5 inch x 11 inch) and from a journal it is required
that
the graph needs to have 300 dpi or more how one tells to the R
graphical
device to produce this setting?

In A. photoshop for example I can define for a graph width in inches,
height in inches and resolution in pixels/inch color model CMYK and 8
bit. How one works in R?

Or one saves the graph from postscript function as eps or tiff and you
tell to the editor of the journal do whatever you want because I am
done; I provided you already a vector graph that has infinite
pixels?:-)

Thank you in advance,

Aldi

On 12/15/2010 3:52 AM, Rainer M Krug wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 12/15/2010 09:31 AM, Philipp Pagel wrote:

Everything works fine to place them in a pdf file , or eps file,

b

Re: [R] barplot with errorbars

2011-02-17 Thread Aldi Kraja
Hi Toby and Maria,

I did a check on Toby's suggestion and it is not there:

R version 2.12.1 (2010-12-16)
 > ??barploterrbar
No help files found with alias or concept or title matching
'barploterrbar' using fuzzy matching.

Also I went to the following location which does not exist.
http://www.dkfz.de/abt0840/whuber

To Maria: here is a suggestion: to do the barplot with confidence 
intervals / errorbars:

look at the following R news under www.r-project.org
"An introduction to using R's base graphics." (see following citation)
on page 4 you will find explanations and code how to build bars with se.

[62]Marc Schwartz. R Help Desk: An introduction to using R's base 
graphics. /R News/, 3(2):2-6, October 2003. [ bib | http 
 | .pdf 
 ]


HTH,

Aldi

On 2/17/2011 10:08 AM, Toby Marthews wrote:
> If you google "barplot with error bars" you immediately find 
> http://svitsrv25.epfl.ch/R-doc/library/prada/html/barploterrbar.html .
> Toby.
>
> 
> From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf 
> Of Lathouri, Maria [m.lathour...@imperial.ac.uk]
> Sent: 17 February 2011 16:00
> To: r-help@r-project.org
> Subject: [R] barplot with errorbars
>
> Dear all
>
> I have six variables of the average metal concentrations
>
> Var1 4.77
> Var2 23.5
> Var3 5.2
> Var4 12.3
> Var5 42.1
> Var6 121.2
>
> I want to plot them as a barplot with error bars. Could you help me?
>
> Cheers
> Maria
>
>
>

-- 



[[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] lm with a single X and step with several Xi-s, beta coef. quite different:

2012-08-07 Thread Aldi Kraja

Hi, (R version 2.15.0)
I am running a pgm with 1 response (earlier standardized Y) and 44 
independent vars (Xi) from the same data =a2:
When I run the 'lm' function on single Xi at a time, the beta 
coefficient for let's say X1 is = -0.08 (se=0.03256)
But when I run the same Y with 44 Xi-s with the 'step' function (because 
I left direction parameter empty, I assume a backward multiple reg is 
implemented), 12 Xia-a remain in the final model where X1 is still 
present, the X1 beta coefficient becomes = --0.43402 (se=0.06847)


I did not expect such a drastic change (4 times smaller) in the beta 
coeff. from "lm" with X1 (bx1=-0.08) to "step" with final 12 Xis 
including X1 (bx1=--0.43402).
I understand that step function is producing partial reg coeff, when all 
other Xi-s are held constant, but is there any good reason why X1 in a 
multivariate reg. can become so significant (from lm px1=0.00296 ** to 
step px1=2.55e-10 ***)?


Some of the 44 Xi-s are correlated to each other, but I am hoping that 
stepwise reg will drop some of those correlated ones.
The Xi-s represent variables coded numerically as 0,1,2 to apply a 
linear regression on them.

For example the frequency of X1 is:
[1] x1
Levels: x1
0 1 2
3459 985 96

output of lm(Y ~ X1):
==
> obj1<-lm(y ~ x1, data=a2)
> summary(obj1)

Call:
lm(formula = y ~ x1, data = a2)

Residuals:
Min 1Q Median 3Q Max
-3.3418 -0.7240 -0.0462 0.6577 4.2929

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.03635 0.01781 2.042 0.04124 *
x1 -0.09682 0.03256 -2.973 0.00296 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.024 on 4255 degrees of freedom
Multiple R-squared: 0.002074, Adjusted R-squared: 0.001839
F-statistic: 8.842 on 1 and 4255 DF, p-value: 0.002961

output from the step function on 44 Xi-s:

a2 <-na.omit(ac16g761[,3:(44+2+1)])
lm.a2<-lm(y ~ ., data=a2)
lm.final <-step(lm.a2,trace=F)
summary(lm.final)
Call:
lm(formula = y ~ x1 + x2 +
x3 + x4 + x5 + x6 + x7 + x8 +
x9 + x10 + x11 + x12, data = a2)

Residuals:
Min 1Q Median 3Q Max
-3.2955 -0.7210 -0.0611 0.6623 4.1064

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.01065 0.02637 0.404 0.686412
x1 -0.43402 0.06847 -6.339 2.55e-10 ***
x2 -0.17109 0.11370 -1.505 0.132464
x3 0.23552 0.11552 2.039 0.041533 *
x4 -0.19898 0.10133 -1.964 0.049625 *
x5 0.06653 0.03796 1.752 0.079769 .
x6 0.18319 0.08592 2.132 0.033070 *
x7 -0.17443 0.05095 -3.424 0.000624 ***
x8 0.24013 0.06516 3.685 0.000232 ***
x9 0.19202 0.08009 2.398 0.016543 *
x10 -0.17257 0.05576 -3.095 0.001983 **
x11 -0.23537 0.05704 -4.126 3.75e-05 ***
x12 0.25992 0.06260 4.152 3.35e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.02 on 4244 degrees of freedom
Multiple R-squared: 0.01353, Adjusted R-squared: 0.01074
F-statistic: 4.851 on 12 and 4244 DF, p-value: 5.466e-08

Thank you in advance,

Aldi

P.S. Sorry that I cannot distribute these data for a test.

--

__
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] Error: ReadItem: unknown type 98, perhaps written by later version of R

2012-08-21 Thread Aldi Kraja

Hi,

I am running a large number of jobs (thousands) in parallel (linux OS 
64bit), R version 2.14.1 (2011-12-22), Platform: x86_64-redhat-linux-gnu 
(64-bit). Up to yesterday everything ran fine with jobs in several 
blocks (block1, block2 etc) of submission. They are sent to an LSF 
platform to handle the parallel submission. Today I see that only one of 
the blocks (the 19) has not finished correct:

It reports in the out file:

Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Checking through google one had recommended rm ~/.RData
I applied it, but the run again fails, when submitting through SAS for 
block 19.


[SAS in macro lang.] %sysexec bsub R CMD BATCH &fullpath./dc19at&j..R 
&fullpath.dc19at&j..out ;

[SAS ] %sysexec sleep 3 ;
  

If I go to the directory where the R program and the data reside and 
apply the same command by hand


R CMD BATCH dc19at1.R dc19at1.out
it works with no problem.

But if I use a similar program (SAS program)

that has been executing the same command successfully for thousand of 
jobs in other blocks, the jobs for the block 19 fail.


Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

even in the one I just mentioned if I execute by hand goes well.

Do you know what could be the cause of bsub submission to fail? Any remedy?

Thank you in advance,

Aldi

--

__
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] Error: ReadItem: unknown type 98, perhaps written by later version of R

2012-08-22 Thread Aldi Kraja

Hi,

Here is a solution for this type of error:
Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Created a script file under the directory where the pgm-s and data 
reside and ran there


./script.sh

where script.sh had the following lines
R CMD BATCH ./dc19at1.R ./dc19at1.out
sleep 3
R CMD BATCH ./dc19at2.R ./dc19at2.out
sleep 3
...
etc

The programs ran with no problem.

So what I did is eliminated the full path let's say
R CMD BATCH /a/b/c/dc19at1.R /a/b/c/dc19at1.out
which did not work through bsub or at the command line in a remote server.

I am not sure what is the "type 98 error" meaning in R?
Anybody knows where the R error types are described?

TIA,

Aldi

On 8/21/2012 10:09 AM, Aldi Kraja wrote:

Hi,

I am running a large number of jobs (thousands) in parallel (linux OS 
64bit), R version 2.14.1 (2011-12-22), Platform: 
x86_64-redhat-linux-gnu (64-bit). Up to yesterday everything ran fine 
with jobs in several blocks (block1, block2 etc) of submission. They 
are sent to an LSF platform to handle the parallel submission. Today I 
see that only one of the blocks (the 19) has not finished correct:

It reports in the out file:

Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Checking through google one had recommended rm ~/.RData
I applied it, but the run again fails, when submitting through SAS for 
block 19.


[SAS in macro lang.] %sysexec bsub R CMD BATCH &fullpath./dc19at&j..R 
&fullpath.dc19at&j..out ;

[SAS ] %sysexec sleep 3 ;
  

If I go to the directory where the R program and the data reside and 
apply the same command by hand


R CMD BATCH dc19at1.R dc19at1.out
it works with no problem.

But if I use a similar program (SAS program)

that has been executing the same command successfully for thousand of 
jobs in other blocks, the jobs for the block 19 fail.


Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

even in the one I just mentioned if I execute by hand goes well.

Do you know what could be the cause of bsub submission to fail? Any 
remedy?


Thank you in advance,

Aldi

--

__
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] Error: ReadItem: unknown type 98, perhaps written by later version of R

2012-08-23 Thread Aldi Kraja
Thanks to Martin who send an email off the list with among others the 
following:


"Probably the file is being corrupted on disk, perhaps it has not yet 
been closed before reading is attempted, or some other obscure file 
system issue. Probably the key part in your script is 'sleep', which 
probably slows disk access enough for your file system to recover 
integrity."


His note made me think that something can be with the programs running 
in parallel in the same processing server:


There are up to 8 slots for running in parallel 8 jobs in a Linux 
server. Many servers are available.
Each job is working with unique file names for R and the corresponding 
out files, and also all the objects inside the each R job are defined 
unique with their own indices, and I finish the program with q(); n for 
not saving the R space at the end of each process.


Let me draw a parallel thinking with SAS jobs. If I run a 8 parallel job 
in SAS, SAS although it will use the /tmp directory of that processing 
server, each job will have its own pid and they are built unique in 
their run and uniquely saving temp data and removed at the end. So 8 
parallel jobs in a server and  more from different servers, they do not 
corrupt each others data.


Now what happens with R? Eight jobs are in parallel, are they processed 
in unique spaces of the /tmp harddrive, or all write to ~/.RData ? If 
the last happens although they are uniquely defined, it is quite 
possible that in the ~/.RData something is happening with reported error:


Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Probably --no-restore --no-save may help, but isn't that dangerous if 
all programs (if I have 1000 of them) write all to ~/.RData? So how R 
handles parallel jobs of the same user in regard to the R invocation and 
space used for temporary calculations. Do these parallel batch R jobs 
see each other in the same space or are they for sure in independent 
temporary subdirs?


Thanks,

Aldi

On 8/22/2012 3:47 PM, Aldi Kraja wrote:

Hi,

Here is a solution for this type of error:
Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Created a script file under the directory where the pgm-s and data 
reside and ran there


./script.sh

where script.sh had the following lines
R CMD BATCH ./dc19at1.R ./dc19at1.out
sleep 3
R CMD BATCH ./dc19at2.R ./dc19at2.out
sleep 3
...
etc

The programs ran with no problem.

So what I did is eliminated the full path let's say
R CMD BATCH /a/b/c/dc19at1.R /a/b/c/dc19at1.out
which did not work through bsub or at the command line in a remote 
server.


I am not sure what is the "type 98 error" meaning in R?
Anybody knows where the R error types are described?

TIA,

Aldi

On 8/21/2012 10:09 AM, Aldi Kraja wrote:

Hi,

I am running a large number of jobs (thousands) in parallel (linux OS 
64bit), R version 2.14.1 (2011-12-22), Platform: 
x86_64-redhat-linux-gnu (64-bit). Up to yesterday everything ran fine 
with jobs in several blocks (block1, block2 etc) of submission. They 
are sent to an LSF platform to handle the parallel submission. Today 
I see that only one of the blocks (the 19) has not finished correct:

It reports in the out file:

Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

Checking through google one had recommended rm ~/.RData
I applied it, but the run again fails, when submitting through SAS 
for block 19.


[SAS in macro lang.] %sysexec bsub R CMD BATCH &fullpath./dc19at&j..R 
&fullpath.dc19at&j..out ;

[SAS ] %sysexec sleep 3 ;
  

If I go to the directory where the R program and the data reside and 
apply the same command by hand


R CMD BATCH dc19at1.R dc19at1.out
it works with no problem.

But if I use a similar program (SAS program)

that has been executing the same command successfully for thousand of 
jobs in other blocks, the jobs for the block 19 fail.


Error: ReadItem: unknown type 98, perhaps written by later version of R
Execution halted

even in the one I just mentioned if I execute by hand goes well.

Do you know what could be the cause of bsub submission to fail? Any 
remedy?


Thank you in advance,

Aldi

--

__
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://ww

Re: [R] Where to download BRugs

2008-05-22 Thread Aldi Kraja
The BRugs package is maintained by Uwe Ligges. So it is possible he 
forgot to place it in the new version of R/ repositories.


Aldi

Charles Annis, P.E. wrote:

Could you mean RBugs?

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of qqw
Sent: Thursday, May 22, 2008 3:10 PM
To: r-help@r-project.org
Subject: [R] Where to download BRugs


Hi all, I tried to follow an online tutorial to run openBUgs but the package
BRugs has been removed from R repository.

Could someone provide a link for where to download BRugs? 


Thanks a lot!
  


--

__
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] mixed model results from SAS and R

2008-05-22 Thread Aldi Kraja
Hi,
To continue the test of the differences between mixed model SAS (9.1.3) 
and lme (R 7.0), I removed the intercept of the random effect in the R 
case. In that case lme is showing that beta coefficients are almost all 
of them identical (-0.08424262) and somehow all of them are spread along 
the plot of the coefficients axes (!!!) which surprises me. Unless the 
authors of lme use jittering of the points. Is lme having a bug in this 
case? I know that the "a1" data are not very good. If one looks at  the 
distribution of the residuals they are not beautifully iid. But lme had 
to detect this problem of random beta-s being almost identical and close 
to zero. In addition is there any new development on mixed models in R 
for the quantitative traits that is not covered by lme package, but can 
help to understand this case?

fm2nidl.lme<-lme(nidl~time,data=a1,random=~time-1 | sub)
plot(coef(fm2nidl.lme))
print(coef(fm2nidl.lme))
anova(fm1nidl.lme,fm2nidl.lme)
Model df  AIC  BIClogLik   Test L.Ratio p-value
fm1nidl.lme 1  6 4982.150 5009.958 -2485.075  
fm2nidl.lme 2  4 5069.081 5087.619 -2530.540 1 vs 2 90.9309  <.0001

R output (contd.)

(Intercept)time
1  7.782863 -0.08424262
2  7.782863 -0.08424262
3  7.782863 -0.08424262
4  7.782863 -0.08424262
5  7.782863 -0.08424262
6  7.782863 -0.08424262
7  7.782863 -0.08424262
8  7.782863 -0.08424262
9  7.782863 -0.08424262
10 7.782863 -0.08424262
...

Thank you in advance for any insights,

Aldi


[EMAIL PROTECTED] wrote:
> Hi,
>
> I was wondering if there is a way to figure out why in SAS random beta
> coefficients are 0 vs. in R the beta-s are non zero.
> The variables of the data are nidl, time, and sub (for subject). Time and
> nidl are continuous variables. I am applying random coefficients model.
> Any input is greatly appreciated, Thanks, Aldi
>
> 1. mixed model in SAS:
> ==
> ods output SolutionR = out1.randomnidltest2;
> proc mixed data = a1 ;
>   class sub ;
>   model nidl = time /  solution  ;
>   random int time /  sub = sub solution;
> run;
> ods output close;
>
> 2. mixed model in R:
> 
> a1<-read.table(file="c:\\aldi\\a1.txt",sep=",",header=T)
> library(nlme)
> fm1nidl.lme<-lme(nidl~time,data=a1,random=~time | sub)
> plot(coef(fm1nidl.lme))
>
>
> 3. SAS output:
> ==
>Plot of nidl*time.  Symbol used is '*'.
>
>   40 ^
>  ,
>  ,*
>  ,
>  ,*
>  ,*   *
>  ,*  *
>  ,*  *  *
>   20 ^*  *   *
>  ,*  *
>  ,*  ** **
>  ,* ***   *
>  ,* *** **  *
>  ,** ** *
>  ,* ** **
>  ,*   * *** *  *
>0 ^*   *    *
>  -^---^^^
>   0   25   50   75
>
> time
> NOTE: 684 obs hidden.
> Dimensions
> Covariance Parameters 3
> Columns in X  2
> Columns in Z Per Subject  2
> Subjects425
> Max Obs Per Subject   2
>   Number of Observations
> Number of Observations Read 763
> Number of Observations Used 763
> Number of Observations Not Used   0
>  Covariance Parameter Estimates
> Cov Parm  SubjectEstimate
>
> Intercept sub 17.1773
> time  sub   0
> Residual  27.0023
> The Mixed Procedure
>
>Fit Statistics
>
> -2 Res Log Likelihood  5005.5
> AIC (smaller is better)5009.5
> AICC (smaller is better)   5009.5
> BIC (smaller is better)5017.6
>
>
>Solution for Fixed Effects
>
>  Standard
> Effect   Estimate   Error  DFt ValuePr > |t|
>
> Intercept  7.7608  0.3214 424  24.15  <.0001
> time -0.08148 0.01605 337  -5.08  <.0001
>
>
>   Solution for Random Effects
>
>  Std Err
> Effect   subEstimatePred  DFt ValuePr > |t|
>
> Intercept  1  5.6722  3.2426   0   1.75   .
> time   1   0   .   .. .
> Intercept  2  3.6722  3.2426   0   1.13   .
> time   2   0   .   .. .
> Intercept  3 -2.0774  2.7539   0  -0.75   .
> time   3   0   .   .. .
>
> ...  ...  ...   ...
>
> R output:
> (Intercept)  time
> 1 17.432680 -0.3155496745
> 2 14.024527 -0.2345787274
> 3  3.105323  0.0469759240
> 4 23.047062 -0.5565796200
> 5 10.708267 -0.1557909941
> ... ... ...
>   
>> s

[R] 16 digits and beyond? R64-bit a solution?

2009-02-06 Thread Aldi Kraja

Hi,

I am working with some extremely small p-values and I want to capture 
the corresponding quantiles.


I see the help file it says:
'qnorm' is based on Wichura's algorithm AS 241 which provides
precise results up to about 16 digits.

What happen after the 16th digits?

If I am running R in a server 64-bit, can that improve the chances that 
beyond 16th digits to still have precision?


Thanks,

Aldi

--

__
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] par and a substitute for mtext to write one time a title per page

2009-03-03 Thread Aldi Kraja

RE: par and a substitute for mtext to write one time a title per page


Hi,
Q1. Is there way I can set mfg =c(2,1) which for me could have meant 2 
pages and no split on the columns per page; and mfrow =c(4,1) which for 
me it means 4 graphs per page in the par function?
So if I have a pdf/png etc file I will output two pages with 4 graphs 
for each, or modifiable depending on the case of data?

I obtain the following:

Error in par(mfg = c(2, 1), mfrow = c(4, 1)) :
 parameter "i" in "mfg" is out of range

steps:
1. open outstream: pdf(file="some_address_and_file.pdf")
2. do the corresponding loop to prepare the graphs for specific data
3. plot 2 or more pages of graphs with 4 graphs per page
4. close the outstream.

Q2: with mtext function I can write in the outter margin including a 
title as a header.
Is there another way to write a title one time per page in these 
multiple graphs, so I can save the graphs space per page?


Thank you in advance,

Aldi

--

__
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] par and a substitute for mtext to write one time a title per page

2009-03-03 Thread Aldi Kraja

Hmm,

Reading some responses in the archives on mfg, the first one was simple 
the mfg does not control the pages.
After removing mfg=c(2,1), and leaving in the program only mfrow=(4,1) 
although I am printing one after the other in a loop, pages are printed 
and do not overwrite the same page.


So by defining mfrow only, one can extend to many pages with no problem.

Q2. Here is a small test program:
x<-rnorm(1000)
y<-rnorm(1000)
par(mfrow=c(2,1))
plot(x,y)
mtext("This is my title",3,line=1)
mtext("This is my title",3,line=2)
mtext("This is my title",3,line=3)
plot(x,y)

Is there a function that can print a title in every one new page outside 
of the space designated for graphs, instead of me finding the first 
graph that starts the page and there using mtext as shown above?


Thanks,

Aldi

Aldi Kraja wrote:

RE: par and a substitute for mtext to write one time a title per page


Hi,
Q1. Is there way I can set mfg =c(2,1) which for me could have meant 2 
pages and no split on the columns per page; and mfrow =c(4,1) which 
for me it means 4 graphs per page in the par function?
So if I have a pdf/png etc file I will output two pages with 4 graphs 
for each, or modifiable depending on the case of data?

I obtain the following:

Error in par(mfg = c(2, 1), mfrow = c(4, 1)) :
 parameter "i" in "mfg" is out of range

steps:
1. open outstream: pdf(file="some_address_and_file.pdf")
2. do the corresponding loop to prepare the graphs for specific data
3. plot 2 or more pages of graphs with 4 graphs per page
4. close the outstream.

Q2: with mtext function I can write in the outter margin including a 
title as a header.
Is there another way to write a title one time per page in these 
multiple graphs, so I can save the graphs space per page?


Thank you in advance,

Aldi

--

__
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] Overlay plot: boxplot and stripchart

2009-03-13 Thread Aldi Kraja

Hi,
I have a data.frame of this kind:
x
obs  movie earned rating
1P1   3.2xx
2P1   4.2xx
3P1   5.2xx
4P1   6.2xx
5P2   3.5xx
6P2   6.5xx
7P2   7.5xx
8P2   4.5xx
9P2   4.5xx
10   P3   4.8x1
11   P4   7.3x2
12   P4   3.2x2
13   P4   3.3x2
I want to overlay the following boxplot and stripchart. I think that I 
had seen before in a discussion a thread about stripchart in R (maybe 
from Dalgaard), but although searching for it I couldn't find it.


boxplot(x$earned ~ x$movie)
stripchart(x$earned ~ x$movie, vertical=T,data=x, method="jitter", pch=19)

Any suggestions are greatly appreciated, otherwise I have to go to 
points function.


Thanks,
Aldi

--

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