[R] community

2015-06-15 Thread Ragia Ibrahim
Dear group
working on a graph..I parse the graph node by node and create cluster for set 
of nodes..firstly the number of clusters are not knowen
what kind of R object can I flexibly use as community, say I want M communities
C1,C2..CM
how can I define this ?

thanks in advance
Ragia
  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-15 Thread Therneau, Terry M., Ph.D.

Frank,
  I don't think there is any way to fix your problem except the way that I 
did it.

library(survival)
tdata - data.frame(y=c(1,3,3,5, 5,7, 7,9, 9,13),
x1=factor(letters[c(1,1,1,1,1,2,2,2,2,2)]),
x2= c(1,2,1,2,1,2,1,2,1,2))

fit1 - lm( y ~ x1 * strata(x2) - strata(x2), tdata)
coef(fit1)
   (Intercept)x1b x1a:strata(x2)x2=2 x1b:strata(x2)x2=2
  3.00   5.00   1.00   1.67

Your code is calling model.matrix with the same model frame and terms structure as the lm 
call above (I checked).  In your case you know that the underlying model has 2 intercepts 
(strata), one for the group with x2=1 and another for the group with x2=2, but how is the 
model.matrix routine supposed to guess that?  It can't, so model.matrix returns the proper 
result for the lm call.  As seen above the result is not singular, while for the Cox model 
it is singular due to the extra intercept.


This is simply an extension of leaving the intercept term in the model and then removing 
that column from the returned X matrix, which is necessary to have the correct coding for 
ordinary factor variables, something we've both done since day 1.  In order for 
model.matrix to do the right thing with interactions, it has to know how many intercepts 
there actually are.


I've come to the conclusion that the entire thrust of 'contrasts' in S was wrong headed, 
i.e., the remove redundant columns from the X matrix ahead of time logic.  It is simply 
not possible for the model.matrix routine to guess correctly for all y and x combinations, 
something that been acknowledged in R by changing the default for singular.ok to TRUE. 
Dealing with this after the fact via a good contrast function (a la SAS -- heresy!) would 
have been a much better design choice.  But as long as I'm in R the coxph routine tries to 
be a good citizen.


Terry T.

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


[R] [R-pkgs] version 3.0-0 of bayesm

2015-06-15 Thread Peter Rossi
Version 3.0-0 of bayesm is now on CRAN.

All MCMC routines in this version have been recoded using rcpp-Armadillo.
This results in speeds gains
of between 2 and 30 times faster (hierarchical and density estimation
routines are on the higher end of this range) than
in bayesm version 2.2-5.

The algorithm, rsurGibbs, has been improved for better speed as well as
recoded.

A Bayesian treatment of aggregate random coefficient models (with
instruments) has been added, see rbayesBLP.

peter rossi
thanks to Neil Fultz, Keunwoo Kim, and Wayne Taylor for their help in the
recoding.

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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-es] Regresión logística

2015-06-15 Thread Freddy Omar López Quintero
​Holap.​

ran out of iterations and failed to converge


​Prueba aumentando el número de iteraciones, con el argumento maxit:

​GLM - bigglm(In.hospital_death ~ GCS + BUN, data = DatosGLM, family =
 binomial(logit), maxit=1000)​


​Salud.​

-- 
«No soy aquellas sombras tutelares
que honré con versos que no olvida el tiempo.»

JL Borges

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Boxplot using a shapefile

2015-06-15 Thread Preethi Balaji
Dear all,

I am trying to generate boxplots by giving a shapefile and an image as
input. The shapefile takes the pixel values from the image and shows
the distribution of pixels in the form of a boxplot.

Can somebody please tell me how I can execute this in R?

Many thanks!

-- 

Regards,
Preethi Malur Balaji | PhD Student
University College Cork | Cork, Ireland.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Request

2015-06-15 Thread MALIOU Djamil
Dear Sir or Madame,
I am a novice in R, and I want to perform a meta analysis of case control
studies (analytic), i want a step by step explanation if it's possible,
Thanks.
Cordially,

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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-es] Regresión logística

