[R] cross-nested random structure in glmmPQL

2013-08-09 Thread Carina Dinkel
Dear members,
 
I'm trying to fit a GLMM using glmmPQL with a cross-nested random structure. 
Basically, I have perfectly crossed observations of whether there is a relation 
between two people (sender and receiver of relation) and I'd like to do a 
random structure where the relations to an from the same actor are related.
If A and B are the random effects for specific sender and receiver the 
covariance matrix should look like this:
 
sigma_A^2*I  sigma_AB*I
sigma_AB*I   sigma_B^2*I
 
where I is an n x n identity matrix.
The code I have so far has the random structure of:
 
 const -  factor(rep(1, length(data$y)))
 mod - glmmPQL(y ~ as.factor(variableS) + as.factor(variableR),
 random = list(const = 
 pdBlocked(list(pdIdent(~1),pdIdent(~sender-1),pdIdent(~receiver-1,
 data=data, family=binomial)
 
I think this code only leads to a diagonal covariance matrix and doesn't 
consider the covariance sigma_AB I'd like to model. Do you have any suggestions 
how I have to change the random part of my formula in order to get the right 
covariance matrix?

(I've posted this in the mixed models group, too... but maybe in the general 
mailing list someone can help me in any way)
 
Any help is highly appreciated!
 
Thank you,
Carrie

__
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] Plotting zoo objects with chron axis

2013-08-09 Thread Manta
Dear all,

I have a problem which I'm not to fix. I have the following two series:

a=structure(c(33242.5196150509, 34905.8434338503, 38490.6957848689, 
38747.0287172129, 38919.1028597142, 39026.3956586941, 38705.5344288997, 
38545.6274379387, 38651.2079354205, 38748.2769580121), index =
structure(c(14029, 
14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
), class = Date), class = zoo)

b=structure(c(53337.7643740991, 52210.2079727035, 50235.4480363949, 
50667.1147389469, 50796.5403152116, 51113.5420947436, 51003.3603311344, 
50654.0539778796, 49927.5267060329, 49320.1813921822), index =
structure(c(14029, 
14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
), class = Date), class = zoo)

I want to plot them on the same chart, with the x-axis the Date, and the
y-axis the time in format %H:%M. At the moment, the y series is expressed in
seconds from midnight. I am confused with the as.POSIXct conversion.

 hours(min(rollrep))
[1] 9
 minutes(min(rollrep))
[1] 34
 seconds(min(rollrep))
[1] 27

however, by doing the following it seems the minimum time is 11:09, which is
not true.

as.POSIXct(round(min(rollrep)),origin=Sys.Date())
[1] 2013-08-09 11:09:14 CEST

Do you have any advice? Is there a way to plot only the hours and minutes,
without having to go to the Sys.Date?

Thank you,
Marco



--
View this message in context: 
http://r.789695.n4.nabble.com/Plotting-zoo-objects-with-chron-axis-tp4673412.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.


[R] decimal separator from comma to dot

2013-08-09 Thread maxbre
This is my reproducible example

df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L, 
37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L, 
4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L, 
6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L, 
50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L, 
2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002
), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L, 
2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class = factor)),
.Names = c(IDANT, 
N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA, 
10L), class = data.frame)

The data frame “df” it’s a “simplified snapshot” from an oracle table
imported via odbc (by using the package RODBC) ;
now, the problem with the data frame “df” is that one variable “POT_TX” have
the decimal separator formatted with comma instead of dot; 
so I’m in the need to reformat the variable from factor to numeric type to
perform some useful calculations

this is my code I worked so far

#function to change comma to dot
myfun - function(x) {sub(,,.,x)}

#apply the function to all variables
new - apply(df, 2, myfun )
newdf - data.frame(apply(new, 2, as.numeric))
str(newdf)

#apply the function to one variables
var-as.numeric(sapply(df[,6], FUN=myfun))
df$POT_TX-var
str(df)


my questions:

1.  is it possible to use the more convenient function “apply” with 
reference
to just some variables and not all of them? I’ve been reading on the help
that “Where X has named dimnames, it can be a character vector selecting
dimension names.”, what does exactly means that?

2.  do you know some more convenient methods to perform comma to dot
substitution in just some selected variables of a data frame? To note that
the desired final result is again a dataframe

3.  do you know any workaround to set the decimal delimiter for a variable
(field) “at the early steps” when connecting via odbc and then querying to
the table?
For these “early steps” I’ve been using something like:
library(RODBC)
con-odbcConnect(dsn, uid=user, pwd=password)
df-sqlQuery(con, select * from table.name;)

thank you all for the eventual support




--
View this message in context: 
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414.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.


[R] cat(summary(lm(Y~x, dat = data))) cannot handle lists; dput writes too much...

2013-08-09 Thread Alex van der Spek

Is there a way to write the summary of lm objects to a text file on disk?

cat won't handle the list, dput writes everything but not in human 
readable format.


Any thoughts?
Alex van der Spek

__
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] Automatic formula creation

2013-08-09 Thread Alex van der Spek
Say I want to compare all 5 term models from a choice of 28 different 
predictors and one known. All possible combinations of 5 out of 28 is 
easy to form by combn(). With some string manipulation it is also easy 
to make a text representation of a formula which is easy to convert by 
as.formula() for use in lm().


The primitive part however is pasting together the terms which I do 
explicitly for 5 terms, like so:



ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],  
sep = ' * ')



Works but is not great as I now need to edit this formula when the 
number of terms changes. There ought to be a better way but I can't find it.


Any help much appreciated! The full block of relevant code follows:
Alex van der Spek

+


#Try all 3 band models
nbands - 5
freqs - c('4', '5', '6_3', '8', '10', '12_7', '16', '20', '25', '32', 
'40', '51', '64', '81', '102', '128',
   '161', '203', '256', '323', '406', '512', '645', '813', 
'1024', '1290', '1625', '2048')

bands - paste(rep('kHz', 28), freqs, rep('_ave', 28), sep = '')
nc - choose(28, nbands)
combs - t(combn(bands, nbands))

models - vector(list, nc)
for (ic in 1:nc) {
terms - c()
for (jc in 1:nbands) {
t - paste('log10(', combs[ic, jc], ')', sep = '')
terms - append(terms, t)
}

ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],  
sep = ' * ')


ftext - paste('I(1 - Pass149) ~ ', ftext, ' - 1', sep = '')
forml - as.formula(ftext)

plus100.lm - lm(forml, data = sd, subset = Use == 'Cal')
plus100.sm - step(plus100.lm, trace = 0)
}

__
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] cat(summary(lm(Y~x, dat = data))) cannot handle lists; dput writes too much...

2013-08-09 Thread Sarah Goslee
What about sink()? Or capture.outout()? Or running your models as a batch
file and saving the results?

Sarah

On Friday, August 9, 2013, Alex van der Spek wrote:

 Is there a way to write the summary of lm objects to a text file on disk?

 cat won't handle the list, dput writes everything but not in human
 readable format.

 Any thoughts?
 Alex van der Spek



-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

[[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] Automatic formula creation

2013-08-09 Thread Rui Barradas

Hello,

Maybe the following gives you some idea on how to vary the terms.

idx - 1:5  # or any other indexes
ftext - paste(terms[idx], collapse = ' * ')


Hope this helps,

Rui Barradas


Em 09-08-2013 11:40, Alex van der Spek escreveu:

Say I want to compare all 5 term models from a choice of 28 different
predictors and one known. All possible combinations of 5 out of 28 is
easy to form by combn(). With some string manipulation it is also easy
to make a text representation of a formula which is easy to convert by
as.formula() for use in lm().

The primitive part however is pasting together the terms which I do
explicitly for 5 terms, like so:


 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
sep = ' * ')


Works but is not great as I now need to edit this formula when the
number of terms changes. There ought to be a better way but I can't find
it.

Any help much appreciated! The full block of relevant code follows:
Alex van der Spek

+


#Try all 3 band models
nbands - 5
freqs - c('4', '5', '6_3', '8', '10', '12_7', '16', '20', '25', '32',
'40', '51', '64', '81', '102', '128',
'161', '203', '256', '323', '406', '512', '645', '813',
'1024', '1290', '1625', '2048')
bands - paste(rep('kHz', 28), freqs, rep('_ave', 28), sep = '')
nc - choose(28, nbands)
combs - t(combn(bands, nbands))

models - vector(list, nc)
for (ic in 1:nc) {
 terms - c()
 for (jc in 1:nbands) {
 t - paste('log10(', combs[ic, jc], ')', sep = '')
 terms - append(terms, t)
 }

 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
sep = ' * ')

 ftext - paste('I(1 - Pass149) ~ ', ftext, ' - 1', sep = '')
 forml - as.formula(ftext)

 plus100.lm - lm(forml, data = sd, subset = Use == 'Cal')
 plus100.sm - step(plus100.lm, trace = 0)
}

__
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] For loop output

2013-08-09 Thread Jenny Williams
To update on the use of this little string, I am trying to use it to automate 
files to be loaded into a raster stack.
I think the issue I have with the string is related to the backslashes. I need 
to just read the pure text so that the datasets can be sourced, though I am not 
sure whether the stack function will accept a string of files in this format 
either!

individual.proj.quote -capture.output(write.table(matrix(individual.proj, 1), 
quote=TRUE, sep=,, row.names=FALSE, col.names=FALSE))

 individual.proj.quote
[1] 
Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GBM.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GLM.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_MARS.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_RF.img
 

test4 = stack(individual.proj.quote)
Cannot create a RasterLayer object from this file. (file does not exist)


I ran a test with just one file which worked, but haven't managed to combine 
more files into the stack:

test
[1] 
Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GBM.img

 library(raster)
 test.1 = stack(test)
 test.1
class   : RasterStack 
dimensions  : 9241, 8521, 78742561, 1  (nrow, ncol, ncell, nlayers)
resolution  : 0.00834, 0.00834  (x, y)
extent  : -18.00832, 53.1, -38.00833, 39.1  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +no_defs 
names   : proj_current_arabica_pa.data.tmp.pa.tab_Full_GBM 
min values  :6 
max values  :  995


-Original Message-
From: David Carlson [mailto:dcarl...@tamu.edu] 
Sent: 08 August 2013 18:04
To: Jenny Williams; r-help@r-project.org
Subject: RE: [R] For loop output

It's not clear how you are planning to use this within R, but you don't need a 
loop.

individual.proj.quote -
capture.output(write.table(matrix(individual.proj, 1), quote=TRUE, sep=,, 
row.names=FALSE, col.names=FALSE))

This produces a single character string which consists of the quoted file names 
separated by commas.

-
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Jenny Williams
Sent: Thursday, August 8, 2013 10:06 AM
To: 'r-help@r-project.org'
Subject: [R] For loop output

I am having difficulty storing the output of a for loop I have generated. All I 
want to do is find all the files that I have, create a string with all of the 
names in quotes and separated by commas. This is proving more difficult than I 
initially anticipated.
I am sure it is either very simple or the construction of the for loop is not 
quite right The result gets automatically printed after the loop but I can't 
seem to save it.
I have tried to create the element in advance but the result is the same: NULL

