Re: [R] Help with R script

2017-07-13 Thread Ulrik Stervbo
@Don your solution does not solve Vijayan's scenario 2. I used spread and gather for that. An alternative solution to insert mising Fval - picking up with Don's newtst - is newtst <- c("FName: fname1", "Fval: Fval1.name1", "FName: fname2", "Fval: Fval2.name2", "FName: fname3", "FName: fname4",

[R] Conduct Network Analysis

2017-07-13 Thread SEB140004 Student
Greeting. Dear Mr/Mrs/Miss, I want to create a network by using R but I only have a table that contain OTU ID and the abundance value of two samples ONLY. Isn't possible? If can, which package can be used? Greatly appreciated to any suggestions and helps. Thank you. Best regards, Kang Chin Yi

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Bert Gunter
David et.al.: It's a problem with poly (or rather with how it is being misused) > mx <- as.matrix(gasoline[1:50,"NIR"]) > str(mx) AsIs [1:50, 1:401] -0.0502 -0.0442 -0.0469 -0.0467 -0.0509 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:50] "1" "2" "3" "4" ... ..$ : chr [1:401] "900 nm"

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread David Winsemius
> On Jul 13, 2017, at 10:43 AM, Bert Gunter wrote: > > poly(NIR, degree = 2) will work if NIR is a matrix, not a data.frame. > The degree argument apparently *must* be explicitly named if NIR is > not a numeric vector. AFAICS, this is unclear or unstated in ?poly. I

Re: [R-es] Resumen de R-help-es, Vol 101, Envío 12

2017-07-13 Thread Jose Ramirez Costa
Hola Patricio, muchas gracias por tu aporte, voy a mirar ese paquete. Abrazo! PD: agradezco la celeridad con la cual siempre recibo respuestas en el grupo, prometo estar mas atento para dar respuestas al pedido de ayudas. El 13 de julio de 2017, 19:44, patricio fuenmayor <

Re: [R-es] Resumen de R-help-es, Vol 101, Envío 12

2017-07-13 Thread patricio fuenmayor
Hola. Personalmente uso rsqlserver para conexiones con bases sqlserver https://github.com/agstudy/rsqlserver Mira el Benchmarking y te darás cuenta las ventajas Al ser similar a DBI, puedes enviar una consulta de creación de una tabla y luego una consulta de inserción [[alternative HTML

Re: [R] How to make a figure plotting p-values by range of different adjustment values?

2017-07-13 Thread Jim Lemon
Hi Kirsten, Yes, the adjustment in the "car" package is different from the p.adjust function in the "stats" package. I used the latter as I thought you only needed a way to plot different p-values against the various adjustment methods. Just create a vector of method names that you have used and

Re: [R] Extracting sentences with combinations of target words/terms from cancer patient text medical records

2017-07-13 Thread Paul Miller via R-help
Hi Robert, Thank you for your reply. An attempt to solve this via a regular expression query is particularly helpful. Unfortunately, I don't have much time to play around with this just now. Ultimately though, I think I would like to implement a solution something along the lines of what you

[R] R Consortium R Users Survey

2017-07-13 Thread Joseph Rickert
Hello All, The R Consortium is attempting to survey R users worldwide. We would like to know some basic information: How people use R, What they think of the way R is developing, What other languages they use, etc. You can read more about its purpose in a recent post

Re: [R-es] Leer archivos con read.csv

2017-07-13 Thread Javier Marcuzzi
Estimado Freddy Omar López Quintero La idea de Javier Nieto me parece buena, try cath es muy útil, a esto le sumaría print, como para ver en pantalla el nombre del archivo y un Si o No, mientras se cargan los datos, aunque esto es solo gusto personal. Javier Rubén Marcuzzi De: Freddy Omar

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Bert Gunter
> It would seem reasonable that the help for poly() could make it explicitly > clear that if 'x' is not a vector, but is a matrix, that 'degree' must be > explicitly named. > > Regards, > > Marc > Exactly. As written, there is no reason to believe that the stated exception to the ... argument

Re: [R] Extracting sentences with combinations of target words/terms from cancer patient text medical records

2017-07-13 Thread Robert McGehee
Hi Paul, No need to collapse the information into a single text string, gregexpr() can take a vector of strings (sentences in your case). You can split your sentences up, number them how you want, then search for your pattern either via regex or via these extra packages you use which probably

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Marc Schwartz
Hi Bert, Ok, to your initial point, the key nuance is that if 'x' is a vector, you can leave the 'degree' argument unnamed, however, if 'x' is a matrix, you cannot. That aspect of the behavior does not seem to change if poly() is called stand alone or, as suggested in ?poly, within a formula

Re: [R-es] Leer archivos con read.csv

2017-07-13 Thread Freddy Omar López Quintero
Hola. Una manera puede ser tomar una lista de todos los archivos de un directorio y trabajar con ellos, puesto que ciertamente existen. ¿Cómo? Supongamos que tienes una carpeta llena de archivos csv. Entonces, puedes guardar el nombre de tus archivos en un objeto con lista_archivos<-dir() > y

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Bert Gunter
Marc: 1. I am aware of the need to explicitly name arguments after ... -- see the R Language definition where this can be inferred from the argument matching rules. 2. I am aware of the stated exception for poly(). However: > x1 <- runif(20) > x2 <- runif(20) > mx <- cbind(x1,x2) > poly(mx,2)

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Marc Schwartz
Bert, The 'degree' argument follows the "..." argument in the function declaration: poly(x, ..., degree = 1, coefs = NULL, raw = FALSE, simple = FALSE) Generally, any arguments after the "..." must be explicitly named, but as per the Details section of ?poly: "Although formally degree

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Bert Gunter
poly(NIR, degree = 2) will work if NIR is a matrix, not a data.frame. The degree argument apparently *must* be explicitly named if NIR is not a numeric vector. AFAICS, this is unclear or unstated in ?poly. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming

Re: [R] Quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread David Winsemius
> On Jul 12, 2017, at 6:58 PM, Ng, Kelvin Sai-cheong > wrote: > > Dear all, > > I am using the pls package of R to perform partial least square on a set of > multivariate data. Instead of fitting a linear model, I want to fit my > data with a quadratic function with

[R-es] Leer archivos con read.csv

2017-07-13 Thread WILMER CONTRERAS SEPULVEDA
Buen día para todos. Tengo un pequeño problema en el quisiera que me colaboraran. Estos días estoy trabajando en la lectura de una gran cantidad de archivos de extención .csv, se trata de una lista de documentos de 11 estaciones meteorologicas. Cada estación esta clasificada por meses y cada mes

Re: [R-es] consulta por varTypes de sqlSave en RODBC

2017-07-13 Thread Jose Ramirez Costa
Gracias Javier! Ahi encontre la solucion, se puede usar de la siguiente forma: varTypes = c(nomvrevariable1="datetime", nombrevariable2="varchar (2)") Era tan sencillo mi error que no podia encontrar la forma, escribia los nombres de las variables sin comillas y los tipos de variables con

Re: [R] How to make a figure plotting p-values by range of different adjustment values?

2017-07-13 Thread Kirsten Morehouse
Hi Jim, Thanks for your help, I really appreciate it. Perhaps I'm misunderstanding, but does this formula run different ajustment values for this function? logit(p = doc$value, adjust = 0.025) I'm looking to plot the p-values of different adjustment values. Thanks so much, Kirsten On Wed,

Re: [R] Help with R script

2017-07-13 Thread MacQueen, Don
Using Ulrik’s example data (and assuming I understand what is wanted), here is what I would do: ex.dat <- c("FName: fname1", "Fval: Fval1.name1", "Fval: ", "FName: fname2", "Fval: Fval2.name2", "FName: fname3") tst <- data.frame(x = ex.dat, stringsAsFactors=FALSE) sp <- strsplit(tst$x, ':',

Re: [R] How to formulate quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Bert Gunter
Below. -- Bert Bert Gunter On Thu, Jul 13, 2017 at 3:07 AM, Luigi Biagini wrote: > I have two ideas about it. > > 1- > i) Entering variables in quadratic form is done with the command I > (variable ^ 2) - > plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data =

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Bert Gunter
If you want to continue this discussion, I think you need to take it offlist, as it seems to be primarily about methodology, not R programming. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

Re: [R-es] consulta por varTypes de sqlSave en RODBC

2017-07-13 Thread Jose Ramirez Costa
Hola Javier, si no estoy entendiendo mal, lo q deseo hacer no se trata de configurar los parametros SQL, sino solo de colocar un vector en el argumento VarTypes de la funcion sqlSave. El manual especifica esa opcion, pero no da ningun ejemplo de como usarla. *varTypes an optional named character

Re: [R] Help with R script

2017-07-13 Thread Ulrik Stervbo
Hi Vijayan, one way going about it *could* be this: library(dplyr) library(tidyr) library(purrr) ex_dat <- c("FName: fname1", "Fval: Fval1.name1", "Fval: ", "FName: fname2", "Fval: Fval2.name2", "FName: fname3") data.frame(x = ex_dat) %>% separate(x, c("F1", "F2"), sep = ": ") %>%

Re: [R-es] consulta por varTypes de sqlSave en RODBC

2017-07-13 Thread Javier Marcuzzi
Estimado Ramirez Costa Si usted desea configurar los parámetros SQL podría escribirlos en lenguaje SQL y enviarlos por medio de una consulta, por otro lado ¿el manual especifica la opción que usted desea utilizar? Posiblemente está documentado (no lo se). Javier Rubén Marcuzzi De: Jose

Re: [R-es] consulta por varTypes de sqlSave en RODBC

2017-07-13 Thread Jose Ramirez Costa
Buen dia Javier, muchas gracias por tu ayuda y el script compartido. Me va a servir como ayuda para seguir aprendiendo sobre RODBC pero no encuentro una solucion para este problema puntual de poder definir el tipo y ancho de las variables, q segun creo se hace con el argumento varTypes. Si

Re: [R] How to formulate quadratic function with interaction terms for the PLS fitting model?

2017-07-13 Thread Luigi Biagini
I have two ideas about it. 1- i) Entering variables in quadratic form is done with the command I (variable ^ 2) - plsr (octane ~ NIR + I (nir ^ 2), ncomp = 10, data = gasTrain, validation = "LOO" You could also use a new variable NIR_sq <- (NIR) ^ 2 ii) To insert a square variable, use syntax I