2015-06-15 Thread MªLuz Morales
Hola,
estoy intentando hacer una regresión logística entre la primera columna de
mi data.table (In.hospital_death) y otras dos (GSV y BUN) , me da el error
de abajo, he intentado eliminar las filas con valor NA por si esta función
no lo admite, pero sigue dando el mismo error. ¿Alguien sabe porqué ocurre?

(probé previamente a usar la función glm pero obtenía out of memory)


library(XLConnect)
library(biglm)
library(data.table)

GLM - bigglm(In.hospital_death ~ GCS + BUN, data = DatosGLM, family =
binomial(logit))

Obtengo el error:

In bigglm.function(formula = formula, data = datafun, ...) :
  ran out of iterations and failed to converge


Un saludo
Gracias
MªLuz

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Question about saving the context crawled by getNodeSet into a document

2015-06-15 Thread Humphrey Zhao
Dear Sir/Madam:

Thank you for your concern. I’m using getNodeSet in XML package to craw data 
from web pages, and I need to save it as a document. However, I tried 
write.table, write, and cat, but none of above could save the data. The error 
messages just like these:

 ac-getNodeSet(article, //div[@class='entry-content']) #attention to the 
majuscule write.table(ac[[1]], file=E:/学术资源网络分析/article.txt)Error in 
as.data.frame.default(x[[i]], optional = TRUE) : 

  c(cannot coerce class \c(\XMLInternalElementNode\, \XMLInternalNode\, 
\XMLAbstractNode\\ to a data.frame, cannot coerce class \)\ to a 
data.frame)

 write(ac, file=E:/学术资源网络分析/article.txt)Error in cat(list(...), file, sep, 
fill, labels, append) : 

  argument 1 (type 'list') cannot be handled by 'cat'

I have tried to force the data from getNodeSet into data frame, but it does not 
work either:

 tmp - data.frame(ac)Error in as.data.frame.default(x[[i]], optional = TRUE, 
stringsAsFactors = stringsAsFactors) : 

  不能把XMLNodeSet类别强迫变成数据框

I really confused how to save the data crawled by getNodeSet into a document. I 
wonder if you could give me some advice on solving this problem with R. And I 
would be most grateful if you could reply at your earliest convenience. Looking 
forward to hearing from you. Thank you very much.

 Sincerely yours 

 Humphrey Zhao
[[alternative HTML version deleted]]

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

[R] Error bars and CI

2015-06-15 Thread Mohan.Radhakrishnan
Hi,

I want to plot a line graph using this data. IDX is x-axis and V1 is y-axis.  I 
also want standard error bars and 99% CI to be shown. My code is given below. 
The section that plots the graph is the problem.  I don't see all the points in 
the line graph with error bars. How can I also show the 99% CI in the graph ?

  V1 IDX
1  0.987  21
2  0.585  22
3  0.770  23
4  0.711  24

library(stringr)
library(dplyr)
library(ggplot2)

data - read.table(D:\\jmh\\jmh.txt,sep=\t)

final -data %%
   select(V1) %%
  filter(grepl(^Iteration, V1)) %%
mutate(V1 = str_extract(V1, \\d+\\.\\d*))

final - mutate(final,IDX = 1:n())

jc - final %%
  filter(IDX  21)


#Convert to numeric
jc - data.frame(sapply(jc, function(x) as.numeric(as.character(x

print(jc)

# The following section is the problem.

sem - function(x){
   sd(x)/sqrt(length(x))
}

meanvalue - apply(jc,2,mean)
semvalue - apply(jc, 2, sem)

mean_sem - data.frame(mean= meanvalue, sem= semvalue, group=names(jc))

#larger font
theme_set(theme_gray(base_size = 20))

#plot using ggplot
p - ggplot(mean_sem, aes(x=group, y=mean)) +
  geom_line(stat='identity') +
  geom_errorbar(aes(ymin=mean-sem, ymax=mean+sem),
   width=.2)
print(p)

Thanks,
Mohan
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] model selection

2015-06-15 Thread bruno cid
Hi friends, 

Im trying to make a model selection comparing models built with lm function 
(package stats) and lme function (package nlme). Do you know if there is 
a problem to compare these models with the function AICtab (package bbmle). 

Thanks!!! Bruno Cid Crespo GuimarãesMestre em EcologiaLaboratório de Ecologia e 
Conservação de PopulaçõesUniversidade Federal do Rio de Janeiro
[[alternative HTML version deleted]]

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

[R] problem with nlme, environments, and packages

2015-06-15 Thread Greg Hather
Hello R users,

I encountered a strange problem while writing a package that uses the
nlme function.  First, I wrote some code that uses the nlme function,
and it ran without errors.  However, when I tried to put the code into
a package, the nlme function was unable to locate a function that was
used in the formula.  Could it be that nlme is looking in the wrong
environment?  I would appreciate any suggestions.  Below is a
reproducible example with the problem.

### BEGIN EXAMPLE ##

#' Fake package to show nlme error
#' @export

main_function - function(x){
 library(nlme)
 result - nlme(height ~ SSasymp(age, Asym, R0, lrc) +
nonlinear_function(age),
data = Loblolly,
fixed = Asym + R0 + lrc ~ 1,
random = Asym ~ 1,
start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
 result
}

nonlinear_function - function(x){
 log(x)
}

### END EXAMPLE ##

The above code can be installed as a package and run with the commands

library(devtools)
library(roxygen2)
setwd(C:/test)  # or any prefered directory
create(testPackage)
setwd(./testPackage)
document()
setwd(..)
install(testPackage)
main_function()

The output is

 main_function()
Error in eval(expr, envir, enclos) :
 could not find function nonlinear_function

 sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics  grDevices utils datasets  methods
[7] base
other attached packages:
[1] nlme_3.1-120   testPackage_0.0.0.9000
[3] roxygen2_4.1.1 devtools_1.8.0
loaded via a namespace (and not attached):
[1] curl_0.8digest_0.6.8git2r_0.10.1
[4] grid_3.1.3  lattice_0.20-31 magrittr_1.5
[7] memoise_0.2.1   Rcpp_0.11.6 rversions_1.0.1
[10] stringi_0.4-1   stringr_1.0.0   tools_3.1.3
[13] xml2_0.1.1

Note that if I simply paste main_function and nonlinear_function into
the R console, then main_function() runs without errors.

Greg

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Request

2015-06-15 Thread Michael Dewey

Dear Djamil

On 15/06/2015 14:37, MALIOU Djamil wrote:

Dear Sir or Madame,
I am a novice in R, and I want to perform a meta analysis of case control
studies (analytic), i want a step by step explanation if it's possible,


You can find details about packages which support meta-analysis in R in 
the Task View

http://CRAN.R-project.org/view=MetaAnalysis

Without more details of what you want to do it is hard to offer any more 
hints.



Thanks.
Cordially,

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Boxplot using a shapefile

2015-06-15 Thread Boris Steipe
Your workflow in principle is:

- read the image into an object for which you can obtain values-per-pixel in a 
2D structure;
- read the shapefile and convert into a polygon;
- determine the bounding box of the polygon;
- use the inout() function of the splancs package to get a list of booleans for 
the
points in the bounding box, TRUE if they are _inside_ the polygon;
- subset your image points to those for which inout() returns TRUE;
- plot as boxplot().

The CRAN taskview http://cran.r-project.org/web/views/MedicalImaging.html has a 
section on general image processing, guiding you to helpful packages.

Ask again if you get stuck - but(!):
- see here for some hints on how to ask questions productively:
  http://adv-r.had.co.nz/Reproducibility.html
  
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
- ... and please read the posting guide and don't post in HTML.


B.


On Jun 15, 2015, at 7:19 AM, Preethi Balaji preet.balaj...@gmail.com wrote:

 Dear all,
 
 I am trying to generate boxplots by giving a shapefile and an image as
 input. The shapefile takes the pixel values from the image and shows
 the distribution of pixels in the form of a boxplot.
 
 Can somebody please tell me how I can execute this in R?
 
 Many thanks!
 
 -- 
 
 Regards,
 Preethi Malur Balaji | PhD Student
 University College Cork | Cork, Ireland.
 
 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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 -- To UNSUBSCRIBE and more, see
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] search across a row for strings

2015-06-15 Thread Sarah Goslee
This faster than your version, and doesn't return NA:

df$htn - apply(df[,2:4], 1, function(x)any(grepl(^410, x)))

 df
  ID  DX1   DX2  DX3   htn
1  1 4109  4280 7102  TRUE
2  2  734   311  490 FALSE
3  3 4011 42822 4101  TRUE

 system.time({
+  for(j in 1:1) {
+   for (i in 1:nrow(df)) {
+ df[i,htn] - any(sapply('410', function(x)  which( grepl(x,
df[i, 2:4], fixed = TRUE) )))
+   }
+  }
+ })
   user  system elapsed
  6.648   0.008   6.657
There were 50 or more warnings (use warnings() to see the first 50)



 system.time({
+  for(j in 1:1) {
+   df$htn - apply(df[,2:4], 1, function(x)any(grepl(^410, x)))
+  }
+ })
   user  system elapsed
  1.826   0.000   1.826


On Mon, Jun 15, 2015 at 4:12 PM, Federman, Douglas
douglas.feder...@utoledo.edu wrote:
 I'm trying to do the following: search each patient's list of diagnoses for a 
 specific code then create a new column based upon the the presence of the 
 specific code.
 Simplified data follows:

 con - textConnection(
 ID  DX1 DX2 DX3
 1   410942807102
 2   734 311 490
 3   401142822   4101
 )
 df - read.table(con, header = TRUE, strip.white = TRUE, 
 colClasses=character)
 #
 # I would like to add a column such the result of searching for 410 would 
 give:  The search string would always be at the start of a word and doesn't 
 need regex.
 #
 # IDDX1 DX2 DX3 htn
 # 1 4109428071021
 # 2 734 311 490 0
 # 3 401142822   41011
 #
 # The following  works but is slow and returns NA if the search string is not 
 found:

 for (i in 1:nrow(df)) {
 df[i,htn] - any(sapply('410', function(x)  which( grepl(x, df[i, 2:4], 
 fixed = TRUE) )))
 }

 Thanks in advance.  I never fail to learn new things from this list.

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] search across a row for strings

2015-06-15 Thread Federman, Douglas
I'm trying to do the following: search each patient's list of diagnoses for a 
specific code then create a new column based upon the the presence of the 
specific code.  
Simplified data follows:

con - textConnection(
ID  DX1 DX2 DX3
1   410942807102
2   734 311 490
3   401142822   4101
)
df - read.table(con, header = TRUE, strip.white = TRUE, colClasses=character)
#
# I would like to add a column such the result of searching for 410 would give: 
 The search string would always be at the start of a word and doesn't need 
regex.
#
# IDDX1 DX2 DX3 htn
# 1 4109428071021
# 2 734 311 490 0
# 3 401142822   41011
#
# The following  works but is slow and returns NA if the search string is not 
found:

for (i in 1:nrow(df)) {
df[i,htn] - any(sapply('410', function(x)  which( grepl(x, df[i, 2:4], 
fixed = TRUE) )))
}

Thanks in advance.  I never fail to learn new things from this list.

--
Who is wise? One who learns from every person.
Who is strong? One who overpowers his evil inclinations.
Who is rich? One who is satisfied with his lot.
Who is honorable? One who honors his fellows.
- Pirkei Avot [excerpt]

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


[R] Error in local package install

2015-06-15 Thread Axel Urbiz
Hello,

I've built a windows binary package from my Mac using the help from this
site: http://win-builder.r-project.org

As expected, I got back the file mypackage.zip. Also, the logs show no
errors.

Now, when I try to install on windows using the GUI install package(s)
from local zip files, I get the following error:

 utils:::menuInstallLocal()
Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
:
  cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
  cannot open compressed file 'mypackage/DESCRIPTION', probable reason 'No
such file or directory'

I've attempted to use the solutions from prior similar email threats with
no success. Btw - I've install all the packages dependencies prior to the
above. I'm on R 3.2.0.

Any guidance would be much appreciated.

Thank you.

Axel.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] search across a row for strings

2015-06-15 Thread David Winsemius

On Jun 15, 2015, at 1:12 PM, Federman, Douglas wrote:

 I'm trying to do the following: search each patient's list of diagnoses for a 
 specific code then create a new column based upon the the presence of the 
 specific code.  
 Simplified data follows:
 
 con - textConnection(
 IDDX1 DX2 DX3
 1 410942807102
 2 734 311 490
 3 401142822   4101
 )
 df - read.table(con, header = TRUE, strip.white = TRUE, 
 colClasses=character)
 #
 # I would like to add a column such the result of searching for 410 would 
 give:  The search string would always be at the start of a word and doesn't 
 need regex.
 #
 # ID  DX1 DX2 DX3 htn
 # 1   4109428071021
 # 2   734 311 490 0
 # 3   401142822   41011
 #
 # The following  works but is slow and returns NA if the search string is not 
 found:
 
 for (i in 1:nrow(df)) {
df[i,htn] - any(sapply('410', function(x)  which( grepl(x, df[i, 2:4], 
 fixed = TRUE) )))
 }

Is this any better?

 df$htn -  apply(df[-1], 1, function(r) max( substr(r, 1,3) == 410 ))
 df
  ID  DX1   DX2  DX3 htn
1  1 4109  4280 7102   1
2  2  734   311  490   0
3  3 4011 42822 4101   1


Can add an na.rm=TRUE to the max call if warranted. `max` coerces logicals to 
integer.



-- 
David Winsemius
Alameda, CA, USA

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


Re: [R] Error in local package install

2015-06-15 Thread Uwe Ligges



On 15.06.2015 22:32, Axel Urbiz wrote:

Hello,

I've built a windows binary package from my Mac using the help from this
site: http://win-builder.r-project.org

As expected, I got back the file mypackage.zip. Also, the logs show no
errors.


No, you got a file packagename_version.zip.




Now, when I try to install on windows using the GUI install package(s)
from local zip files, I get the following error:


utils:::menuInstallLocal()

Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
:
   cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
   cannot open compressed file 'mypackage/DESCRIPTION', probable reason 'No
such file or directory'

I've attempted to use the solutions from prior similar email threats with
no success. Btw - I've install all the packages dependencies prior to the
above. I'm on R 3.2.0.


please try the release condadate of R-3.2.1, R-3.2.0 had a bug for 
package installation from local zip files.


Best,
Uwe Ligges



Any guidance would be much appreciated.

Thank you.

Axel.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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 -- To UNSUBSCRIBE and more, see
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] Missing Values in Table Statement

2015-06-15 Thread PIKAL Petr
Hi

Why you are so reluctant to use dput for sending us part of your data?

The result of str indicates that that SCH_TIME is character vector in which 
some values are time and others are **empty** strings. But empty string does 
not mean it is missing string.

***Empty bottle of whisky is not missing bottle of whisky***.

So is.na correctly finds that none of your values are missing.

see this example

test-sample(letters[1:5], 10, replace=T)
test[5:7]-NA
str(test)
 chr [1:10] b a d e NA NA NA d d c

table(is.na(test))

FALSE  TRUE
7 3

test[5:7]-
str(test)
 chr [1:10] b a d ed d c
table(is.na(test))

FALSE
   10

Cheers
Petr





 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Shivi82
 Sent: Saturday, June 13, 2015 6:36 AM
 To: r-help@r-project.org
 Subject: Re: [R] Missing Values in Table Statement

 HI Don,

 This is the exact result i need. However in my case i am not getting
 any value under TRUE whereas FALSE captures total observations in each
 variable.
 Please find the syntax and output from the code:
 table(test$ORIGIN_NAME,is.na(test$SCH_TIME))

 Output
  FALSE
   BAHADURGARH15
   BAREILLY44
   BAWAL34
   DELHI-11   2446
   DELHI-39   170
   DELHI-40   86
   DELHI NCR-121925

 The data from str is attached:
 data.frame':  10765 obs. of  18 variables:
  $ ORIGIN : chr  DLI11 DLI11 NDA50 NDA50 ...
  $ ORIGIN_NAME: chr  DELHI-11 DELHI-11 NOIDA-50 NOIDA-50
 ...
  $ DESTINATION: chr  NDA50 NDA50 DLI11 NDA11 ...
  $ DESTINATION_NM : chr  NOIDA-50 NOIDA-50 DELHI-11 NOIDA-11
 ...
  $ RPS_NO : int  1350760 1366368 1352692 1354642 1354642
 1349180
 1349180 1356091 1348591 1348591 ...
  $ VENDOR_NAME: chr  RAJIV GAUTAM RAJIV GAUTAM RAJIV GAUTAM
 RAJIV
 GAUTAM ...
  $ CR_DT  : chr  13-Mar-15 31-Mar-15 15-Mar-15 17-Mar-
 15 ...
  $ SCHD_MRKT  : chr  SCHEDULE SCHEDULE SCHEDULE MARKET ...
  $ VHL_NO : chr  HR63A0931 HR63A0931 HR63A0931
 HR63A0931 ...
  $ vhl_cap: int  8 8 8 8 8 8 8 8 8 8 ...
  $ SCH_TIME   : chr  6:00 6:00 21:30  ...
  $ ACTUAL_DEP_DATE: chr  13/03/2015 31/03/2015 15/03/2015
 17/03/2015
 ...
  $ ACTUAL_DEP_TIME: chr  6:30 4:05 13:37 20:15 ...
  $ WAYBILLS   : chr  - - - 3 ...
  $ TOTAL_PKG  : int  0 0 0 40 256 6 0 0 16 427 ...
  $ ACTUAL_WT  : int  0 0 0 744 3419 65 0 0 193 7223 ...
  $ CHG_WT : int  0 0 0 770 3730 70 0 0 210 7310 ...
  $ RTE_CD : chr  DELHI-11-NOIDA-50(DLI11-NDA50)
 DELHI-11-NOIDA-50(DLI11-NDA50) NOIDA-50-DELHI-11(NDA50-DLI11)
 NOIDA-50-DELHI-11(NDA50-NDA11-DLI11)
 Scheduled time here is character, could this be the reason for the
 incorrect result.

 Thanks, Shivi




 --
 View this message in context: http://r.789695.n4.nabble.com/Missing-
 Values-in-Table-Statement-tp4708534p4708593.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your 

Re: [R] Different behavior of model.matrix between R 3.2 and R3.1.1

2015-06-15 Thread Frank Harrell
Thank you very much Terry.  I'm still puzzled at why this worked a year 
ago.  What changed?  I'd very much like to reverse the change by setting 
an argument somewhere or manipulating the terms object.

I echo your sentiments about the general approach.

Frank


On 06/15/2015 09:05 AM, Therneau, Terry M., Ph.D. wrote:
 Frank,
   I don't think there is any way to fix your problem except the way 
 that I did it.

 library(survival)
 tdata - data.frame(y=c(1,3,3,5, 5,7, 7,9, 9,13),
 x1=factor(letters[c(1,1,1,1,1,2,2,2,2,2)]),
 x2= c(1,2,1,2,1,2,1,2,1,2))

 fit1 - lm( y ~ x1 * strata(x2) - strata(x2), tdata)
 coef(fit1)
(Intercept)x1b x1a:strata(x2)x2=2 
 x1b:strata(x2)x2=2
   3.00   5.00   1.00 1.67

 Your code is calling model.matrix with the same model frame and terms 
 structure as the lm call above (I checked).  In your case you know 
 that the underlying model has 2 intercepts (strata), one for the group 
 with x2=1 and another for the group with x2=2, but how is the 
 model.matrix routine supposed to guess that?  It can't, so 
 model.matrix returns the proper result for the lm call.  As seen above 
 the result is not singular, while for the Cox model it is singular due 
 to the extra intercept.

 This is simply an extension of leaving the intercept term in the 
 model and then removing that column from the returned X matrix, which 
 is necessary to have the correct coding for ordinary factor variables, 
 something we've both done since day 1.  In order for model.matrix to 
 do the right thing with interactions, it has to know how many 
 intercepts there actually are.

 I've come to the conclusion that the entire thrust of 'contrasts' in S 
 was wrong headed, i.e., the remove redundant columns from the X 
 matrix ahead of time logic.  It is simply not possible for the 
 model.matrix routine to guess correctly for all y and x combinations, 
 something that been acknowledged in R by changing the default for 
 singular.ok to TRUE. Dealing with this after the fact via a good 
 contrast function (a la SAS -- heresy!) would have been a much better 
 design choice.  But as long as I'm in R the coxph routine tries to be 
 a good citizen.

 Terry T.

-- 

Frank E Harrell Jr  Professor and Chairman  School of Medicine

Department of *Biostatistics*   *Vanderbilt University*


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.