individual.proj =
Sys.glob(Arabica/proj_current/individual_projections/*.img,
dirmark = FALSE)
individual.proj
[1]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img
 [2]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GLM.img
 [3]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_MARS.img
 [4]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_RF.img
 [5]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_RUN10_GBM.img


##generate loop to create string out of the table of projected files.
L.ip = length(individual.proj)
  for (i in 1:L.ip){
   individual.proj.i - individual.proj[i]
   individual.proj.quote = cat(paste('', individual.proj.i, '', 
',',sep=))
   }
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img,Arabica/proj_current/individ
ual_projections/proj_current

##print output string
individual.proj.quote
NULL

#command to be applied to individual.proj.quote to removed the final comma from 
the string substr(individual.proj.quote, 1, nchar(individual.proj.quote)-1)

Any help or pointers would be greatly appreciated, no amount of extensive 
google searches have been fruitful so far.


**
Jenny Williams
Spatial Information Scientist, GIS Unit
Herbarium, Library, Art  Archives Directorate Royal Botanic Gardens, Kew 
Richmond, TW9 3AB, UK

Tel: +44 (0)208 332 5277
email: jenny.willi...@kew.orgmailto:jenny.willi...@kew.org
**

Film: The Forgotten Home of Coffee - Beyond the 
Gardenshttp://www.youtube.com/watch?v=-uDtytKMKpAsns=tw
Stories: Coffee Expedition -

Re: [R] Problem with dea.boot under R 3.0.1

2013-08-09 Thread Vera
Dear Daniel,

thank you very much for your reply. We checked all inputs and outputs and
there were no negative values. We eluded the phenomenon by reinstallung R
version 2.14.2 and the old FEAR package. The bootstrapping generated sound
bias-corrected efficiency values there, hence we assume it is really a bug
of R 3 or of the dea.boot package.

Best,
Vera



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-dea-boot-under-R-3-0-1-tp4669964p4673420.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] decimal separator from comma to dot

2013-08-09 Thread Simon Zehnder
Hi,

I think this could help you: 
https://stat.ethz.ch/pipermail/r-help/2008-January/152378.html

Best

Simon

On Aug 9, 2013, at 12:19 PM, maxbre mbres...@arpa.veneto.it wrote:

 This is my reproducible example
 
 df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L, 
 37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L, 
 4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L, 
 6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L, 
 50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L, 
 2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002
 ), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L, 
 2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class = factor)),
 .Names = c(IDANT, 
 N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA, 
 10L), class = data.frame)
 
 The data frame “df” it’s a “simplified snapshot” from an oracle table
 imported via odbc (by using the package RODBC) ;
 now, the problem with the data frame “df” is that one variable “POT_TX” have
 the decimal separator formatted with comma instead of dot; 
 so I’m in the need to reformat the variable from factor to numeric type to
 perform some useful calculations
 
 this is my code I worked so far
 
 #function to change comma to dot
 myfun - function(x) {sub(,,.,x)}
 
 #apply the function to all variables
 new - apply(df, 2, myfun )
 newdf - data.frame(apply(new, 2, as.numeric))
 str(newdf)
 
 #apply the function to one variables
 var-as.numeric(sapply(df[,6], FUN=myfun))
 df$POT_TX-var
 str(df)
 
 
 my questions:
 
 1.is it possible to use the more convenient function “apply” with 
 reference
 to just some variables and not all of them? I’ve been reading on the help
 that “Where X has named dimnames, it can be a character vector selecting
 dimension names.”, what does exactly means that?
 
 2.do you know some more convenient methods to perform comma to dot
 substitution in just some selected variables of a data frame? To note that
 the desired final result is again a dataframe
 
 3.do you know any workaround to set the decimal delimiter for a variable
 (field) “at the early steps” when connecting via odbc and then querying to
 the table?
 For these “early steps” I’ve been using something like:
 library(RODBC)
 con-odbcConnect(dsn, uid=user, pwd=password)
 df-sqlQuery(con, select * from table.name;)
 
 thank you all for the eventual support
 
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414.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.

__
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] Calculate McDonald's Omega

2013-08-09 Thread anewbie
Dear all,

I'm a newbie to R an would like to calculate McDonald's Omega.
I installed the packages psych, GPArotation and used the suggested syntax
omega(m,nfactors=3,fm=minres,...).
Up to this point, it works.

Nevertheless, I read that omega-h is not meaningful for a 1-factor
solution.
What I'll have to do, if I would like to analyze the reliability of one
subscale consisting of 
e.g. three items? I specify nfactors=1, because I have one group factor
and analyse omega_t instead of omega_h? Is this right?

My question might sound stupid, but I'm confused.

I would appreciate if someone can give me advice.

Thank you. 



--
View this message in context: 
http://r.789695.n4.nabble.com/Calculate-McDonald-s-Omega-tp4673422.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.


[R] errors with hurdle negative binomial mixed effect models

2013-08-09 Thread Marta Lomas
Hello! 
I am new in the mailing list for R help and I hope to be able to formulate a 
good question easy to understand.

After trying to do many different things to solve an error I do not find the 
solution.

I am modeling my data set with hurdle negative binomial mixed effects, to find 
the correlation of some bird counts with environmental (categorical and 
continuous) variables.

When I run different models I have always an error. For instance:

-For the truncated modeling of the non-zero counts:

 HURgvgsw - glmmadmb(count~ GVG*sward + (1|week), 
 data=subset(SW_GVG,count0), + family= truncnbinom) 

Error en glmmadmb(count ~ GVG * sward + (1 | week), data = subset(SW_GVG,  : 
rank of X = 6  ncol(X) = 10

-Or the binomial part where the zeros are modeled with the non-zeros: 

 HURgvgsw - glmmadmb(count~ sward*GVG + (1|week) + (1|cluster), data=SW_GVG, 
 family= binomial) 

Error en glmmadmb(count ~ sward * GVG + (1 | week) + (1 | cluster), data = 
SW_GVG,  : 
rank of X = 13  ncol(X) = 15

Would you have the solution to this?

When I run the model with many variables I also have that error. So what I have 
been done so far is to split the model in to two differentiated by smaller set 
of variables as follows so I do not get that error. I do not think this is the 
solution though:

 hnb6 - glmmadmb(count~ Year * (dist + sward + inject + fresh + veg) + 
 (1|week), data=subset(newdata_,count0), family= truncnbinom) 

Error en glmmadmb(count ~ Year * (dist + sward + inject + fresh + veg) +  : 
rank of X = 22  ncol(X) = 24

However this model works (taking off one variable):

 hnb6 - glmmadmb(count~ Year * (dist + sward + inject + veg) + (1|week), 
 data=subset(newdata_,count0),
+ family= truncnbinom) 

The same with no variable interactions (controling for week, nested in Year):

 hnb6 - glmmadmb(count~ dist + sward + inject + fresh + veg + (1|Year/week), 
 data=subset(newdata_,count0),
+ family= truncnbinom) 

Error en glmmadmb(count ~ dist + sward + inject + fresh + veg + (1 | 
Year/week),  : 
rank of X = 11  ncol(X) = 12


When I do the binomial part of the model above, I get another error very 
frequent as well:

 hnb6 - glmmadmb(count~ dist + sward + inject + fresh + veg + (1|Year) + 
 (1|week), data=newdata_,
+ family= binomial) 
Parameters were estimated, but not standard errors were not: the most likely 
problem is that the curvature at MLE was zero or negative
Error en glmmadmb(count ~ dist + sward + inject + fresh + veg + (1 | Year) +  : 
  The function maximizer failed (couldn't find STD file) Troubleshooting steps 
include (1) run with 'save.dir' set and inspect output files; (2) change run 
parameters: see '?admbControl'
Además: Mensajes de aviso perdidos
comando ejecutado 'C:\Windows\system32\cmd.exe /c 
C:/Users/Marta/Documents/R/win-library/2.15/glmmADMB/bin/windows32/glmmadmb.exe
 -maxfn 500 -maxph 5 -noinit -shess' tiene estatus 1 


I hope it is easy to understand and you could help me with it. 

Thanks a lot!!

  
[[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] Data corruption with big numbers.

2013-08-09 Thread Johan Nyberg
I am confused about what I believed was artefects from reading .csv files with 
big numbers.
Finally I checked using the console and this is what I get, the same as when 
importing:

longnumber-63502481056038
longnumber
[1] 635024810560380032

I have tried setting options(digits=22) and also 20 and 18 with no difference. 
R-version is x64 3.0.1

Does someone know or guess why this happens?

Yours
Johan Nyberg, Sweden.


[[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] Problem loading .r file

2013-08-09 Thread balevick1
Bogaso wrote
 Hello all,
 
 I was trying to load a .r file using source() ...  functions ... however
 getting
 following error:
 
 source(D:/Book Code.r)
 Error in sys.call(sys.parent()) : node stack overflow


I realise the above message is quite old, just a quick reply if anyone is
encountering the same error and was trying to find a solution (and ending up
here). 

The error is occurring because the line:
 source( filename.r )
is in the file (filename.r) that you're trying to open.

Hash this out in the document
#source(filename.r)
and then it's there for you to copy-paste in and run the code, but shouldn't
cause the error above. 

I would advise copy-pasting the code you're trying to run in the document
first, to make sure that there are no errors in there either!

Hope that helps anyone encountering the error.



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-loading-r-file-tp4653624p4673413.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.


[R] iterating missing() over function arguments

2013-08-09 Thread Harry Mamaysky

Hi,

Say I have

   function(aa,bb,cc) { does something }

and I want to go through all (or a subset) of function arguments to check if
they're missing.  Of course, I can check each one in turn, ie.

  if (missing(aa)) {}
  if (missing(bb)) {}, etc.

But is there a construct like the following to go through all of them and
perform some default action?  Like this (which doesn't work obviously):

   for el in c('aa','bb','cc')
   if missing(el)  {do something}

I was thinking could to eval(parse( construct string here )), but was
hoping there was something cleaner.

Thanks

__
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] Data corruption with big numbers.

2013-08-09 Thread jim holtman
FAQ 7.31 is a start.

Understand the precision of floating point numbers.  You probably only
have about 15 digits (54 bits) of significance.

If you need unlimited number of digits, there are some other alternatives.



On Fri, Aug 9, 2013 at 5:54 AM, Johan Nyberg jo...@infocraft.se wrote:

 I am confused about what I believed was artefects from reading .csv files
 with big numbers.
 Finally I checked using the console and this is what I get, the same as
 when importing:
 
 longnumber-63502481056038
 longnumber
 [1] 635024810560380032

 I have tried setting options(digits=22) and also 20 and 18 with no
 difference. R-version is x64 3.0.1

 Does someone know or guess why this happens?

 Yours
 Johan Nyberg, Sweden.


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




-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

[[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] Data corruption with big numbers.

2013-08-09 Thread Adams, Jean
The link to FAQ 7.31 is
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

Jean


On Fri, Aug 9, 2013 at 8:16 AM, jim holtman jholt...@gmail.com wrote:

 FAQ 7.31 is a start.

 Understand the precision of floating point numbers.  You probably only
 have about 15 digits (54 bits) of significance.

 If you need unlimited number of digits, there are some other alternatives.



 On Fri, Aug 9, 2013 at 5:54 AM, Johan Nyberg jo...@infocraft.se wrote:

  I am confused about what I believed was artefects from reading .csv files
  with big numbers.
  Finally I checked using the console and this is what I get, the same as
  when importing:
  
  longnumber-63502481056038
  longnumber
  [1] 635024810560380032
 
  I have tried setting options(digits=22) and also 20 and 18 with no
  difference. R-version is x64 3.0.1
 
  Does someone know or guess why this happens?
 
  Yours
  Johan Nyberg, Sweden.
 
 
  [[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.
 



 --
 Jim Holtman
 Data Munger Guru

 What is the problem that you are trying to solve?
 Tell me what you want to do, not how you want to do it.

 [[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] Automatic formula creation

2013-08-09 Thread peter dalgaard

On Aug 9, 2013, at 13:26 , Rui Barradas wrote:

 Hello,
 
 Maybe the following gives you some idea on how to vary the terms.
 
 idx - 1:5  # or any other indexes
 ftext - paste(terms[idx], collapse = ' * ')


You're not the first to use this sort of technique - it is happening in various 
parts of R's own internals too, but handling R expressions via their textual 
representation is really not a good principle (see fortune(rethink)) and it 
_does_ give rise to problems. 

I much prefer techniques like this:

 nm - lapply(letters[1:6], as.name)
 Reduce(function(a,b) bquote(.(a)*.(b)), nm)
a * b * c * d * e * f


Similarly, use

 trm - Reduce(function(a,b) bquote(.(a)*.(b)), nm)
 formula(bquote(I(1 - Pass149) ~  .(trm) - 1))
I(1 - Pass149) ~ a * b * c * d * e * f - 1


 
 
 Hope this helps,
 
 Rui Barradas
 
 
 Em 09-08-2013 11:40, Alex van der Spek escreveu:
 Say I want to compare all 5 term models from a choice of 28 different
 predictors and one known. All possible combinations of 5 out of 28 is
 easy to form by combn(). With some string manipulation it is also easy
 to make a text representation of a formula which is easy to convert by
 as.formula() for use in lm().
 
 The primitive part however is pasting together the terms which I do
 explicitly for 5 terms, like so:
 
 
 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
 sep = ' * ')
 
 
 Works but is not great as I now need to edit this formula when the
 number of terms changes. There ought to be a better way but I can't find
 it.
 
 Any help much appreciated! The full block of relevant code follows:
 Alex van der Spek
 
 +
 
 
 #Try all 3 band models
 nbands - 5
 freqs - c('4', '5', '6_3', '8', '10', '12_7', '16', '20', '25', '32',
 '40', '51', '64', '81', '102', '128',
'161', '203', '256', '323', '406', '512', '645', '813',
 '1024', '1290', '1625', '2048')
 bands - paste(rep('kHz', 28), freqs, rep('_ave', 28), sep = '')
 nc - choose(28, nbands)
 combs - t(combn(bands, nbands))
 
 models - vector(list, nc)
 for (ic in 1:nc) {
 terms - c()
 for (jc in 1:nbands) {
 t - paste('log10(', combs[ic, jc], ')', sep = '')
 terms - append(terms, t)
 }
 
 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
 sep = ' * ')
 
 ftext - paste('I(1 - Pass149) ~ ', ftext, ' - 1', sep = '')
 forml - as.formula(ftext)
 
 plus100.lm - lm(forml, data = sd, subset = Use == 'Cal')
 plus100.sm - step(plus100.lm, trace = 0)
 }
 
 __
 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.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] Splitting a categorical variable into multiple variables

2013-08-09 Thread Claus O'Rourke
Hello R-Help,
I have a variable with  32 levels and I'd like to split this into two
variables such that both new variables have = 32 variables. This is
to handle the limit of 32 level predictor variables in R's Random
Forest implementation. Might someone be able to suggest an elegant way
to do this? I've tried googling for this, but haven't hit the right
search terms.

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.


Re: [R] decimal separator from comma to dot

2013-08-09 Thread maxbre
Thanks it's the same thread I've been looking at
But it's not answering to my  questions…



--
View this message in context: 
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414p4673433.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] Splitting a categorical variable into multiple variables

2013-08-09 Thread Bert Gunter
If I understand what you mean, just recode them.

z - factor(letters[1:3])
z
zz - factor(ifelse( z %in% c(a, b),d ,z))
zz

Cheers,
Bert

On Fri, Aug 9, 2013 at 7:10 AM, Claus O'Rourke claus.orou...@gmail.com wrote:
 Hello R-Help,
 I have a variable with  32 levels and I'd like to split this into two
 variables such that both new variables have = 32 variables. This is
 to handle the limit of 32 level predictor variables in R's Random
 Forest implementation. Might someone be able to suggest an elegant way
 to do this? I've tried googling for this, but haven't hit the right
 search terms.

 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin,

thank you very much for this profound answer! Your added design advice is very 
helpful, too! 

For the 'simple example': Sometimes I am still a little overwhelmed from a 
certain setting in the code and my ideas how I want to handle a process. But I 
learn from session to session. In future I will also span the lines more than 
80 columns. I am used to the indent in my vim editor. 

I have one further issue: I do know, that you are one of the leading developers 
of the bioconductor package which uses (as far as I have read) extensively OOP 
in R. Is there a package you could suggest to me to learn from by reading and 
understanding the code? Where can I find the source code? 

Best

Simon


On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:

 On 08/04/2013 02:13 AM, Simon Zehnder wrote:
 So, I found a solution: First in the initialize method of class C coerce
 the C object into a B object. Then call the next method in the list with the
 B class object. Now, in the initialize method of class B the object is a B
 object and the respective generateSpec method is called. Then, in the
 initialize method of C the returned object from callNextMethod has to be
 written to the C class object in .Object. See the code below.
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 object - as(.Object, B); object - callNextMethod(object, value);
 as(.Object, B) - object; .Object - generateSpec(.Object);
 return(.Object)})
 
 This setting works. I do not know though, if this setting is the usual way
 such things are done in R OOP. Maybe the whole class design is
 disadvantageous. If anyone detects a mistaken design, I am very thankful to
 learn.
 
 Hi Simon -- your 'simple' example is pretty complicated, and I didn't really 
 follow it in detail! The code is not formatted for easy reading (e.g., lines 
 spanning no more than 80 columns) and some of it (e.g., generateSpec) might 
 not be necessary to describe the problem you're having.
 
 A good strategy is to ensure that 'new' called with no arguments works (there 
 are other solutions, but following this rule has helped me to keep my classes 
 and methods simple). This is not the case for
 
  new(A)
  new(C)
 
 The reason for this strategy has to do with the way inheritance is 
 implemented, in particular the coercion from derived to super class. Usually 
 it is better to provide default values for arguments to initialize, and to 
 specify arguments after a '...'. This means that your initialize methods will 
 respects the contract set out in ?initialize, in particular the handling of 
 unnamed arguments:
 
 ...: data to include in the new object.  Named arguments
  correspond to slots in the class definition. Unnamed
  arguments must be objects from classes that this class
  extends.
 
 I might have written initialize,A-method as
 
  setMethod(initialize, A, function(.Object, ..., value=numeric()){
  .Object - callNextMethod(.Object, ..., a=value)
  generateSpec(.Object)
  })
 
 Likely in a subsequent iteration I would have ended up with (using the 
 convention that function names preceded by '.' are not exported)
 
  .A - setClass(A, representation(a = numeric, specA = numeric))
 
  .generateSpecA - function(a) {
  1 / a
   }
 
  A - function(a=numeric(), ...) {
  specA - .generateSpecA(a)
  .A(..., a=a, specA=specA)
  }
 
  setMethod(generateSpec, A, function(object) {
  .generateSpecA(object@a)
  })
 
 ensuring that A() returns a valid object and avoiding the definition of an 
 initialize method entirely.
 
 Martin
 
 
 Best
 
 Simon
 
 
 On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
 wrote:
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 .Object - callNextMethod(.Object, value); .Object -
 generateSpec(.Object); return(.Object)})
 
 __ 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.
 
 
 
 -- 
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109
 
 Location: Arnold Building M1 B861
 Phone: (206) 667-2793

__
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] Splitting a categorical variable into multiple variables

2013-08-09 Thread Bert Gunter
... or if you want to keep the unchanged levels the same:

zz - factor(ifelse( z %in% c(a, b),d ,levels(z)[z]))

-- Bert

On Fri, Aug 9, 2013 at 7:35 AM, Bert Gunter bgun...@gene.com wrote:
 If I understand what you mean, just recode them.

 z - factor(letters[1:3])
 z
 zz - factor(ifelse( z %in% c(a, b),d ,z))
 zz

 Cheers,
 Bert

 On Fri, Aug 9, 2013 at 7:10 AM, Claus O'Rourke claus.orou...@gmail.com 
 wrote:
 Hello R-Help,
 I have a variable with  32 levels and I'd like to split this into two
 variables such that both new variables have = 32 variables. This is
 to handle the limit of 32 level predictor variables in R's Random
 Forest implementation. Might someone be able to suggest an elegant way
 to do this? I've tried googling for this, but haven't hit the right
 search terms.

 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.



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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

2013-08-09 Thread christian.kamenik
Jan,

Many thanks for your suggestion! The code runs perfectly fine on the test set. 
Applying it to the complete data set, however, results in the following error:

 while (TRUE) {
+  lines - readLines(con, encoding='LATIN1')
+  if (length(lines) == 0) break
+  lines - sprintf(%-238s, lines)
+  writeLines(lines, out, useBytes=TRUE) }
Error: cannot allocate vector of size 23.2 Mb


Best Regard

Christian Kamenik
Project Manager

Federal Department of the Environment, Transport, Energy and Communications 
DETEC  
Federal Roads Office FEDRO
Division Road Traffic
Road Accident Statistics

Mailing Address: 3003 Bern
Location: Weltpoststrasse 5, 3015 Bern

Tel +41 31 323 14 89 
Fax +41 31 323 43 21

christian.kame...@astra.admin.ch
www.astra.admin.ch


-Ursprüngliche Nachricht-
Von: Jan van der Laan [mailto:rh...@eoos.dds.nl] 
Gesendet: Freitag, 9. August 2013 10:01
An: Kamenik Christian ASTRA
Betreff: Re: AW: AW: [R] laf_open_fwf

Christian,

It seems some of the lines in your file have additional characters at the end 
causing the line lengths to vary. The only way I could think of is to first add 
whitespace to the shorter lines to make all line lengths equal:

# Add whitespace to the end of the lines to make all lines the same length con 
- file(testdata.txt, rt) out - file(testdata_2.txt, wt) while (TRUE) {
   lines - readLines(con, n=1E5)
   if (length(lines) == 0) break
   lines - sprintf(%-238s, lines)
   writeLines(lines, out, useBytes=TRUE) }
close(con)
close(out)


I am then able to read you test file using LaF:

library(LaF)

column_widths - c(3, 28, 4, 30, 28, 6, 3, 30, 10, 26, 25, 30, 2, 5, 5) 
column_types - rep(string, length(column_widths)) column_types[c(1, 3, 7)] 
- integer

laf - laf_open_fwf(testdata_2.txt, column_types = column_types, 
column_widths = column_widths)


HTH,
Jan







christian.kame...@astra.admin.ch schreef:

 Hello Jan

 I attached an example. Any help is highly appreciated!

 Kind Regard

 Christian Kamenik
 Project Manager

 Federal Department of the Environment, Transport, Energy and 
 Communications DETEC Federal Roads Office FEDRO Division Road Traffic 
 Road Accident Statistics

 Mailing Address: 3003 Bern
 Location: Weltpoststrasse 5, 3015 Bern

 Tel +41 31 323 14 89
 Fax +41 31 323 43 21

 christian.kame...@astra.admin.ch
 www.astra.admin.ch
 -Ursprüngliche Nachricht-
 Von: Jan van der Laan [mailto:rh...@eoos.dds.nl]
 Gesendet: Donnerstag, 8. August 2013 13:58
 An: r-help@r-project.org
 Cc: Kamenik Christian ASTRA
 Betreff: Re: AW: [R] laf_open_fwf


 Without example data it is difficult to give suggestions on how you 
 might read this file.

 Are you sure your file is fixed width? Sometimes columns are neatly 
 aligned using whitespace (tabs/spaces). In that case you could use 
 read.table with the default settings.

 Another possibility might be that the file is encoded in utf8. I 
 expect that reading it in assuming another encoding (such as latin1) 
 would lead to varying line sizes. Although I would expect the lengths 
 to be larger than the sum of your column widths (as one symbol can be 
 larger than one byte).

 Jan



 christian.kame...@astra.admin.ch schreef:

 Dear Jan

 Many thanks for your help. In fact, all lines are shorter than my 
 column width...

 my.column.widths:238
 range(nchar(lines)): 235 237

 So, it seems I have an inconsistent file structure...
 I guess there is no way to handle this in an automated way?

 Best Regard

 Christian Kamenik
 Project Manager

 Federal Department of the Environment, Transport, Energy and 
 Communications DETEC Federal Roads Office FEDRO Division Road Traffic 
 Road Accident Statistics

 Mailing Address: 3003 Bern
 Location: Weltpoststrasse 5, 3015 Bern

 Tel +41 31 323 14 89
 Fax +41 31 323 43 21

 christian.kame...@astra.admin.ch
 www.astra.admin.ch
 -Ursprüngliche Nachricht-
 Von: Jan van der Laan [mailto:rh...@eoos.dds.nl]
 Gesendet: Mittwoch, 7. August 2013 20:57
 An: r-help@r-project.org
 Cc: Kamenik Christian ASTRA
 Betreff: Re: [R] laf_open_fwf

 Dear Christian,

 Well... it shouldn't normally do that. The only way I can currently 
 think of that might cause this problem is that the file has \r\n\r\n, 
 which would mean that every line is followed by an empty line.

 Another cause might be (although I would not really expect the 
 results you see) that the sum of your column widths is larger than 
 the actual with of the line.

 You can check your line lengths using:

 lines - readLines(my.filename)
 nchar(lines)

 Each line should have the same length and be equal to (or at least 
 larger than) sum(my.column.widths)

 If this is not the problem: would it be possible that you send me a 
 small part of your file so that I could try to reproduce the problem?
 Or if you cannot share your data: replace the actual values with 
 nonsense values.

 Regards,
 Jan

 PS I read your mail by chance as I am not a regular r-help reader.
 

Re: [R] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Simon:

Have a look at the proto package for which there is a vignette. You
may find it suitable for your needs and less intimidating.

Cheers,
Bert

On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder szehn...@uni-bonn.de wrote:
 Hi Martin,

 thank you very much for this profound answer! Your added design advice is 
 very helpful, too!

 For the 'simple example': Sometimes I am still a little overwhelmed from a 
 certain setting in the code and my ideas how I want to handle a process. But 
 I learn from session to session. In future I will also span the lines more 
 than 80 columns. I am used to the indent in my vim editor.

 I have one further issue: I do know, that you are one of the leading 
 developers of the bioconductor package which uses (as far as I have read) 
 extensively OOP in R. Is there a package you could suggest to me to learn 
 from by reading and understanding the code? Where can I find the source code?

 Best

 Simon


 On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:

 On 08/04/2013 02:13 AM, Simon Zehnder wrote:
 So, I found a solution: First in the initialize method of class C coerce
 the C object into a B object. Then call the next method in the list with the
 B class object. Now, in the initialize method of class B the object is a B
 object and the respective generateSpec method is called. Then, in the
 initialize method of C the returned object from callNextMethod has to be
 written to the C class object in .Object. See the code below.

 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 object - as(.Object, B); object - callNextMethod(object, value);
 as(.Object, B) - object; .Object - generateSpec(.Object);
 return(.Object)})

 This setting works. I do not know though, if this setting is the usual way
 such things are done in R OOP. Maybe the whole class design is
 disadvantageous. If anyone detects a mistaken design, I am very thankful to
 learn.

 Hi Simon -- your 'simple' example is pretty complicated, and I didn't really 
 follow it in detail! The code is not formatted for easy reading (e.g., lines 
 spanning no more than 80 columns) and some of it (e.g., generateSpec) might 
 not be necessary to describe the problem you're having.

 A good strategy is to ensure that 'new' called with no arguments works 
 (there are other solutions, but following this rule has helped me to keep my 
 classes and methods simple). This is not the case for

  new(A)
  new(C)

 The reason for this strategy has to do with the way inheritance is 
 implemented, in particular the coercion from derived to super class. Usually 
 it is better to provide default values for arguments to initialize, and to 
 specify arguments after a '...'. This means that your initialize methods 
 will respects the contract set out in ?initialize, in particular the 
 handling of unnamed arguments:

 ...: data to include in the new object.  Named arguments
  correspond to slots in the class definition. Unnamed
  arguments must be objects from classes that this class
  extends.

 I might have written initialize,A-method as

  setMethod(initialize, A, function(.Object, ..., value=numeric()){
  .Object - callNextMethod(.Object, ..., a=value)
  generateSpec(.Object)
  })

 Likely in a subsequent iteration I would have ended up with (using the 
 convention that function names preceded by '.' are not exported)

  .A - setClass(A, representation(a = numeric, specA = numeric))

  .generateSpecA - function(a) {
  1 / a
   }

  A - function(a=numeric(), ...) {
  specA - .generateSpecA(a)
  .A(..., a=a, specA=specA)
  }

  setMethod(generateSpec, A, function(object) {
  .generateSpecA(object@a)
  })

 ensuring that A() returns a valid object and avoiding the definition of an 
 initialize method entirely.

 Martin


 Best

 Simon


 On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
 wrote:

 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 .Object - callNextMethod(.Object, value); .Object -
 generateSpec(.Object); return(.Object)})

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



 --
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109

 Location: Arnold Building M1 B861
 Phone: (206) 667-2793

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Bert,

thank you very much for your suggestion! I will take a look at it soon!

Best

Simon

On Aug 9, 2013, at 4:45 PM, Bert Gunter gunter.ber...@gene.com wrote:

 Simon:
 
 Have a look at the proto package for which there is a vignette. You
 may find it suitable for your needs and less intimidating.
 
 Cheers,
 Bert
 
 On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder szehn...@uni-bonn.de wrote:
 Hi Martin,
 
 thank you very much for this profound answer! Your added design advice is 
 very helpful, too!
 
 For the 'simple example': Sometimes I am still a little overwhelmed from a 
 certain setting in the code and my ideas how I want to handle a process. But 
 I learn from session to session. In future I will also span the lines more 
 than 80 columns. I am used to the indent in my vim editor.
 
 I have one further issue: I do know, that you are one of the leading 
 developers of the bioconductor package which uses (as far as I have read) 
 extensively OOP in R. Is there a package you could suggest to me to learn 
 from by reading and understanding the code? Where can I find the source code?
 
 Best
 
 Simon
 
 
 On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:
 
 On 08/04/2013 02:13 AM, Simon Zehnder wrote:
 So, I found a solution: First in the initialize method of class C coerce
 the C object into a B object. Then call the next method in the list with 
 the
 B class object. Now, in the initialize method of class B the object is a 
 B
 object and the respective generateSpec method is called. Then, in the
 initialize method of C the returned object from callNextMethod has to 
 be
 written to the C class object in .Object. See the code below.
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 object - as(.Object, B); object - callNextMethod(object, value);
 as(.Object, B) - object; .Object - generateSpec(.Object);
 return(.Object)})
 
 This setting works. I do not know though, if this setting is the usual 
 way
 such things are done in R OOP. Maybe the whole class design is
 disadvantageous. If anyone detects a mistaken design, I am very thankful to
 learn.
 
 Hi Simon -- your 'simple' example is pretty complicated, and I didn't 
 really follow it in detail! The code is not formatted for easy reading 
 (e.g., lines spanning no more than 80 columns) and some of it (e.g., 
 generateSpec) might not be necessary to describe the problem you're having.
 
 A good strategy is to ensure that 'new' called with no arguments works 
 (there are other solutions, but following this rule has helped me to keep 
 my classes and methods simple). This is not the case for
 
 new(A)
 new(C)
 
 The reason for this strategy has to do with the way inheritance is 
 implemented, in particular the coercion from derived to super class. 
 Usually it is better to provide default values for arguments to initialize, 
 and to specify arguments after a '...'. This means that your initialize 
 methods will respects the contract set out in ?initialize, in particular 
 the handling of unnamed arguments:
 
...: data to include in the new object.  Named arguments
 correspond to slots in the class definition. Unnamed
 arguments must be objects from classes that this class
 extends.
 
 I might have written initialize,A-method as
 
 setMethod(initialize, A, function(.Object, ..., value=numeric()){
 .Object - callNextMethod(.Object, ..., a=value)
 generateSpec(.Object)
 })
 
 Likely in a subsequent iteration I would have ended up with (using the 
 convention that function names preceded by '.' are not exported)
 
 .A - setClass(A, representation(a = numeric, specA = numeric))
 
 .generateSpecA - function(a) {
 1 / a
  }
 
 A - function(a=numeric(), ...) {
 specA - .generateSpecA(a)
 .A(..., a=a, specA=specA)
 }
 
 setMethod(generateSpec, A, function(object) {
 .generateSpecA(object@a)
 })
 
 ensuring that A() returns a valid object and avoiding the definition of an 
 initialize method entirely.
 
 Martin
 
 
 Best
 
 Simon
 
 
 On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
 wrote:
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 .Object - callNextMethod(.Object, value); .Object -
 generateSpec(.Object); return(.Object)})
 
 __ 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.
 
 
 
 --
 Computational Biology / Fred Hutchinson Cancer Research Center
 1100 Fairview Ave. N.
 PO Box 19024 Seattle, WA 98109
 
 Location: Arnold Building M1 B861
 Phone: (206) 667-2793
 
 __
 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, 

Re: [R] Method dispatch in S4

2013-08-09 Thread Martin Morgan

On 08/09/2013 07:45 AM, Bert Gunter wrote:

Simon:

Have a look at the proto package for which there is a vignette. You
may find it suitable for your needs and less intimidating.


Won't help much with S4, though! Some answers here

http://stackoverflow.com/questions/5437238/which-packages-make-good-use-of-s4-objects

including from Bioconductor simple class in EBImage, the advanced IRanges 
package and the 'toy' StudentGWAS.


Martin



Cheers,
Bert

On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder szehn...@uni-bonn.de wrote:

Hi Martin,

thank you very much for this profound answer! Your added design advice is very 
helpful, too!

For the 'simple example': Sometimes I am still a little overwhelmed from a 
certain setting in the code and my ideas how I want to handle a process. But I 
learn from session to session. In future I will also span the lines more than 
80 columns. I am used to the indent in my vim editor.

I have one further issue: I do know, that you are one of the leading developers 
of the bioconductor package which uses (as far as I have read) extensively OOP 
in R. Is there a package you could suggest to me to learn from by reading and 
understanding the code? Where can I find the source code?

Best

Simon


On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:


On 08/04/2013 02:13 AM, Simon Zehnder wrote:

So, I found a solution: First in the initialize method of class C coerce
the C object into a B object. Then call the next method in the list with the
B class object. Now, in the initialize method of class B the object is a B
object and the respective generateSpec method is called. Then, in the
initialize method of C the returned object from callNextMethod has to be
written to the C class object in .Object. See the code below.

setMethod(initialize, C, function(.Object, value) {.Object@c - value;
object - as(.Object, B); object - callNextMethod(object, value);
as(.Object, B) - object; .Object - generateSpec(.Object);
return(.Object)})

This setting works. I do not know though, if this setting is the usual way
such things are done in R OOP. Maybe the whole class design is
disadvantageous. If anyone detects a mistaken design, I am very thankful to
learn.


Hi Simon -- your 'simple' example is pretty complicated, and I didn't really 
follow it in detail! The code is not formatted for easy reading (e.g., lines 
spanning no more than 80 columns) and some of it (e.g., generateSpec) might not 
be necessary to describe the problem you're having.

A good strategy is to ensure that 'new' called with no arguments works (there 
are other solutions, but following this rule has helped me to keep my classes 
and methods simple). This is not the case for

  new(A)
  new(C)

The reason for this strategy has to do with the way inheritance is implemented, 
in particular the coercion from derived to super class. Usually it is better to 
provide default values for arguments to initialize, and to specify arguments 
after a '...'. This means that your initialize methods will respects the 
contract set out in ?initialize, in particular the handling of unnamed 
arguments:

 ...: data to include in the new object.  Named arguments
  correspond to slots in the class definition. Unnamed
  arguments must be objects from classes that this class
  extends.

I might have written initialize,A-method as

  setMethod(initialize, A, function(.Object, ..., value=numeric()){
  .Object - callNextMethod(.Object, ..., a=value)
  generateSpec(.Object)
  })

Likely in a subsequent iteration I would have ended up with (using the 
convention that function names preceded by '.' are not exported)

  .A - setClass(A, representation(a = numeric, specA = numeric))

  .generateSpecA - function(a) {
  1 / a
   }

  A - function(a=numeric(), ...) {
  specA - .generateSpecA(a)
  .A(..., a=a, specA=specA)
  }

  setMethod(generateSpec, A, function(object) {
  .generateSpecA(object@a)
  })

ensuring that A() returns a valid object and avoiding the definition of an 
initialize method entirely.

Martin



Best

Simon


On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
wrote:


setMethod(initialize, C, function(.Object, value) {.Object@c - value;
.Object - callNextMethod(.Object, value); .Object -
generateSpec(.Object); return(.Object)})


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




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793


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

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin,

is proto in S3? 

I will take a look first at the simple package EBImage. 

Thank you very much for the suggestions!

Best

Simon


On Aug 9, 2013, at 5:01 PM, Martin Morgan mtmor...@fhcrc.org wrote:

 On 08/09/2013 07:45 AM, Bert Gunter wrote:
 Simon:
 
 Have a look at the proto package for which there is a vignette. You
 may find it suitable for your needs and less intimidating.
 
 Won't help much with S4, though! Some answers here
 
 http://stackoverflow.com/questions/5437238/which-packages-make-good-use-of-s4-objects
 
 including from Bioconductor simple class in EBImage, the advanced IRanges 
 package and the 'toy' StudentGWAS.
 
 Martin
 
 
 Cheers,
 Bert
 
 On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder szehn...@uni-bonn.de wrote:
 Hi Martin,
 
 thank you very much for this profound answer! Your added design advice is 
 very helpful, too!
 
 For the 'simple example': Sometimes I am still a little overwhelmed from a 
 certain setting in the code and my ideas how I want to handle a process. 
 But I learn from session to session. In future I will also span the lines 
 more than 80 columns. I am used to the indent in my vim editor.
 
 I have one further issue: I do know, that you are one of the leading 
 developers of the bioconductor package which uses (as far as I have read) 
 extensively OOP in R. Is there a package you could suggest to me to learn 
 from by reading and understanding the code? Where can I find the source 
 code?
 
 Best
 
 Simon
 
 
 On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:
 
 On 08/04/2013 02:13 AM, Simon Zehnder wrote:
 So, I found a solution: First in the initialize method of class C coerce
 the C object into a B object. Then call the next method in the list with 
 the
 B class object. Now, in the initialize method of class B the object is 
 a B
 object and the respective generateSpec method is called. Then, in the
 initialize method of C the returned object from callNextMethod has to 
 be
 written to the C class object in .Object. See the code below.
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - value;
 object - as(.Object, B); object - callNextMethod(object, value);
 as(.Object, B) - object; .Object - generateSpec(.Object);
 return(.Object)})
 
 This setting works. I do not know though, if this setting is the usual 
 way
 such things are done in R OOP. Maybe the whole class design is
 disadvantageous. If anyone detects a mistaken design, I am very thankful 
 to
 learn.
 
 Hi Simon -- your 'simple' example is pretty complicated, and I didn't 
 really follow it in detail! The code is not formatted for easy reading 
 (e.g., lines spanning no more than 80 columns) and some of it (e.g., 
 generateSpec) might not be necessary to describe the problem you're having.
 
 A good strategy is to ensure that 'new' called with no arguments works 
 (there are other solutions, but following this rule has helped me to keep 
 my classes and methods simple). This is not the case for
 
  new(A)
  new(C)
 
 The reason for this strategy has to do with the way inheritance is 
 implemented, in particular the coercion from derived to super class. 
 Usually it is better to provide default values for arguments to 
 initialize, and to specify arguments after a '...'. This means that your 
 initialize methods will respects the contract set out in ?initialize, in 
 particular the handling of unnamed arguments:
 
 ...: data to include in the new object.  Named arguments
  correspond to slots in the class definition. Unnamed
  arguments must be objects from classes that this class
  extends.
 
 I might have written initialize,A-method as
 
  setMethod(initialize, A, function(.Object, ..., value=numeric()){
  .Object - callNextMethod(.Object, ..., a=value)
  generateSpec(.Object)
  })
 
 Likely in a subsequent iteration I would have ended up with (using the 
 convention that function names preceded by '.' are not exported)
 
  .A - setClass(A, representation(a = numeric, specA = numeric))
 
  .generateSpecA - function(a) {
  1 / a
   }
 
  A - function(a=numeric(), ...) {
  specA - .generateSpecA(a)
  .A(..., a=a, specA=specA)
  }
 
  setMethod(generateSpec, A, function(object) {
  .generateSpecA(object@a)
  })
 
 ensuring that A() returns a valid object and avoiding the definition of an 
 initialize method entirely.
 
 Martin
 
 
 Best
 
 Simon
 
 
 On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
 wrote:
 
 setMethod(initialize, C, function(.Object, value) {.Object@c - 
 value;
 .Object - callNextMethod(.Object, value); .Object -
 generateSpec(.Object); return(.Object)})
 
 __ 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.
 
 
 
 --
 Computational Biology 

[R] help about diallel analysis

2013-08-09 Thread waqas shafqat
 cadhyn5ju5gggdbwm1hzs-6emtbjzofqr4fzq905v6gjvnpw...@mail.gmail.complz
solve  this question and send me commands..

this is a question for diallel analysis(Haymann approach)..


file is attached*...


*
thanks*
*
cadhyn5ju5gggdbwm1hzs-6emtbjzofqr4fzq905v6gjvnpw...@mail.gmail.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] Splitting a categorical variable into multiple variables

2013-08-09 Thread Claus O'Rourke
Thanks Bert. I guess I was just wondering if there was a way to create
the new factors automatically without me having to hard code the level
names manually in my R code.

Rgds

Claus

On Fri, Aug 9, 2013 at 3:42 PM, Bert Gunter gunter.ber...@gene.com wrote:
 ... or if you want to keep the unchanged levels the same:

 zz - factor(ifelse( z %in% c(a, b),d ,levels(z)[z]))

 -- Bert

 On Fri, Aug 9, 2013 at 7:35 AM, Bert Gunter bgun...@gene.com wrote:
 If I understand what you mean, just recode them.

 z - factor(letters[1:3])
 z
 zz - factor(ifelse( z %in% c(a, b),d ,z))
 zz

 Cheers,
 Bert

 On Fri, Aug 9, 2013 at 7:10 AM, Claus O'Rourke claus.orou...@gmail.com 
 wrote:
 Hello R-Help,
 I have a variable with  32 levels and I'd like to split this into two
 variables such that both new variables have = 32 variables. This is
 to handle the limit of 32 level predictor variables in R's Random
 Forest implementation. Might someone be able to suggest an elegant way
 to do this? I've tried googling for this, but haven't hit the right
 search terms.

 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.



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] For loop output

2013-08-09 Thread Jan Kim
On Fri, Aug 09, 2013 at 12:33:44PM +0100, Jenny Williams wrote:
 To update on the use of this little string, I am trying to use it to automate 
 files to be loaded into a raster stack.
 I think the issue I have with the string is related to the backslashes. I 
 need to just read the pure text so that the datasets can be sourced, though I 
 am not sure whether the stack function will accept a string of files in this 
 format either!

The backslashes can't cause a problem because they don't exist in the
string. They are generated as part of the representation of your string,
so that you can distinguish the double quotes which are part of the
string (prefixed by a backslash) from those enclosing your string.

Please see FAQ 7.37:


http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-backslash-behave-strangely-inside-strings_003f

Let me point out, though, that while this FAQ (along with the R language
specification) will enable you to understand the meaning of the display
of individual.proj.quote, all this adding quotes and commas most likely
is not going to be part of the solution to your problem. A variable
containing a single string, comprised of file names enclosed in quotes
and separated by commas is entirely useless in almost all circumstances.
The individual.proj variable is a much more starting point. I'm not
familiar with RasterLayer objects you (apparently) try to work with,
but as a general programming pattern to start with, I'd suggest creating
an empty stack, and then using a loop where in each iteration you read
one layer and add that to the stack.

Best regards, Jan

 individual.proj.quote -capture.output(write.table(matrix(individual.proj, 
 1), quote=TRUE, sep=,, row.names=FALSE, col.names=FALSE))
 
  individual.proj.quote
 [1] 
 Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GBM.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GLM.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_MARS.img\,\Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_RF.img
  
 
 test4 = stack(individual.proj.quote)
 Cannot create a RasterLayer object from this file. (file does not exist)
 
 
 I ran a test with just one file which worked, but haven't managed to combine 
 more files into the stack:
 
 test
 [1] 
 Arabica/proj_current/individual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_GBM.img
 
  library(raster)
  test.1 = stack(test)
  test.1
 class   : RasterStack 
 dimensions  : 9241, 8521, 78742561, 1  (nrow, ncol, ncell, nlayers)
 resolution  : 0.00834, 0.00834  (x, y)
 extent  : -18.00832, 53.1, -38.00833, 39.1  (xmin, xmax, ymin, 
 ymax)
 coord. ref. : +proj=longlat +ellps=WGS84 +no_defs 
 names   : proj_current_arabica_pa.data.tmp.pa.tab_Full_GBM 
 min values  :6 
 max values  :  995
 
 
 -Original Message-
 From: David Carlson [mailto:dcarl...@tamu.edu] 
 Sent: 08 August 2013 18:04
 To: Jenny Williams; r-help@r-project.org
 Subject: RE: [R] For loop output
 
 It's not clear how you are planning to use this within R, but you don't need 
 a loop.
 
 individual.proj.quote -
 capture.output(write.table(matrix(individual.proj, 1), quote=TRUE, sep=,, 
 row.names=FALSE, col.names=FALSE))
 
 This produces a single character string which consists of the quoted file 
 names separated by commas.
 
 -
 David L Carlson
 Associate Professor of Anthropology
 Texas AM University
 College Station, TX 77840-4352
 
 -Original Message-
 From: r-help-boun...@r-project.org
 [mailto:r-help-boun...@r-project.org] On Behalf Of Jenny Williams
 Sent: Thursday, August 8, 2013 10:06 AM
 To: 'r-help@r-project.org'
 Subject: [R] For loop output
 
 I am having difficulty storing the output of a for loop I have generated. All 
 I want to do is find all the files that I have, create a string with all of 
 the names in quotes and separated by commas. This is proving more difficult 
 than I initially anticipated.
 I am sure it is either very simple or the construction of the for loop is not 
 quite right The result gets automatically printed after the loop but I can't 
 seem to save it.
 I have tried to create the element in advance but the result is the same: NULL
 
 individual.proj =
 Sys.glob(Arabica/proj_current/individual_projections/*.img,
 dirmark = FALSE)
 individual.proj
 [1]
 Arabica/proj_current/individual_projections/proj_current_arabic
 a_pa.data.tmp$pa.tab_Full_GBM.img
  [2]
 Arabica/proj_current/individual_projections/proj_current_arabic
 a_pa.data.tmp$pa.tab_Full_GLM.img
  [3]
 Arabica/proj_current/individual_projections/proj_current_arabic
 a_pa.data.tmp$pa.tab_Full_MARS.img
  [4]
 Arabica/proj_current/individual_projections/proj_current_arabic
 

[R] linking to help pages in other packages

2013-08-09 Thread Jannis

Dear R users,

i am trying to get a package compatible with the R CMD check routine but 
I get errors like this:


Missing link(s) in documentation object ‘path/filename.Rd’:
‘ssa’


In the respective file I have put:

##seealso
##\code{\link[Rssa:ssa]{ssa}}

Rssa is the package containing the ssa function (andd its help). I use 
inlinedocs to create *.Rd files with the following line out of this:


\seealso{\code{\link[Rssa:ssa]{ssa}}


How do I correctly link to the ssa help page to get rid of these error 
warnings? I have read the Writing R extensions manual but the code 
above represents my understanding (which seems to be wrong) of the 
respective paragraphs.



Thanks a lot
Jannis

__
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] Automatic formula creation

2013-08-09 Thread Alex van der Spek

Thanks much to both Peter and Rui,

I am afraid that after 5 years with R I am still not able to understand 
your method Peter. Will stick with Rui's method for now...


Alex
On 08/09/2013 04:00 PM, peter dalgaard wrote:

On Aug 9, 2013, at 13:26 , Rui Barradas wrote:


Hello,

Maybe the following gives you some idea on how to vary the terms.

idx - 1:5  # or any other indexes
ftext - paste(terms[idx], collapse = ' * ')


You're not the first to use this sort of technique - it is happening in various parts of 
R's own internals too, but handling R expressions via their textual representation is 
really not a good principle (see fortune(rethink)) and it _does_ give rise to 
problems.

I much prefer techniques like this:


nm - lapply(letters[1:6], as.name)
Reduce(function(a,b) bquote(.(a)*.(b)), nm)

a * b * c * d * e * f


Similarly, use


trm - Reduce(function(a,b) bquote(.(a)*.(b)), nm)
formula(bquote(I(1 - Pass149) ~  .(trm) - 1))

I(1 - Pass149) ~ a * b * c * d * e * f - 1




Hope this helps,

Rui Barradas


Em 09-08-2013 11:40, Alex van der Spek escreveu:

Say I want to compare all 5 term models from a choice of 28 different
predictors and one known. All possible combinations of 5 out of 28 is
easy to form by combn(). With some string manipulation it is also easy
to make a text representation of a formula which is easy to convert by
as.formula() for use in lm().

The primitive part however is pasting together the terms which I do
explicitly for 5 terms, like so:


 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
sep = ' * ')


Works but is not great as I now need to edit this formula when the
number of terms changes. There ought to be a better way but I can't find
it.

Any help much appreciated! The full block of relevant code follows:
Alex van der Spek

+


#Try all 3 band models
nbands - 5
freqs - c('4', '5', '6_3', '8', '10', '12_7', '16', '20', '25', '32',
'40', '51', '64', '81', '102', '128',
'161', '203', '256', '323', '406', '512', '645', '813',
'1024', '1290', '1625', '2048')
bands - paste(rep('kHz', 28), freqs, rep('_ave', 28), sep = '')
nc - choose(28, nbands)
combs - t(combn(bands, nbands))

models - vector(list, nc)
for (ic in 1:nc) {
 terms - c()
 for (jc in 1:nbands) {
 t - paste('log10(', combs[ic, jc], ')', sep = '')
 terms - append(terms, t)
 }

 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
sep = ' * ')

 ftext - paste('I(1 - Pass149) ~ ', ftext, ' - 1', sep = '')
 forml - as.formula(ftext)

 plus100.lm - lm(forml, data = sd, subset = Use == 'Cal')
 plus100.sm - step(plus100.lm, trace = 0)
}

__
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] For loop output

2013-08-09 Thread David Carlson
What happens when you type?

test.2 - stack(individual.proj)

assuming you want all six or

test.2 - stack(individual.proj[c(1,3, 5)])

to combine the 1st, 3rd, and 5th.

Eg. Modified from the stack help page

fn - system.file(external/test.grd, package=raster)
nfn - c(fn, fn, fn)
s - stack(nfn)
nlayers(s)

-
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: Jenny Williams [mailto:jenny.willi...@kew.org] 
Sent: Friday, August 9, 2013 6:34 AM
To: 'dcarl...@tamu.edu'; r-help@r-project.org
Subject: RE: [R] For loop output

To update on the use of this little string, I am trying to use
it to automate files to be loaded into a raster stack.
I think the issue I have with the string is related to the
backslashes. I need to just read the pure text so that the
datasets can be sourced, though I am not sure whether the stack
function will accept a string of files in this format either!

individual.proj.quote
-capture.output(write.table(matrix(individual.proj, 1),
quote=TRUE, sep=,, row.names=FALSE, col.names=FALSE))

 individual.proj.quote
[1]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img\,\Arabica/proj_current/indiv
idual_projections/proj_current_arabica_pa.data.tmp$pa.tab_Full_G
LM.img\,\Arabica/proj_current/individual_projections/proj_curr
ent_arabica_pa.data.tmp$pa.tab_Full_MARS.img\,\Arabica/proj_cu
rrent/individual_projections/proj_current_arabica_pa.data.tmp$pa
.tab_Full_RF.img 

test4 = stack(individual.proj.quote)
Cannot create a RasterLayer object from this file. (file does
not exist)


I ran a test with just one file which worked, but haven't
managed to combine more files into the stack:

test
[1]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img

 library(raster)
 test.1 = stack(test)
 test.1
class   : RasterStack 
dimensions  : 9241, 8521, 78742561, 1  (nrow, ncol, ncell,
nlayers)
resolution  : 0.00834, 0.00834  (x, y)
extent  : -18.00832, 53.1, -38.00833, 39.1  (xmin,
xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +no_defs 
names   : proj_current_arabica_pa.data.tmp.pa.tab_Full_GBM 
min values  :6 
max values  :  995


-Original Message-
From: David Carlson [mailto:dcarl...@tamu.edu] 
Sent: 08 August 2013 18:04
To: Jenny Williams; r-help@r-project.org
Subject: RE: [R] For loop output

It's not clear how you are planning to use this within R, but
you don't need a loop.

individual.proj.quote -
capture.output(write.table(matrix(individual.proj, 1),
quote=TRUE, sep=,, row.names=FALSE, col.names=FALSE))

This produces a single character string which consists of the
quoted file names separated by commas.

-
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Jenny
Williams
Sent: Thursday, August 8, 2013 10:06 AM
To: 'r-help@r-project.org'
Subject: [R] For loop output

I am having difficulty storing the output of a for loop I have
generated. All I want to do is find all the files that I have,
create a string with all of the names in quotes and separated by
commas. This is proving more difficult than I initially
anticipated.
I am sure it is either very simple or the construction of the
for loop is not quite right The result gets automatically
printed after the loop but I can't seem to save it.
I have tried to create the element in advance but the result is
the same: NULL

individual.proj =
Sys.glob(Arabica/proj_current/individual_projections/*.img,
dirmark = FALSE)
individual.proj
[1]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img
 [2]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GLM.img
 [3]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_MARS.img
 [4]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_RF.img
 [5]
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_RUN10_GBM.img


##generate loop to create string out of the table of projected
files.
L.ip = length(individual.proj)
  for (i in 1:L.ip){
   individual.proj.i - individual.proj[i]
   individual.proj.quote = cat(paste('',
individual.proj.i, '', ',',sep=))
   }
Arabica/proj_current/individual_projections/proj_current_arabic
a_pa.data.tmp$pa.tab_Full_GBM.img,Arabica/proj_current/individ
ual_projections/proj_current

##print output string
individual.proj.quote
NULL

#command to be applied to individual.proj.quote to removed the
final comma from the string 

Re: [R] errors with hurdle negative binomial mixed effect models

2013-08-09 Thread Ben Bolker
Marta Lomas lomasvega at hotmail.com writes:

 
 Hello! 

 I am new in the mailing list for R help and I hope to be able to
  formulate a good question easy to understand.

  We hope so too :-)

 [snip]

  I will take a first crack at this here, but follow-ups should
probably be redirected to the r-sig-mixed-mod...@r-project.org
mailing list, which is more appropriate for questions dealing
with (G)LMMs. 

 I am modeling my data set with hurdle negative binomial mixed
 effects, to find the correlation of some bird counts with
 environmental (categorical and continuous) variables.
 
 When I run different models I have always an error. For instance:
 
 -For the truncated modeling of the non-zero counts:
 
  HURgvgsw - glmmadmb(count~ GVG*sward + (1|week), 
   data=subset(SW_GVG,count0), + family=
 truncnbinom) 
 
 Error en glmmadmb(count ~ GVG * sward + (1 | week), data = subset(SW_GVG,  : 
 rank of X = 6  ncol(X) = 10
 
 -Or the binomial part where the zeros are modeled with the non-zeros: 
 
  HURgvgsw - glmmadmb(count~ sward*GVG + (1|week) + (1|cluster), 
  data=SW_GVG, family= binomial) 
 
 Error en glmmadmb(count ~ sward * GVG + (1 | week) + 
 (1 | cluster), data = SW_GVG,  : 
 rank of X = 13  ncol(X) = 15
 
 Would you have the solution to this?

   This error message is telling you that some of your fixed-effect
variables (which are, internally, combined into the fixed-effect
design matrix X) are perfectly multicollinear.  This is most likely
happening because sward and GVG are categorical variables (or at
least are being treated as categorical variables) and some 
combinations are missing from the data set (for future reference:
the output of summary(SW_GVG) is useful for diagnosis).

For more information, search http://glmm.wikidot.com/faq for the
word 'rank'

  Good luck 
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] Automatic formula creation

2013-08-09 Thread peter dalgaard

On Aug 9, 2013, at 18:24 , Alex van der Spek wrote:

 Thanks much to both Peter and Rui,
 
 I am afraid that after 5 years with R I am still not able to understand your 
 method Peter. Will stick with Rui's method for now...
 

Oh, come on! How about reading the first case in example(Reduce)?

-pd

 Alex
 On 08/09/2013 04:00 PM, peter dalgaard wrote:
 On Aug 9, 2013, at 13:26 , Rui Barradas wrote:
 
 Hello,
 
 Maybe the following gives you some idea on how to vary the terms.
 
 idx - 1:5  # or any other indexes
 ftext - paste(terms[idx], collapse = ' * ')
 
 You're not the first to use this sort of technique - it is happening in 
 various parts of R's own internals too, but handling R expressions via their 
 textual representation is really not a good principle (see 
 fortune(rethink)) and it _does_ give rise to problems.
 
 I much prefer techniques like this:
 
 nm - lapply(letters[1:6], as.name)
 Reduce(function(a,b) bquote(.(a)*.(b)), nm)
 a * b * c * d * e * f
 
 
 Similarly, use
 
 trm - Reduce(function(a,b) bquote(.(a)*.(b)), nm)
 formula(bquote(I(1 - Pass149) ~  .(trm) - 1))
 I(1 - Pass149) ~ a * b * c * d * e * f - 1
 
 
 
 Hope this helps,
 
 Rui Barradas
 
 
 Em 09-08-2013 11:40, Alex van der Spek escreveu:
 Say I want to compare all 5 term models from a choice of 28 different
 predictors and one known. All possible combinations of 5 out of 28 is
 easy to form by combn(). With some string manipulation it is also easy
 to make a text representation of a formula which is easy to convert by
 as.formula() for use in lm().
 
 The primitive part however is pasting together the terms which I do
 explicitly for 5 terms, like so:
 
 
 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
 sep = ' * ')
 
 
 Works but is not great as I now need to edit this formula when the
 number of terms changes. There ought to be a better way but I can't find
 it.
 
 Any help much appreciated! The full block of relevant code follows:
 Alex van der Spek
 
 +
 
 
 #Try all 3 band models
 nbands - 5
 freqs - c('4', '5', '6_3', '8', '10', '12_7', '16', '20', '25', '32',
 '40', '51', '64', '81', '102', '128',
'161', '203', '256', '323', '406', '512', '645', '813',
 '1024', '1290', '1625', '2048')
 bands - paste(rep('kHz', 28), freqs, rep('_ave', 28), sep = '')
 nc - choose(28, nbands)
 combs - t(combn(bands, nbands))
 
 models - vector(list, nc)
 for (ic in 1:nc) {
 terms - c()
 for (jc in 1:nbands) {
 t - paste('log10(', combs[ic, jc], ')', sep = '')
 terms - append(terms, t)
 }
 
 ftext - paste(terms[1], terms[2], terms[3], terms[4], terms[5],
 sep = ' * ')
 
 ftext - paste('I(1 - Pass149) ~ ', ftext, ' - 1', sep = '')
 forml - as.formula(ftext)
 
 plus100.lm - lm(forml, data = sd, subset = Use == 'Cal')
 plus100.sm - step(plus100.lm, trace = 0)
 }
 
 __
 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.
 

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.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] decimal separator from comma to dot

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 7:31 AM, maxbre wrote:

 Thanks it's the same thread I've been looking at
 But it's not answering to my  questions…

Please do read the Posting Guide. You are asked to include context. In this 
case including the citation to the Archive-stored code would have been 
courteous as well;

  not recommended 
mysub - function(x) {sub(,,.,x)}
mydata - (apply(kk, 2, mysub ))
kk1 - data.frame(apply(mydata, 2, as.numeric))


I would have expected that as.numeric(as.character(x)) to be needed rather than 
the factor-mangling as.numeric() strategy. This IS in the FAQ,
7.10 How do I convert factors to numeric?
  In this case you only have a single column that is affected so:

   df$POT_TX - as.numeric(as.character( sub(,, ., df$POT_TX )))



 View this message in context: 
 http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414p4673433.html
 Sent from the R help mailing list archive at Nabble.com.

Nabble tries very hard to confuse its users about the nature of Rhelp. It even 
omits the message below when posting content.
 
 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.

So, maxbre,  please do step up to your responsibilities. You've been posting to 
rhelp for a year and have 58 posts per the Markmail search engine.

-- 
David Winsemius
Alameda, CA, 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] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Please read the proto vignette before asking further questions about
it. It is an alternative to/version of OOP different from S3 and S4.

-- Bert

On Fri, Aug 9, 2013 at 8:13 AM, Simon Zehnder szehn...@uni-bonn.de wrote:
 Hi Martin,

 is proto in S3?

 I will take a look first at the simple package EBImage.

 Thank you very much for the suggestions!

 Best

 Simon


 On Aug 9, 2013, at 5:01 PM, Martin Morgan mtmor...@fhcrc.org wrote:

 On 08/09/2013 07:45 AM, Bert Gunter wrote:
 Simon:

 Have a look at the proto package for which there is a vignette. You
 may find it suitable for your needs and less intimidating.

 Won't help much with S4, though! Some answers here

 http://stackoverflow.com/questions/5437238/which-packages-make-good-use-of-s4-objects

 including from Bioconductor simple class in EBImage, the advanced IRanges 
 package and the 'toy' StudentGWAS.

 Martin


 Cheers,
 Bert

 On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder szehn...@uni-bonn.de wrote:
 Hi Martin,

 thank you very much for this profound answer! Your added design advice is 
 very helpful, too!

 For the 'simple example': Sometimes I am still a little overwhelmed from a 
 certain setting in the code and my ideas how I want to handle a process. 
 But I learn from session to session. In future I will also span the lines 
 more than 80 columns. I am used to the indent in my vim editor.

 I have one further issue: I do know, that you are one of the leading 
 developers of the bioconductor package which uses (as far as I have read) 
 extensively OOP in R. Is there a package you could suggest to me to learn 
 from by reading and understanding the code? Where can I find the source 
 code?

 Best

 Simon


 On Aug 8, 2013, at 10:00 PM, Martin Morgan mtmor...@fhcrc.org wrote:

 On 08/04/2013 02:13 AM, Simon Zehnder wrote:
 So, I found a solution: First in the initialize method of class C 
 coerce
 the C object into a B object. Then call the next method in the list with 
 the
 B class object. Now, in the initialize method of class B the object is 
 a B
 object and the respective generateSpec method is called. Then, in the
 initialize method of C the returned object from callNextMethod has 
 to be
 written to the C class object in .Object. See the code below.

 setMethod(initialize, C, function(.Object, value) {.Object@c - 
 value;
 object - as(.Object, B); object - callNextMethod(object, value);
 as(.Object, B) - object; .Object - generateSpec(.Object);
 return(.Object)})

 This setting works. I do not know though, if this setting is the usual 
 way
 such things are done in R OOP. Maybe the whole class design is
 disadvantageous. If anyone detects a mistaken design, I am very thankful 
 to
 learn.

 Hi Simon -- your 'simple' example is pretty complicated, and I didn't 
 really follow it in detail! The code is not formatted for easy reading 
 (e.g., lines spanning no more than 80 columns) and some of it (e.g., 
 generateSpec) might not be necessary to describe the problem you're 
 having.

 A good strategy is to ensure that 'new' called with no arguments works 
 (there are other solutions, but following this rule has helped me to keep 
 my classes and methods simple). This is not the case for

  new(A)
  new(C)

 The reason for this strategy has to do with the way inheritance is 
 implemented, in particular the coercion from derived to super class. 
 Usually it is better to provide default values for arguments to 
 initialize, and to specify arguments after a '...'. This means that your 
 initialize methods will respects the contract set out in ?initialize, in 
 particular the handling of unnamed arguments:

 ...: data to include in the new object.  Named arguments
  correspond to slots in the class definition. Unnamed
  arguments must be objects from classes that this class
  extends.

 I might have written initialize,A-method as

  setMethod(initialize, A, function(.Object, ..., value=numeric()){
  .Object - callNextMethod(.Object, ..., a=value)
  generateSpec(.Object)
  })

 Likely in a subsequent iteration I would have ended up with (using the 
 convention that function names preceded by '.' are not exported)

  .A - setClass(A, representation(a = numeric, specA = numeric))

  .generateSpecA - function(a) {
  1 / a
   }

  A - function(a=numeric(), ...) {
  specA - .generateSpecA(a)
  .A(..., a=a, specA=specA)
  }

  setMethod(generateSpec, A, function(object) {
  .generateSpecA(object@a)
  })

 ensuring that A() returns a valid object and avoiding the definition of 
 an initialize method entirely.

 Martin


 Best

 Simon


 On Aug 3, 2013, at 9:43 PM, Simon Zehnder simon.zehn...@googlemail.com
 wrote:

 setMethod(initialize, C, function(.Object, value) {.Object@c - 
 value;
 .Object - callNextMethod(.Object, value); .Object -
 generateSpec(.Object); return(.Object)})

 __ R-help@r-project.org 
 mailing
 list 

[R] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread Jun Shen
Hi all,

I used strptime() to convert character strings to time and did some
subtraction calculation.

a-'2012-07-17T07:50'
b-'2012-08-27T09:30'

strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')

The result shows

Time difference of -41.06944 days.

However when these operations performed in a dataframe, the time difference
is in the unit of seconds. Why is that? What I really want is in hours. I
know I can convert the results manually to hours but just wonder if there
is way to control the unit. Thanks.

Jun

[[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] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread jim holtman
?difftime

 difftime(strptime(a,format='%Y-%m-%dT%H:%M'),
strptime(b,format='%Y-%m-%dT%H:%M'))
Time difference of -41.06944 days
 difftime(strptime(a,format='%Y-%m-%dT%H:%M'),
strptime(b,format='%Y-%m-%dT%H:%M'), units = 'hours')
Time difference of -985.6667 hours




On Fri, Aug 9, 2013 at 1:37 PM, Jun Shen jun.shen...@gmail.com wrote:

 Hi all,

 I used strptime() to convert character strings to time and did some
 subtraction calculation.

 a-'2012-07-17T07:50'
 b-'2012-08-27T09:30'

 strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')

 The result shows

 Time difference of -41.06944 days.

 However when these operations performed in a dataframe, the time difference
 is in the unit of seconds. Why is that? What I really want is in hours. I
 know I can convert the results manually to hours but just wonder if there
 is way to control the unit. Thanks.

 Jun

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




-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

[[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] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 10:37 AM, Jun Shen wrote:

 Hi all,
 
 I used strptime() to convert character strings to time and did some
 subtraction calculation.
 
 a-'2012-07-17T07:50'
 b-'2012-08-27T09:30'
 
 strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')
 
 The result shows
 
 Time difference of -41.06944 days.
 
 However when these operations performed in a dataframe, the time difference
 is in the unit of seconds. Why is that? What I really want is in hours. I
 know I can convert the results manually to hours but just wonder if there
 is way to control the unit. Thanks.

?difftime
?`-.POSIXt`

Should provide exactly what is requested (and is linked from the 
?DateTimeClasses help page.)

-- 
David Winsemius
Alameda, CA, 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] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread Jun Shen
Thanks Jim and David,

The difftime() is exactly what I am looking for. Just out of curiosity why
the unit of output is different. here is an example of the dataframe.

test-structure(list(SPDTC = c(2012-08-27T09:30, 2012-08-06T10:08,
2012-08-13T07:41, 2012-07-17T07:50, 2012-09-11T10:29),
TimeBL = c(2012-07-17T07:50, 2012-07-17T07:50, 2012-07-17T07:50,
2012-07-17T07:50, 2012-07-17T07:50)), .Names = c(SPDTC,
TimeBL), row.names = c(NA, 5L), class = data.frame)

Here is the calculation I did originally.

with(test,strptime(SPDTC,format='%Y-%m-%dT%H:%M')-strptime(TimeBL,format='%Y-%m-%dT%H:%M'))

The result is in seconds.


On Fri, Aug 9, 2013 at 1:55 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Aug 9, 2013, at 10:37 AM, Jun Shen wrote:

  Hi all,
 
  I used strptime() to convert character strings to time and did some
  subtraction calculation.
 
  a-'2012-07-17T07:50'
  b-'2012-08-27T09:30'
 
  strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')
 
  The result shows
 
  Time difference of -41.06944 days.
 
  However when these operations performed in a dataframe, the time
 difference
  is in the unit of seconds. Why is that? What I really want is in hours. I
  know I can convert the results manually to hours but just wonder if there
  is way to control the unit. Thanks.

 ?difftime
 ?`-.POSIXt`

 Should provide exactly what is requested (and is linked from the
 ?DateTimeClasses help page.)

 --
 David Winsemius
 Alameda, CA, USA



[[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] Splitting a categorical variable into multiple variables

2013-08-09 Thread Bert Gunter
Actually, I think it's pretty trivial if you do it in a smarter way
than I previously suggested. I found this by reading ?levels (RTFM,
Bert!)

 z - factor(letters[1:3])
 levels(z)[1:2]- d ## no hardcoding names; just use indices
 z
[1] d d c
Levels: d c

Cheers,
Bert

On Fri, Aug 9, 2013 at 8:45 AM, Claus O'Rourke claus.orou...@gmail.com wrote:
 Thanks Bert. I guess I was just wondering if there was a way to create
 the new factors automatically without me having to hard code the level
 names manually in my R code.

 Rgds

 Claus

 On Fri, Aug 9, 2013 at 3:42 PM, Bert Gunter gunter.ber...@gene.com wrote:
 ... or if you want to keep the unchanged levels the same:

 zz - factor(ifelse( z %in% c(a, b),d ,levels(z)[z]))

 -- Bert

 On Fri, Aug 9, 2013 at 7:35 AM, Bert Gunter bgun...@gene.com wrote:
 If I understand what you mean, just recode them.

 z - factor(letters[1:3])
 z
 zz - factor(ifelse( z %in% c(a, b),d ,z))
 zz

 Cheers,
 Bert

 On Fri, Aug 9, 2013 at 7:10 AM, Claus O'Rourke claus.orou...@gmail.com 
 wrote:
 Hello R-Help,
 I have a variable with  32 levels and I'd like to split this into two
 variables such that both new variables have = 32 variables. This is
 to handle the limit of 32 level predictor variables in R's Random
 Forest implementation. Might someone be able to suggest an elegant way
 to do this? I've tried googling for this, but haven't hit the right
 search terms.

 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.



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] Flexmix and variance of error terms

2013-08-09 Thread Robin Tviet
Hi,
 
I am using flexmix to model some data which is modelled  with linear 
regressions.  I have results obtained along the lines of that shown below, and 
can retreive component parameters, but I cannot find a way or retrieving the 
variance of the sigma (variance of the normal model) can anyone advise how to 
do this?:
 
fm=compiledstepFlexmix(lkopsum ~ 
lfasttax+ypr+ypr2,data=land,k=k,nrep=2000,control=Fcontrol)
fmexample=fm@models$'3'
fmexample
Call:
compiledstepFlexmix(lkopsum ~ lfasttax + ypr + ypr2, data = land,
control = Fcontrol, k = 3, nrep = 500)
Cluster sizes:
  1   2   3
325 425 216
convergence after 57 iterations
 refitexample=refit(fmexample)
 summary(refitexample)
$Comp.1
 Estimate Std. Error z value  Pr(|z|)
(Intercept) 8.3713863  0.1165509 71.8260  2.2e-16 ***
lfasttax0.7921171  0.0190065 41.6762  2.2e-16 ***
ypr 0.0641430  0.0048686 13.1747  2.2e-16 ***
ypr20.0044674  0.0012131  3.6827 0.0002308 ***
---
Signif. codes:  0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â 1
$Comp.2
  Estimate Std. Error z value Pr(|z|)
(Intercept)  6.2262676  0.1340461  46.449   2e-16 ***
lfasttax 1.0864937  0.0196605  55.263   2e-16 ***
ypr  0.1129625  0.0057275  19.723   2e-16 ***
ypr2-0.0029301  0.0010706  -2.737   0.0062 **
---
Signif. codes:  0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â 1
$Comp.3
 Estimate Std. Error z value  Pr(|z|)
(Intercept) 8.4120331  0.3045145 27.6244  2.2e-16 ***
lfasttax0.6394828  0.0504086 12.6860  2.2e-16 ***
ypr 0.0701468  0.0155021  4.5250  6.04e-06 ***
ypr20.0110253  0.0034031  3.2397  0.001196 **
---
Signif. codes:  0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â 1

  
[[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] glmnet inclusion / exclusion of categorical variables

2013-08-09 Thread Kevin Shaney

Hello -

I have been using GLMNET of the following form to predict multinomial logistic 
/ class dependent variables:

mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm,
family=multinomial,standardize=FALSE)

I am using both continuous and categorical variables as predictors, and am 
using sparse.model.matrix to code my x's into a matrix.  This is changing an 
example categorical variable whose original name / values is {V1 = 1 or 2 
or 3} into two recoded variables {V12= 1 or 0 and V13 = 1 or 0}.

As i am cycling through different penalties, i would like to either have both 
recoded variables included or both excluded, but not one included - and
can't figure out how to make that work.   I tried changing the
type.multinomial option, as that looks like this option should do what i 
want, but can't get it to work (maybe the difference in recoded variable names 
is driving this).

To summarize, for categorical variables, i would like to hierarchically 
constrain inclusion / exclusion of recoded variables in the model - either all 
of the recoded variables from the same original categorical  variable are in, 
or all are out.

Thanks!
Kevin

This e-mail message contains information that may be non...{{dropped:7}}

__
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] decimal separator from comma to dot

2013-08-09 Thread maxbre
thanks david
very humbly I'm asking you and all r-help users to forgive me about
violating the rules of this great mailing list, I didn't meant to do that: I
simply slipped into that, sorry again!

...and what about the case of many variables to be changed at the same time?

seriously, I do not want to violate again the rules of the mailing list by
reissuing a new thread within another one but in fact  this question was
also intended by my initial thread (even if not well specified, I admit
that!)

thanks
good lesson learned

m



--
View this message in context: 
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414p4673461.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] decimal separator from comma to dot

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 11:58 AM, maxbre wrote:

 thanks david
 very humbly I'm asking you and all r-help users to forgive me about
 violating the rules of this great mailing list, I didn't meant to do that: I
 simply slipped into that, sorry again!
 
 ...and what about the case of many variables to be changed at the same time?

You are still failing to include context. Please learn to use Nabble correctly 
if you need to use it at all. It has provisions for including context.

 
 seriously, I do not want to violate again the rules of the mailing list by
 reissuing a new thread within another one but in fact  this question was
 also intended by my initial thread (even if not well specified, I admit
 that!)
 
 thanks
 good lesson learned
 
 m
 
 
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-tp4673414p4673461.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.

David Winsemius
Alameda, CA, 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] glmnet inclusion / exclusion of categorical variables

2013-08-09 Thread Steve Lianoglou
Hi,

On Fri, Aug 9, 2013 at 6:44 AM, Kevin Shaney kevin.sha...@rosetta.com wrote:

 Hello -

 I have been using GLMNET of the following form to predict multinomial 
 logistic / class dependent variables:

 mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm,
 family=multinomial,standardize=FALSE)

 I am using both continuous and categorical variables as predictors, and am 
 using sparse.model.matrix to code my x's into a matrix.  This is changing an 
 example categorical variable whose original name / values is {V1 = 1 or 2 
 or 3} into two recoded variables {V12= 1 or 0 and V13 = 1 or 0}.

 As i am cycling through different penalties, i would like to either have both 
 recoded variables included or both excluded, but not one included - and
 can't figure out how to make that work.   I tried changing the
 type.multinomial option, as that looks like this option should do what i 
 want, but can't get it to work (maybe the difference in recoded variable 
 names is driving this).

 To summarize, for categorical variables, i would like to hierarchically 
 constrain inclusion / exclusion of recoded variables in the model - either 
 all of the recoded variables from the same original categorical  variable are 
 in, or all are out.

Pretty sure that you'll need the grouped lasso for that. Quick
googling over CRAN suggests:

grplasso: http://cran.r-project.org/web/packages/grplasso/index.html
standGL: http://cran.r-project.org/web/packages/standGL/index.html
gglasso: http://code.google.com/p/gglasso/

Unfortunately it doesn't look like any of them support the equivalent
of family=multinomial, only 2-class classification.

HTH,
-steve

-- 
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech

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

2013-08-09 Thread Jan van der Laan

Christian,

In my original example I had an n=1E5 argument in readLines:

lines - readLines(con, n=1E5)

This ensures that every iteration of the loop only 10 lines are read 
(which should usually fit into memory). Without this argument readLines 
tries to read in the complete file.


Jan


On 08/09/2013 04:43 PM, christian.kame...@astra.admin.ch wrote:

Jan,

Many thanks for your suggestion! The code runs perfectly fine on the test set. 
Applying it to the complete data set, however, results in the following error:


while (TRUE) {

+  lines - readLines(con, encoding='LATIN1')
+  if (length(lines) == 0) break
+  lines - sprintf(%-238s, lines)
+  writeLines(lines, out, useBytes=TRUE) }
Error: cannot allocate vector of size 23.2 Mb


Best Regard

Christian Kamenik
Project Manager

Federal Department of the Environment, Transport, Energy and Communications 
DETEC
Federal Roads Office FEDRO
Division Road Traffic
Road Accident Statistics

Mailing Address: 3003 Bern
Location: Weltpoststrasse 5, 3015 Bern

Tel +41 31 323 14 89
Fax +41 31 323 43 21

christian.kame...@astra.admin.ch
www.astra.admin.ch


-Ursprüngliche Nachricht-
Von: Jan van der Laan [mailto:rh...@eoos.dds.nl]
Gesendet: Freitag, 9. August 2013 10:01
An: Kamenik Christian ASTRA
Betreff: Re: AW: AW: [R] laf_open_fwf

Christian,

It seems some of the lines in your file have additional characters at the end 
causing the line lengths to vary. The only way I could think of is to first add 
whitespace to the shorter lines to make all line lengths equal:

# Add whitespace to the end of the lines to make all lines the same length con - file(testdata.txt, 
rt) out - file(testdata_2.txt, wt) while (TRUE) {
lines - readLines(con, n=1E5)
if (length(lines) == 0) break
lines - sprintf(%-238s, lines)
writeLines(lines, out, useBytes=TRUE) }
close(con)
close(out)


I am then able to read you test file using LaF:

library(LaF)

column_widths - c(3, 28, 4, 30, 28, 6, 3, 30, 10, 26, 25, 30, 2, 5, 5) column_types - 
rep(string, length(column_widths)) column_types[c(1, 3, 7)] - integer

laf - laf_open_fwf(testdata_2.txt, column_types = column_types, 
column_widths = column_widths)


HTH,
Jan







christian.kame...@astra.admin.ch schreef:


Hello Jan

I attached an example. Any help is highly appreciated!

Kind Regard

Christian Kamenik
Project Manager

Federal Department of the Environment, Transport, Energy and
Communications DETEC Federal Roads Office FEDRO Division Road Traffic
Road Accident Statistics

Mailing Address: 3003 Bern
Location: Weltpoststrasse 5, 3015 Bern

Tel +41 31 323 14 89
Fax +41 31 323 43 21

christian.kame...@astra.admin.ch
www.astra.admin.ch
-Ursprüngliche Nachricht-
Von: Jan van der Laan [mailto:rh...@eoos.dds.nl]
Gesendet: Donnerstag, 8. August 2013 13:58
An: r-help@r-project.org
Cc: Kamenik Christian ASTRA
Betreff: Re: AW: [R] laf_open_fwf


Without example data it is difficult to give suggestions on how you
might read this file.

Are you sure your file is fixed width? Sometimes columns are neatly
aligned using whitespace (tabs/spaces). In that case you could use
read.table with the default settings.

Another possibility might be that the file is encoded in utf8. I
expect that reading it in assuming another encoding (such as latin1)
would lead to varying line sizes. Although I would expect the lengths
to be larger than the sum of your column widths (as one symbol can be
larger than one byte).

Jan



christian.kame...@astra.admin.ch schreef:


Dear Jan

Many thanks for your help. In fact, all lines are shorter than my
column width...

my.column.widths:   238
range(nchar(lines)):235 237

So, it seems I have an inconsistent file structure...
I guess there is no way to handle this in an automated way?

Best Regard

Christian Kamenik
Project Manager

Federal Department of the Environment, Transport, Energy and
Communications DETEC Federal Roads Office FEDRO Division Road Traffic
Road Accident Statistics

Mailing Address: 3003 Bern
Location: Weltpoststrasse 5, 3015 Bern

Tel +41 31 323 14 89
Fax +41 31 323 43 21

christian.kame...@astra.admin.ch
www.astra.admin.ch
-Ursprüngliche Nachricht-
Von: Jan van der Laan [mailto:rh...@eoos.dds.nl]
Gesendet: Mittwoch, 7. August 2013 20:57
An: r-help@r-project.org
Cc: Kamenik Christian ASTRA
Betreff: Re: [R] laf_open_fwf

Dear Christian,

Well... it shouldn't normally do that. The only way I can currently
think of that might cause this problem is that the file has \r\n\r\n,
which would mean that every line is followed by an empty line.

Another cause might be (although I would not really expect the
results you see) that the sum of your column widths is larger than
the actual with of the line.

You can check your line lengths using:

lines - readLines(my.filename)
nchar(lines)

Each line should have the same length and be equal to (or at least
larger than) sum(my.column.widths)

If this is not the problem: 

Re: [R] glmnet inclusion / exclusion of categorical variables

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 6:44 AM, Kevin Shaney wrote:

 
 Hello -
 
 I have been using GLMNET of the following form to predict multinomial 
 logistic / class dependent variables:
 
 mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm,
 family=multinomial,standardize=FALSE)
 
 I am using both continuous and categorical variables as predictors, and am 
 using sparse.model.matrix to code my x's into a matrix.  This is changing an 
 example categorical variable whose original name / values is {V1 = 1 or 2 
 or 3} into two recoded variables {V12= 1 or 0 and V13 = 1 or 0}.

You set their penalty factors to be 0 to at least observe the case where 
inclusion is performed. And setting the penallty factor for both to be small 
would allow you to honestly use 0 as the estimated coefficient in such cases 
where one was estimated and the other not. 

 
 As i am cycling through different penalties, i would like to either have both 
 recoded variables included or both excluded, but not one included - and
 can't figure out how to make that work.   I tried changing the
 type.multinomial option, as that looks like this option should do what i 
 want, but can't get it to work (maybe the difference in recoded variable 
 names is driving this).

Doesn't the 'family' argument, used to set what I think you are calling 'type', 
just refer to the y argument, rather  than the predictors. You may want:

   mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm, type.multinomial=grouped,
 family=multinomial,standardize=FALSE)

 
 To summarize, for categorical variables, i would like to hierarchically 
 constrain inclusion / exclusion of recoded variables in the model - either 
 all of the recoded variables from the same original categorical  variable are 
 in, or all are out.

I do understand that I am possibly not directly answering your question, but in 
some respect I wonder if it deserves an answer. I think it is meaningful if 
some factor levels are penalized-out of models.

-- 
David Winsemius
Alameda, CA, 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] Plotting zoo objects with chron axis

2013-08-09 Thread Enrico Schumann
On Fri, 09 Aug 2013, Manta mantin...@libero.it writes:

 Dear all,

 I have a problem which I'm not to fix. I have the following two series:

 a=structure(c(33242.5196150509, 34905.8434338503, 38490.6957848689, 
 38747.0287172129, 38919.1028597142, 39026.3956586941, 38705.5344288997, 
 38545.6274379387, 38651.2079354205, 38748.2769580121), index =
 structure(c(14029, 
 14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
 ), class = Date), class = zoo)

 b=structure(c(53337.7643740991, 52210.2079727035, 50235.4480363949, 
 50667.1147389469, 50796.5403152116, 51113.5420947436, 51003.3603311344, 
 50654.0539778796, 49927.5267060329, 49320.1813921822), index =
 structure(c(14029, 
 14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
 ), class = Date), class = zoo)

 I want to plot them on the same chart, with the x-axis the Date, and the
 y-axis the time in format %H:%M. At the moment, the y series is expressed in
 seconds from midnight. I am confused with the as.POSIXct conversion.

 hours(min(rollrep))
 [1] 9
 minutes(min(rollrep))
 [1] 34
 seconds(min(rollrep))
 [1] 27

 however, by doing the following it seems the minimum time is 11:09, which is
 not true.

 as.POSIXct(round(min(rollrep)),origin=Sys.Date())
 [1] 2013-08-09 11:09:14 CEST

 Do you have any advice? Is there a way to plot only the hours and minutes,
 without having to go to the Sys.Date?

 Thank you,
 Marco

Please provide a *reproducible* example.  (What is 'rollrep'?  'Seconds
from midnight' may be ambiguous when there was a change to/from
summertime or when time zones are relevant.)

Perhaps something like this:

  require(zoo)
  plot(merge(a, b), plot.type = single, yaxt = n)
  midnight - ISOdatetime(2013, 1, 1, 0, 0, 0, GMT)
  sq - seq(0, 86400, by = 300)
  axis(2, at = sq, labels = format(midnight + sq, %H:%M))


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

__
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] decimal separator from comma to dot

2013-08-09 Thread mbressan
This is my reproducible example

df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L, 
37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L, 
4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L, 
6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L, 
50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L, 
2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002 
), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L, 
2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class =
factor)), .Names = c(IDANT, 
N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA, 
10L), class = data.frame) 

from david winsemius reply (quite annoyed by me, sorry for that!)
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-td4673414.html#a4673461
and from faq 7.10
I learnt this is the correct way to perform the conversion from factor to
number for a single variable

df$POT_TX - as.numeric(as.character( sub(,, ., df$POT_TX )))

but what about the case of more than one column (variable) in a data frame?

I hope now my question is fine with the rules of this mailing list

thank you all for the patiente
I'm learning a lot


max

__
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] lattice yscale.components: use multiple convenience functions

2013-08-09 Thread Taylor, Sean D
Not sure if this what you were recommending that I do, but based on what I saw 
in figures 8.4 and 8.5, I was able to combine the yscale.components.log10ticks 
function definition with that of yscale.components.logpower into my own custom 
function:

###default .log10ticks:
 yscale.components.log10ticks
function (lim, logsc = FALSE, at = NULL, ...) 
{
ans - yscale.components.default(lim = lim, logsc = logsc, 
at = at, ...)
if (is.null(at)) 
return(ans)
if (identical(logsc, FALSE)) 
return(ans)
logbase - logsc
if (identical(logbase, TRUE)) 
logbase - 10
if (identical(logbase, e)) 
logbase - exp(1)
tick.at - logTicks(logbase^lim, loc = 1:9)
tick.at.major - logTicks(logbase^lim, loc = 1)
major - tick.at %in% tick.at.major
ans$left$ticks$at - log(tick.at, logbase)
ans$left$ticks$tck - ifelse(major, 1, 0.5)
ans$left$labels$at - log(tick.at, logbase)
ans$left$labels$labels - as.character(tick.at)
ans$left$labels$labels[!major] - 
ans$left$labels$check.overlap - FALSE
ans
}

default .logpower:
 yscale.components.logpower
function (lim, ...) 
{
ans - yscale.components.default(lim, ...)
ans$left$labels$labels - parse(text = ans$left$labels$labels)
ans
}


#Combine the two functions:
yscale.components.logpowerTicks-function (lim, logsc = FALSE, at = NULL, ...) 
{
  ans - yscale.components.default(lim = lim, logsc = logsc, 
   at = at, ...)
  if (is.null(at)) 
return(ans)
  if (identical(logsc, FALSE)) 
return(ans)
  logbase - logsc
  if (identical(logbase, TRUE)) 
logbase - 10
  if (identical(logbase, e)) 
logbase - exp(1)
  tick.at - logTicks(logbase^lim, loc = 1:9)
  tick.at.major - logTicks(logbase^lim, loc = 1)
  major - tick.at %in% tick.at.major
  ans$left$ticks$at - log(tick.at, logbase)
  ans$left$ticks$tck - ifelse(major, 1, 0.5)
  ans$left$labels$at - log(tick.at, logbase)

This is the line that I changed
ans$left$labels$labels - parse(text=(paste0(logbase, '^', 
ans$left$labels$at)))
##

  ans$left$labels$labels[!major] - 
  ans$left$labels$check.overlap - FALSE
  ans
}

##It seems that if you define this yourself, you also have to explicitly define 
this helper function:
logTicks - function (lim, loc = c(1, 5)) {
  ii - floor(log10(range(lim))) + c(-1, 2)
  main - 10^(ii[1]:ii[2])
  r - as.numeric(outer(loc, main, *))
  r[lim[1] = r  r = lim[2]]
}

It seems to do what I want:
xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
   scales = list(x = list(log = 10), y = list(log = 10)),
   yscale.components = yscale.components.logpowerTicks)

Is there a way to automatically load this function when I start R so it is 
always available when I want it?

Thanks,
Sean


 -Original Message-
 From: David Winsemius [mailto:dwinsem...@comcast.net]
 Sent: Tuesday, August 06, 2013 10:54 AM
 To: Taylor, Sean D
 Cc: r-help@r-project.org
 Subject: Re: [R] lattice yscale.components: use multiple convenience
 functions
 
 
 On Aug 6, 2013, at 9:09 AM, Taylor, Sean D wrote:
 
  Good morning,
 
  I really enjoy some of the recent convenience functions in lattice_0.20-15
 and latticeExtra_0.6-24. I am wondering if there is a way to use multiple
 functions in the same call? Specifically, I would like to be able to use
 yscale.components.log10ticks (to get the major tick marks at powers of 10
 and minor tick marks in between) and also label the major tick marks smartly
 using superscripts for the power. Something along the lines of this:
 
 See the code supporting figures 8.4 and 8.5 in Sarkar's Lattice book.
 
 --
 David.
 
  ##Pseudocode, does not work
  xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
scales = list(x = list(log = 2), y = list(log = 10)),
xscale.components = xscale.components.fractions,
yscale.components = list(yscale.components.log10ticks,
 yscale.components.logpower))
 
  or this:
  ##Does not work
  xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
scales = list(x = list(log = 2), y = list(log = 10)),
xscale.components = xscale.components.fractions,
yscale.components = function(...){
  yscale.components.log10ticks
  yscale.components.logpower}
)
 
  Thanks!
  Sean
 
  Sean Taylor
  Post-doctoral Fellow
  Fred Hutchinson Cancer Research Center
  206-667-5544
 
 
  [[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.
 
 David Winsemius
 Alameda, CA, USA

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

Re: [R] decimal separator from comma to dot

2013-08-09 Thread Rui Barradas

Hello,

To change several columns you can use lapply. In what follows, idx is 
the vector of column numbers, corresponding to the columns you want to 
change:



idx - 6  # column numbers
df[idx] - lapply(df[idx], function(x) as.numeric(sub(,, ., 
as.character(x


# check the result
str(df)


Hope this helps,

Rui Barradas


Em 09-08-2013 20:35, mbres...@arpa.veneto.it escreveu:

This is my reproducible example

df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L,
37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L,
4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L,
6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L,
50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002
), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L,
2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class =
factor)), .Names = c(IDANT,
N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA,
10L), class = data.frame)

from david winsemius reply (quite annoyed by me, sorry for that!)
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-td4673414.html#a4673461
and from faq 7.10
I learnt this is the correct way to perform the conversion from factor to
number for a single variable

df$POT_TX - as.numeric(as.character( sub(,, ., df$POT_TX )))

but what about the case of more than one column (variable) in a data frame?

I hope now my question is fine with the rules of this mailing list

thank you all for the patiente
I'm learning a lot


max

__
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] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread MacQueen, Don
The Details section of the help page for difftime explains why.

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/9/13 11:02 AM, Jun Shen jun.shen...@gmail.com wrote:

Thanks Jim and David,

The difftime() is exactly what I am looking for. Just out of curiosity why
the unit of output is different. here is an example of the dataframe.

test-structure(list(SPDTC = c(2012-08-27T09:30, 2012-08-06T10:08,
2012-08-13T07:41, 2012-07-17T07:50, 2012-09-11T10:29),
TimeBL = c(2012-07-17T07:50, 2012-07-17T07:50, 2012-07-17T07:50,
2012-07-17T07:50, 2012-07-17T07:50)), .Names = c(SPDTC,
TimeBL), row.names = c(NA, 5L), class = data.frame)

Here is the calculation I did originally.

with(test,strptime(SPDTC,format='%Y-%m-%dT%H:%M')-strptime(TimeBL,format=
'%Y-%m-%dT%H:%M'))

The result is in seconds.


On Fri, Aug 9, 2013 at 1:55 PM, David Winsemius
dwinsem...@comcast.netwrote:


 On Aug 9, 2013, at 10:37 AM, Jun Shen wrote:

  Hi all,
 
  I used strptime() to convert character strings to time and did some
  subtraction calculation.
 
  a-'2012-07-17T07:50'
  b-'2012-08-27T09:30'
 
  
strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')
 
  The result shows
 
  Time difference of -41.06944 days.
 
  However when these operations performed in a dataframe, the time
 difference
  is in the unit of seconds. Why is that? What I really want is in
hours. I
  know I can convert the results manually to hours but just wonder if
there
  is way to control the unit. Thanks.

 ?difftime
 ?`-.POSIXt`

 Should provide exactly what is requested (and is linked from the
 ?DateTimeClasses help page.)

 --
 David Winsemius
 Alameda, CA, USA



   [[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] lattice yscale.components: use multiple convenience functions

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 12:50 PM, Taylor, Sean D wrote:

 Not sure if this what you were recommending that I do, but based on what I 
 saw in figures 8.4 and 8.5, I was able to combine the 
 yscale.components.log10ticks function definition with that of 
 yscale.components.logpower into my own custom function:

Yep. That what I was recommending. And to answer the question at the end, read 
?Startup and add it to your .Rprofile file in your working directory of choice 
or your Rprofile.site to have it always available. I have code (probably copied 
from an Rhelp posting that I can no longer attribute properly)  that applies a 
timestamp to the left side of all of my lattice plots:

lattice.options(default.args = list(page = function(n) {
   panel.text(lab = sprintf(%s, date()), x = 0.01, y = 0.01, adj = 0, srt=90)
}))

-- 
David.

 
 ###default .log10ticks:
 yscale.components.log10ticks
 function (lim, logsc = FALSE, at = NULL, ...) 
 {
ans - yscale.components.default(lim = lim, logsc = logsc, 
at = at, ...)
if (is.null(at)) 
return(ans)
if (identical(logsc, FALSE)) 
return(ans)
logbase - logsc
if (identical(logbase, TRUE)) 
logbase - 10
if (identical(logbase, e)) 
logbase - exp(1)
tick.at - logTicks(logbase^lim, loc = 1:9)
tick.at.major - logTicks(logbase^lim, loc = 1)
major - tick.at %in% tick.at.major
ans$left$ticks$at - log(tick.at, logbase)
ans$left$ticks$tck - ifelse(major, 1, 0.5)
ans$left$labels$at - log(tick.at, logbase)
ans$left$labels$labels - as.character(tick.at)
ans$left$labels$labels[!major] - 
ans$left$labels$check.overlap - FALSE
ans
 }
 
 default .logpower:
 yscale.components.logpower
 function (lim, ...) 
 {
ans - yscale.components.default(lim, ...)
ans$left$labels$labels - parse(text = ans$left$labels$labels)
ans
 }
 
 
 #Combine the two functions:
 yscale.components.logpowerTicks-function (lim, logsc = FALSE, at = NULL, 
 ...) 
 {
  ans - yscale.components.default(lim = lim, logsc = logsc, 
   at = at, ...)
  if (is.null(at)) 
return(ans)
  if (identical(logsc, FALSE)) 
return(ans)
  logbase - logsc
  if (identical(logbase, TRUE)) 
logbase - 10
  if (identical(logbase, e)) 
logbase - exp(1)
  tick.at - logTicks(logbase^lim, loc = 1:9)
  tick.at.major - logTicks(logbase^lim, loc = 1)
  major - tick.at %in% tick.at.major
  ans$left$ticks$at - log(tick.at, logbase)
  ans$left$ticks$tck - ifelse(major, 1, 0.5)
  ans$left$labels$at - log(tick.at, logbase)
 
 This is the line that I changed
ans$left$labels$labels - parse(text=(paste0(logbase, '^', 
 ans$left$labels$at)))
 ##
 
  ans$left$labels$labels[!major] - 
  ans$left$labels$check.overlap - FALSE
  ans
 }
 
 ##It seems that if you define this yourself, you also have to explicitly 
 define this helper function:
 logTicks - function (lim, loc = c(1, 5)) {
  ii - floor(log10(range(lim))) + c(-1, 2)
  main - 10^(ii[1]:ii[2])
  r - as.numeric(outer(loc, main, *))
  r[lim[1] = r  r = lim[2]]
 }
 
 It seems to do what I want:
 xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
   scales = list(x = list(log = 10), y = list(log = 10)),
   yscale.components = yscale.components.logpowerTicks)
 
 Is there a way to automatically load this function when I start R so it is 
 always available when I want it?
 
 Thanks,
 Sean
 
 
 -Original Message-
 From: David Winsemius [mailto:dwinsem...@comcast.net]
 Sent: Tuesday, August 06, 2013 10:54 AM
 To: Taylor, Sean D
 Cc: r-help@r-project.org
 Subject: Re: [R] lattice yscale.components: use multiple convenience
 functions
 
 
 On Aug 6, 2013, at 9:09 AM, Taylor, Sean D wrote:
 
 Good morning,
 
 I really enjoy some of the recent convenience functions in lattice_0.20-15
 and latticeExtra_0.6-24. I am wondering if there is a way to use multiple
 functions in the same call? Specifically, I would like to be able to use
 yscale.components.log10ticks (to get the major tick marks at powers of 10
 and minor tick marks in between) and also label the major tick marks smartly
 using superscripts for the power. Something along the lines of this:
 
 See the code supporting figures 8.4 and 8.5 in Sarkar's Lattice book.
 
 --
 David.
 
 ##Pseudocode, does not work
 xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
  scales = list(x = list(log = 2), y = list(log = 10)),
  xscale.components = xscale.components.fractions,
  yscale.components = list(yscale.components.log10ticks,
   yscale.components.logpower))
 
 or this:
 ##Does not work
 xyplot((1:200)/20 ~ (1:200)/20, type = c(p, g),
  scales = list(x = list(log = 2), y = list(log = 10)),
  xscale.components = xscale.components.fractions,
  yscale.components = function(...){
yscale.components.log10ticks
yscale.components.logpower}
  )
 
 Thanks!
 Sean
 
 Sean Taylor
 Post-doctoral Fellow
 Fred Hutchinson Cancer 

Re: [R] decimal separator from comma to dot

2013-08-09 Thread mbressan
YES, THANK YOU ALL
for the good lessons learned both about the netiquette of this mailing
list and the R coding

max

 Hi,
 Try:
  df$POT2_TX- df$POT_TX
 df[,6:7]- lapply(df[,6:7],function(x)
 as.numeric(as.character(sub(,,.,x
  str(df)
 #'data.frame':    10 obs. of  7 variables:
 # $ IDANT    : int  37837 37838 37839 37840 37841 37842 37843 40720 40721
 40722
 # $ N_TX : int  6 6 6 4 1 1 1 2 2 1
 # $ TILT : int  0 0 0 0 6 6 6 0 0 0
 # $ DIREZIONE: int  50 220 110 50 220 110 50 170 70 270
 # $ DATA_INI : Factor w/ 2 levels 20/10/2004,29/08/2002: 2 2 2 2 2 2 2
 1 1 1
 # $ POT_TX   : num  8 8 8 4 11.5 11.5 11.5 10 10 10
 # $ POT2_TX  : num  8 8 8 4 11.5 11.5 11.5 10 10 10
 A.K.



 - Original Message -
 From: mbres...@arpa.veneto.it mbres...@arpa.veneto.it
 To: David Winsemius dwinsem...@comcast.net
 Cc: r-help@r-project.org; maxbre mbres...@arpa.veneto.it
 Sent: Friday, August 9, 2013 3:35 PM
 Subject: Re: [R] decimal separator from comma to dot

 This is my reproducible example

 df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L, 
 37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L, 
 4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L, 
 6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L, 
 50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L, 
 2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002 
 ), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L, 
 2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class =
 factor)), .Names = c(IDANT, 
 N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA, 
 10L), class = data.frame) 

 from david winsemius reply (quite annoyed by me, sorry for that!)
 http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-td4673414.html#a4673461
 and from faq 7.10
 I learnt this is the correct way to perform the conversion from factor to
 number for a single variable

 df$POT_TX - as.numeric(as.character( sub(,, ., df$POT_TX )))

 but what about the case of more than one column (variable) in a data
 frame?

 I hope now my question is fine with the rules of this mailing list

 thank you all for the patiente
 I'm learning a lot


 max

 __
 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] Can ODBC or JDBC calls R?

2013-08-09 Thread Li, Yan
Hi R helpers,

I know there are packages RODBC and RJDBC to enable R to access ODBC and JDBC 
data.  Is there a package/software to do the reverse way: calling R from ODBC 
or JDBC? Thank you.

Regards,
Yan

[[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] The time unit of strptime() after performing arithmetic calculation

2013-08-09 Thread Jeff Newmiller
The printed view of a difftime object is not necessarily reflective of its 
internal representation. Also, to avoid unpleasant surprises always use a 
conversion function with specified units (not auto) if you want to convert 
between numeric and difftime.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Jun Shen jun.shen...@gmail.com wrote:
Thanks Jim and David,

The difftime() is exactly what I am looking for. Just out of curiosity
why
the unit of output is different. here is an example of the dataframe.

test-structure(list(SPDTC = c(2012-08-27T09:30, 2012-08-06T10:08,
2012-08-13T07:41, 2012-07-17T07:50, 2012-09-11T10:29),
 TimeBL = c(2012-07-17T07:50, 2012-07-17T07:50, 2012-07-17T07:50,
2012-07-17T07:50, 2012-07-17T07:50)), .Names = c(SPDTC,
TimeBL), row.names = c(NA, 5L), class = data.frame)

Here is the calculation I did originally.

with(test,strptime(SPDTC,format='%Y-%m-%dT%H:%M')-strptime(TimeBL,format='%Y-%m-%dT%H:%M'))

The result is in seconds.


On Fri, Aug 9, 2013 at 1:55 PM, David Winsemius
dwinsem...@comcast.netwrote:


 On Aug 9, 2013, at 10:37 AM, Jun Shen wrote:

  Hi all,
 
  I used strptime() to convert character strings to time and did some
  subtraction calculation.
 
  a-'2012-07-17T07:50'
  b-'2012-08-27T09:30'
 
 
strptime(a,format='%Y-%m-%dT%H:%M')-strptime(b,format='%Y-%m-%dT%H:%M')
 
  The result shows
 
  Time difference of -41.06944 days.
 
  However when these operations performed in a dataframe, the time
 difference
  is in the unit of seconds. Why is that? What I really want is in
hours. I
  know I can convert the results manually to hours but just wonder if
there
  is way to control the unit. Thanks.

 ?difftime
 ?`-.POSIXt`

 Should provide exactly what is requested (and is linked from the
 ?DateTimeClasses help page.)

 --
 David Winsemius
 Alameda, CA, USA



   [[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] decimal separator from comma to dot

2013-08-09 Thread arun
Hi,
Try:
 df$POT2_TX- df$POT_TX
df[,6:7]- lapply(df[,6:7],function(x) as.numeric(as.character(sub(,,.,x
 str(df)
#'data.frame':    10 obs. of  7 variables:
# $ IDANT    : int  37837 37838 37839 37840 37841 37842 37843 40720 40721 40722
# $ N_TX : int  6 6 6 4 1 1 1 2 2 1
# $ TILT : int  0 0 0 0 6 6 6 0 0 0
# $ DIREZIONE: int  50 220 110 50 220 110 50 170 70 270
# $ DATA_INI : Factor w/ 2 levels 20/10/2004,29/08/2002: 2 2 2 2 2 2 2 1 1 1
# $ POT_TX   : num  8 8 8 4 11.5 11.5 11.5 10 10 10
# $ POT2_TX  : num  8 8 8 4 11.5 11.5 11.5 10 10 10
A.K.



- Original Message -
From: mbres...@arpa.veneto.it mbres...@arpa.veneto.it
To: David Winsemius dwinsem...@comcast.net
Cc: r-help@r-project.org; maxbre mbres...@arpa.veneto.it
Sent: Friday, August 9, 2013 3:35 PM
Subject: Re: [R] decimal separator from comma to dot

This is my reproducible example

df-structure(list(IDANT = c(37837L, 37838L, 37839L, 37840L, 37841L, 
37842L, 37843L, 40720L, 40721L, 40722L), N_TX = c(6L, 6L, 6L, 
4L, 1L, 1L, 1L, 2L, 2L, 1L), TILT = c(0L, 0L, 0L, 0L, 6L, 6L, 
6L, 0L, 0L, 0L), DIREZIONE = c(50L, 220L, 110L, 50L, 220L, 110L, 
50L, 170L, 70L, 270L), DATA_INI = structure(c(2L, 2L, 2L, 2L, 
2L, 2L, 2L, 1L, 1L, 1L), .Label = c(20/10/2004, 29/08/2002 
), class = factor), POT_TX = structure(c(4L, 4L, 4L, 3L, 2L, 
2L, 2L, 1L, 1L, 1L), .Label = c(10, 11,5, 4, 8), class =
factor)), .Names = c(IDANT, 
N_TX, TILT, DIREZIONE, DATA_INI, POT_TX), row.names = c(NA, 
10L), class = data.frame) 

from david winsemius reply (quite annoyed by me, sorry for that!)
http://r.789695.n4.nabble.com/decimal-separator-from-comma-to-dot-td4673414.html#a4673461
and from faq 7.10
I learnt this is the correct way to perform the conversion from factor to
number for a single variable

df$POT_TX - as.numeric(as.character( sub(,, ., df$POT_TX )))

but what about the case of more than one column (variable) in a data frame?

I hope now my question is fine with the rules of this mailing list

thank you all for the patiente
I'm learning a lot


max

__
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] Varying statistical significance in estimates of linear model

2013-08-09 Thread Stathis Kamperis
For archiving reasons:

1. Practical Regression and Anova using R by Faraway
2. Possible reason: multi-collinearity in predictor variables.

Thanks everybody!

On Thu, Aug 8, 2013 at 1:43 PM, Stathis Kamperis ekamp...@gmail.com wrote:
 Hi everyone,

 I have a response variable 'y' and several predictor variables 'x_i'.
 I start with a linear model:

 m1 - lm(y ~ x1); summary(m1)

 and I get a statistically significant estimate for 'x1'. Then, I
 modify my model as:

 m2 - lm(y ~ x1 + x2); summary(m2)

 At this moment, the estimate for x1 might become non-significant while
 the estimate of x2 significant.

 As I add more predictor variables (or interaction terms), the
 estimates for which I get a statistically significant result vary. So
 sometimes x1, x2, x6 are significant, while others, x2, x4, x5 are.

 It seems to me that I could tweak my model in such a way (by
 adding/removing predictor variables or suitable interaction terms)
 that I could prove whatever I'd like to prove.

 What is the proper methodology involved here ? What do you people do
 in such cases ? I can provide the data if anyone cares and would like
 to have a look at them.

 Best regards,
 Stathis Kamperis

__
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] glmnet inclusion / exclusion of categorical variables

2013-08-09 Thread kevin.shaney
Thanks!  I tried doing the type.multinomial=grouped argument - but it didn't 
work for me.  Maybe I did something wrong.  I thought I understood why it 
didn't work because of sparse.model.matrix recoding variables (like below to 
V12  V13} makes GLMNET unable to tell that they actually came from the same 
source categorical variable.  Has that option ever worked for you in a similar 
situation?

Thanks!
Kevin

From: David Winsemius [via R] [mailto:ml-node+s789695n4673463...@n4.nabble.com]
Sent: Friday, August 09, 2013 3:14 PM
To: Kevin Shaney
Subject: Re: glmnet inclusion / exclusion of categorical variables


On Aug 9, 2013, at 6:44 AM, Kevin Shaney wrote:


 Hello -

 I have been using GLMNET of the following form to predict multinomial 
 logistic / class dependent variables:

 mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm,
 family=multinomial,standardize=FALSE)

 I am using both continuous and categorical variables as predictors, and am 
 using sparse.model.matrix to code my x's into a matrix.  This is changing an 
 example categorical variable whose original name / values is {V1 = 1 or 2 
 or 3} into two recoded variables {V12= 1 or 0 and V13 = 1 or 0}.

You set their penalty factors to be 0 to at least observe the case where 
inclusion is performed. And setting the penallty factor for both to be small 
would allow you to honestly use 0 as the estimated coefficient in such cases 
where one was estimated and the other not.


 As i am cycling through different penalties, i would like to either have both 
 recoded variables included or both excluded, but not one included - and
 can't figure out how to make that work.   I tried changing the
 type.multinomial option, as that looks like this option should do what i 
 want, but can't get it to work (maybe the difference in recoded variable 
 names is driving this).

Doesn't the 'family' argument, used to set what I think you are calling 'type', 
just refer to the y argument, rather  than the predictors. You may want:

   mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm, type.multinomial=grouped,
 family=multinomial,standardize=FALSE)


 To summarize, for categorical variables, i would like to hierarchically 
 constrain inclusion / exclusion of recoded variables in the model - either 
 all of the recoded variables from the same original categorical  variable are 
 in, or all are out.

I do understand that I am possibly not directly answering your question, but in 
some respect I wonder if it deserves an answer. I think it is meaningful if 
some factor levels are penalized-out of models.

--
David Winsemius
Alameda, CA, USA

__
[hidden email]/user/SendEmail.jtp?type=nodenode=4673463i=0 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.


If you reply to this email, your message will be added to the discussion below:
http://r.789695.n4.nabble.com/glmnet-inclusion-exclusion-of-categorical-variables-tp4673400p4673463.html
To unsubscribe from glmnet inclusion / exclusion of categorical variables, 
click 
herehttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=4673400code=a2V2aW4uc2hhbmV5QHJvc2V0dGEuY29tfDQ2NzM0MDB8MTI2ODM3OTQw.
NAMLhttp://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml


This e-mail message contains information that may be non...{{dropped:13}}

__
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] glmnet inclusion / exclusion of categorical variables

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 12:52 PM, kevin.shaney wrote:

 Thanks!  I tried doing the type.multinomial=grouped argument - but it 
 didn't work for me.  Maybe I did something wrong.  I thought I understood why 
 it didn't work because of sparse.model.matrix recoding variables (like below 
 to V12  V13} makes GLMNET unable to tell that they actually came from the 
 same source categorical variable.  Has that option ever worked for you in a 
 similar situation?

I wondered after posting if using the sparse.model.matrix input could be 
getting in the way of whatever grouping behavior might be occuring (which is 
conducted behind the scenes in a non-exported function). I've never attempted 
using it, and only asked the question because you didn't specifically say that 
you had used it in the fashion described in help page.

-- 
David.

 
 Thanks!
 Kevin
 
 From: David Winsemius [via R] 
 [mailto:ml-node+s789695n4673463...@n4.nabble.com]
 Sent: Friday, August 09, 2013 3:14 PM
 To: Kevin Shaney
 Subject: Re: glmnet inclusion / exclusion of categorical variables
 
 
 On Aug 9, 2013, at 6:44 AM, Kevin Shaney wrote:
 
 
 Hello -
 
 I have been using GLMNET of the following form to predict multinomial 
 logistic / class dependent variables:
 
 mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm,
 family=multinomial,standardize=FALSE)
 
 I am using both continuous and categorical variables as predictors, and am 
 using sparse.model.matrix to code my x's into a matrix.  This is changing an 
 example categorical variable whose original name / values is {V1 = 1 or 
 2 or 3} into two recoded variables {V12= 1 or 0 and V13 = 1 or 
 0}.
 
 You set their penalty factors to be 0 to at least observe the case where 
 inclusion is performed. And setting the penallty factor for both to be small 
 would allow you to honestly use 0 as the estimated coefficient in such 
 cases where one was estimated and the other not.
 
 
 As i am cycling through different penalties, i would like to either have 
 both recoded variables included or both excluded, but not one included - and
 can't figure out how to make that work.   I tried changing the
 type.multinomial option, as that looks like this option should do what i 
 want, but can't get it to work (maybe the difference in recoded variable 
 names is driving this).
 
 Doesn't the 'family' argument, used to set what I think you are calling 
 'type', just refer to the y argument, rather  than the predictors. You may 
 want:
 
   mglmnet=glmnet(xxb,yb ,alpha=ty,dfmax=dfm, type.multinomial=grouped,
 family=multinomial,standardize=FALSE)
 
 
 To summarize, for categorical variables, i would like to hierarchically 
 constrain inclusion / exclusion of recoded variables in the model - either 
 all of the recoded variables from the same original categorical  variable 
 are in, or all are out.
 
 I do understand that I am possibly not directly answering your question, but 
 in some respect I wonder if it deserves an answer. I think it is meaningful 
 if some factor levels are penalized-out of models.
 
 --
 David Winsemius
 Alameda, CA, USA
 


David Winsemius
Alameda, CA, 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] linking to help pages in other packages

2013-08-09 Thread ONKELINX, Thierry
Dear Jannis,

I think you want \link[package]{function} instead of 
\link[package:function]{function}

\link[Rssa]{ssa}

Best regards,

Thierry

Van: r-help-boun...@r-project.org [r-help-boun...@r-project.org] namens Jannis 
[bt_jan...@yahoo.de]
Verzonden: vrijdag 9 augustus 2013 18:23
Aan: r-help@r-project.org
Onderwerp: [R] linking to help pages in other packages

Dear R users,

i am trying to get a package compatible with the R CMD check routine but
I get errors like this:

Missing link(s) in documentation object ‘path/filename.Rd’:
‘ssa’


In the respective file I have put:

##seealso
##\code{\link[Rssa:ssa]{ssa}}

Rssa is the package containing the ssa function (andd its help). I use
inlinedocs to create *.Rd files with the following line out of this:

\seealso{\code{\link[Rssa:ssa]{ssa}}


How do I correctly link to the ssa help page to get rid of these error
warnings? I have read the Writing R extensions manual but the code
above represents my understanding (which seems to be wrong) of the
respective paragraphs.


Thanks a lot
Jannis

__
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.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en 
binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is 
door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the 
writer and may not be regarded as stating an official position of INBO, as long 
as the message is not confirmed by a duly signed document.

__
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] easiest way to put italics words in sentences plotted with text()?

2013-08-09 Thread Nick Matzke

Hi,

I am plotting some labels that consist of strings in which 
some words (but only some) should be in italics.


E.g.

M3: Homo, 5 areas, 2 areas max

M4: Pan, 3 areas, 2 areas max

I am putting these on the plot with the text() command.  The 
words Homo and Pan should be italicized, since they are 
genus names.  Is there some sneaky code to insert italics 
for certain words?  I would rather not have to break up the 
string and plot every word separately, or similar insanity.


Any help much appreciated!

Cheers,
Nick




--

Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher

Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Graduate Student Instructor, IB200B
Principles of Phylogenetics: Ecology and Evolution
http://ib.berkeley.edu/courses/ib200b/
http://phylo.wikidot.com/


Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: 
http://ib.berkeley.edu/people/students/person_detail.php?person=370
Lab personal page: 
http://fisher.berkeley.edu/cteg/members/matzke.html

Lab phone: 510-643-6299
Dept. fax: 510-643-6264

Cell phone: 510-301-0179
Email: mat...@berkeley.edu

Mailing address:
Department of Integrative Biology
1005 Valley Life Sciences Building #3140
Berkeley, CA 94720-3140

-
[W]hen people thought the earth was flat, they were wrong. 
When people thought the earth was spherical, they were 
wrong. But if you think that thinking the earth is spherical 
is just as wrong as thinking the earth is flat, then your 
view is wronger than both of them put together.


Isaac Asimov (1989). The Relativity of Wrong. The 
Skeptical Inquirer, 14(1), 35-44. Fall 1989.

http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm

__
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] easiest way to put italics words in sentences plotted with text()?

2013-08-09 Thread arun
Hi,
May be this gets you started:

plot(1,1,xlim=0:1,ylim=0:1)
text(0.6,0.8, expression(M3:~italic(Homo)~paste(,,  5 areas, 2 areas 
max,sep=)))
 text(0.6,0.4, expression(M4:~italic(Pan)~paste(,,  3 areas, 2 areas 
max,sep=)))

A.K.

- Original Message -
From: Nick Matzke mat...@berkeley.edu
To: R-help@r-project.org
Cc: 
Sent: Friday, August 9, 2013 10:05 PM
Subject: [R] easiest way to put italics words in sentences plotted with text()?

Hi,

I am plotting some labels that consist of strings in which 
some words (but only some) should be in italics.

E.g.

M3: Homo, 5 areas, 2 areas max

M4: Pan, 3 areas, 2 areas max

I am putting these on the plot with the text() command.  The 
words Homo and Pan should be italicized, since they are 
genus names.  Is there some sneaky code to insert italics 
for certain words?  I would rather not have to break up the 
string and plot every word separately, or similar insanity.

Any help much appreciated!

Cheers,
Nick




-- 

Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher

Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Graduate Student Instructor, IB200B
Principles of Phylogenetics: Ecology and Evolution
http://ib.berkeley.edu/courses/ib200b/
http://phylo.wikidot.com/


Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: 
http://ib.berkeley.edu/people/students/person_detail.php?person=370
Lab personal page: 
http://fisher.berkeley.edu/cteg/members/matzke.html
Lab phone: 510-643-6299
Dept. fax: 510-643-6264

Cell phone: 510-301-0179
Email: mat...@berkeley.edu

Mailing address:
Department of Integrative Biology
1005 Valley Life Sciences Building #3140
Berkeley, CA 94720-3140

-
[W]hen people thought the earth was flat, they were wrong. 
When people thought the earth was spherical, they were 
wrong. But if you think that thinking the earth is spherical 
is just as wrong as thinking the earth is flat, then your 
view is wronger than both of them put together.

Isaac Asimov (1989). The Relativity of Wrong. The 
Skeptical Inquirer, 14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm

__
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] easiest way to put italics words in sentences plotted with text()?

2013-08-09 Thread David Winsemius

On Aug 9, 2013, at 7:22 PM, arun wrote:

 Hi,
 May be this gets you started:
 
 plot(1,1,xlim=0:1,ylim=0:1)
 text(0.6,0.8, expression(M3:~italic(Homo)~paste(,,  5 areas, 2 areas 
 max,sep=)))
  text(0.6,0.4, expression(M4:~italic(Pan)~paste(,,  3 areas, 2 areas 
 max,sep=)))
 

The plotmath paste() function does not have a 'sep' argument. Here are two 
paste-free alternatives:

plot(1,1,xlim=0:1,ylim=0:1)
text(0.6,0.8, expression(M3:~italic(Homo)~, 5 areas, 2 areas max))
text(0.6,0.4, expression(M4:~italic(Pan)~,~3~areas*,~2~areas~max))

commas need to be quoted since they are otherwise interpreted as separating 
distinct expressions. The * is  a spaceless searator.

-- 
David.


 A.K.
 
 - Original Message -
 From: Nick Matzke mat...@berkeley.edu
 To: R-help@r-project.org
 Cc: 
 Sent: Friday, August 9, 2013 10:05 PM
 Subject: [R] easiest way to put italics words in sentences plotted with   
 text()?
 
 Hi,
 
 I am plotting some labels that consist of strings in which 
 some words (but only some) should be in italics.
 
 E.g.
 
 M3: Homo, 5 areas, 2 areas max
 
 M4: Pan, 3 areas, 2 areas max
 
 I am putting these on the plot with the text() command.  The 
 words Homo and Pan should be italicized, since they are 
 genus names.  Is there some sneaky code to insert italics 
 for certain words?  I would rather not have to break up the 
 string and plot every word separately, or similar insanity.
 
 Any help much appreciated!
 
 Cheers,
 Nick
 
 
 
 
 -- 
 
 Nicholas J. Matzke
 Ph.D. Candidate, Graduate Student Researcher
 
 Huelsenbeck Lab
 Center for Theoretical Evolutionary Genomics
 4151 VLSB (Valley Life Sciences Building)
 Department of Integrative Biology
 University of California, Berkeley
 
 Graduate Student Instructor, IB200B
 Principles of Phylogenetics: Ecology and Evolution
 http://ib.berkeley.edu/courses/ib200b/
 http://phylo.wikidot.com/
 
 
 Lab websites:
 http://ib.berkeley.edu/people/lab_detail.php?lab=54
 http://fisher.berkeley.edu/cteg/hlab.html
 Dept. personal page: 
 http://ib.berkeley.edu/people/students/person_detail.php?person=370
 Lab personal page: 
 http://fisher.berkeley.edu/cteg/members/matzke.html
 Lab phone: 510-643-6299
 Dept. fax: 510-643-6264
 
 Cell phone: 510-301-0179
 Email: mat...@berkeley.edu
 
 Mailing address:
 Department of Integrative Biology
 1005 Valley Life Sciences Building #3140
 Berkeley, CA 94720-3140
 
 -
 [W]hen people thought the earth was flat, they were wrong. 
 When people thought the earth was spherical, they were 
 wrong. But if you think that thinking the earth is spherical 
 is just as wrong as thinking the earth is flat, then your 
 view is wronger than both of them put together.
 
 Isaac Asimov (1989). The Relativity of Wrong. The 
 Skeptical Inquirer, 14(1), 35-44. Fall 1989.
 http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
 
 __
 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.

David Winsemius
Alameda, CA, 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.