[R] [R-pkgs] New package: passport

2017-07-13 Thread Edward Visel
Hi! I'm happy to announce the debut of my first package on CRAN, `passport`, to help your country name and code data travel smoothly between formats. `passport` brings simple utilities for parsing irregular country names to standardized codes using local regex, or for anything geocodable, the

[R] [R-pkgs] acs version 2.1.0 update: download and analyze data from the US Census in R

2017-07-13 Thread Ezra Haber Glenn
We are pleased to announce the release of version 2.1.0 of the "acs" package, now available on CRAN . The package allows users to download, manipulate, analyze, and present demographic data from the U.S. Census, with special tools and

Re: [R] metRology package

2017-07-13 Thread S Ellison
> I'm having trouble with a simple application with metRology. Well, what you probably need is to contact the maintainer of the metRology package. Fortunately that's me. An immediate problem that I have is that I don't quite understand what you're doing (in the measurement), so I may need to

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Berend Hasselman
> On 13 Jul 2017, at 12:55, Pfaff, Bernhard Dr. > wrote: > > Who was speaking about non-linear models in the first place??? > The Klein-Model(s) and pretty much all simultaneous equation models > encountered in macro-econometrics are linear That's really not

[R] Help with R script

2017-07-13 Thread Vijayan Padmanabhan
Dear R-help Group Scenario 1: I have a text file running to 1000 of lines...that is like as follows: [922] "FieldName: Wk3PackSubMonth" [923] "FieldValue: Apr" [924] "FieldName: Wk3PackSubYear" [925] "FieldValue: 2017" [926] "FieldName: Wk3Code1" [927] "FieldValue: " [928]

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Pfaff, Bernhard Dr.
Who was speaking about non-linear models in the first place??? The Klein-Model(s) and pretty much all simultaneous equation models encountered in macro-econometrics are linear and/or can contain linear approximations to non-linear relationships, e.g., production functions of the Cobb-Douglas

Re: [R] bnlearn and cpquery

2017-07-13 Thread Marco Scutari
Dear Ross, This usually happen because you have parameters with a value of NaN in your network, because the data you estimate the network from are sparse and you are using maximum likelihood estimates. You should either 1) use simpler networks for which you can estimate all conditional

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Berend Hasselman
Frances, I would not advise Gauss-Seidel for non linear models. Can be quite tricky, slow and diverge. You can write your model as a non linear system of equations and use one of the nonlinear solvers. See the section "Root Finding" in the task view NumericalMathematics suggesting three

Re: [R] about plotting a special case

2017-07-13 Thread Jim Lemon
If you want colors mapped to the _values_ in DF1$C, there are a number of ways to do it: Color_unq<-color.scale(DF1$C,c(1,0),c(0,0,c(0,1)) This will produce colors from the lowest values (red) through the highest (blue). See the help page for color.scale to get different colors. With this you

Re: [R] Question on Simultaneous Equations & Forecasting

2017-07-13 Thread Pfaff, Bernhard Dr.
Hi Frances, I have not touched the system.fit package for quite some time, but to solve your problem the following two pointers might be helpful: 1) Recast your model in the revised form, i.e., include your identity directly into your reaction functions, if possible. 2) For solving your model,