Re: [R] [FORGED] function for remove white space

2017-02-21 Thread José Luis
Thank's for your answer. I'm using read.csv. Enviado desde mi iPad > El 22/2/2017, a las 3:39, William Michels escribió: > > Hi José (and Rolf), > > It's not entirely clear what type of 'whitespace' you're referring to, > but if you're using read.table() or read.csv()

Re: [R] [FORGED] function for remove white space

2017-02-21 Thread William Michels via R-help
Hi José (and Rolf), It's not entirely clear what type of 'whitespace' you're referring to, but if you're using read.table() or read.csv() to create your dataframe in the first place, setting 'strip.white = TRUE' will remove leading and trailing whitespace 'from unquoted character fields (numeric

Re: [R] [FORGED] function for remove white space

2017-02-21 Thread Rolf Turner
On 22/02/17 12:51, José Luis Aguilar wrote: Hi all, i have a dataframe with 34 columns and 1534 observations. In some columns I have strings with spaces, i want remove the space. Is there a function that removes whitespace from the entire dataframe? I use gsub but I would need some function to

[R] function for remove white space

2017-02-21 Thread José Luis Aguilar
Hi all, i have a dataframe with 34 columns and 1534 observations. In some columns I have strings with spaces, i want remove the space. Is there a function that removes whitespace from the entire dataframe? I use gsub but I would need some function to automate this. Thank you very much in

[R] flushing on.exit prior to q()

2017-02-21 Thread Benjamin Tyner
Hi, When using a custom error function that calls q(), what is the recommended way to "flush" the calling function's on.exit ? For example, say I have a script: #!/usr/bin/Rscript --no-init-file options(error = function() { cat("on error message\n", file = stderr())

Re: [R] [FORGED] Yates correction

2017-02-21 Thread Rolf Turner
On 21/02/17 23:47, Jomy Jose wrote: I tried to do chi square test for the following observed frequencies - A B A 8 4 B 12 10 R gave the following output:

Re: [R] optimisation - Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2)

2017-02-21 Thread Jim Lemon
Hi Malgorzata, Did you try to _install_ rather than just _load_ the XLConnect package? install.packages("XLConnect") Sad to say, your code: time=c(16,17,18,19,20,21,22,23,24,25,26) #x=c(20.2,18.9,16.5) y=c(7.63,9.22,4.86,4.78,0.38,6.13,3.91,38.41,2.58,36.95,1.73)

Re: [R] Confused about using data.table package,

2017-02-21 Thread P Tennant
aggregate(), tapply(), do.call(), rbind() (etc.) are extremely useful functions that have been available in R for a long time. They remain useful regardless what plotting approach you use - base graphics, lattice or the more recent ggplot. Philip On 22/02/2017 8:40 AM, C W wrote: Hi Carl,

Re: [R] Confused about using data.table package,

2017-02-21 Thread C W
Hi Carl, I have not fully learned dplyr, but it seems harder than tapply() and the ?apply() family in general. Almost every ggplot2 data I have seen is manipulated using dplyr. Something must be good about dplyr. aggregate(), tapply(), do.call(), rbind() will be sorely missed! :( Thanks! On

Re: [R-es] Sobre gráficos

2017-02-21 Thread Fernando Macedo
Un link que uso bastante para arrancar gráficos cuando no recuerdo bien los comandos o los argumentos es este http://www.cookbook-r.com/ No esperes encontrar nada espectacularmente para avanzados pero para arrancar esta bien y luego google para cosas específicas, en general en stack overflow se

[R] Confused about using data.table package,

2017-02-21 Thread Carl Sutton via R-help
Hi I have found that:A)  Hadley's new book to be wonderful on how to use dplyr, ggplot2 and his other packages.  Read this and using as a reference saves major frustration. b)  Data Camps courses on ggplot2 are also wonderful.  GGPLOT2 has more capability than I have mastered or needed.  To be

Re: [R-es] [OT] Sobre gráficos

2017-02-21 Thread hibiki
Much�simas gracias Eric, lo del rebote debe ser porque en la escuela cambiaron el dominio y debes estar mandando el mensaje al la direcci�n vieja 'npolanco@*cuij*.edu.cu', como cambiaron el dominio *CUIJ* por *UIJ* ahora la direcci�n es 'npolanco@*uij*.edu.cu' que es como me registre a la

Re: [R-es] Rutina de cálculo

2017-02-21 Thread Andres Hirigoyen
Gracias lo veo El 21 de febrero de 2017, 16:24, Freddy Omar López Quintero < freddy.lopez.quint...@gmail.com> escribió: > ​Hola.​ > > 2017-02-21 15:08 GMT-03:00 Andres Hirigoyen : > >> ¿Cómo puedo automatizar esto para no tener que hacer de forma manual un >> subset

Re: [R-es] Rutina de cálculo

2017-02-21 Thread Freddy Omar López Quintero
​Hola.​ 2017-02-21 15:08 GMT-03:00 Andres Hirigoyen : > ¿Cómo puedo automatizar esto para no tener que hacer de forma manual un > subset por Región? > ​Así es un poco difícil ayudar más porque no sabemos cómo es realmente la estructura de datos o con qué

Re: [R] Error in match.fun(f) : object 'x' not found

2017-02-21 Thread peter dalgaard
The curve() function is being (overly?) clever in allowing nonstandard evaluation to let you specify an expression for the function argument. For integrate(), you need to go the standard way and set up an actual function of 1 argument and pass that. It's not all that hard: > f <- function(x)

Re: [R-es] Rutina de cálculo

2017-02-21 Thread Xavi tibau alberdi
Buenas, A falta de que especifiques un poco más, yo haría seria crear un función con todo el proceso, y luego, usaría esa función sobre todos los datasets. Si quieres más ayuda, tendrías que especificar más. Un saludo, 2017-02-21 19:08 GMT+01:00 Andres Hirigoyen : >

[R-es] Rutina de cálculo

2017-02-21 Thread Andres Hirigoyen
Buenas tardes, mi consulta es sobre rutinas. Tengo un set de datos agrupados por Regiones, son 18 Regiones con 36 observaciones de 10 variables. Para cada Región efectúa varias funciones, tablas etc.. ¿Cómo puedo automatizar esto para no tener que hacer de forma manual un subset por Región?

Re: [R] Correlations Table of Items when compute Cronbach's Alpha

2017-02-21 Thread David L Carlson
Actually you will need ?psych::alpha to get the help page. The correlations provided in output$item.stats are with the total score. If you want a correlation matrix for the original 4 variables you can use sweep() to invert the necessary column(s): > cor(sweep(dat, 2, c(1, 1, 1, -1), FUN="*"),

Re: [R] Error in match.fun(f) : object 'x' not found

2017-02-21 Thread Uwe Ligges
On 21.02.2017 18:29, C W wrote: Dear R list, I am having a little trouble understanding the R code. I want to compute expectation of normal pdf. I did the following: integrate(x*dnorm(x, rate=1), -Inf, Inf) integrate needs a function as first argument, hence: integrate(function(x)

Re: [R] Multiply row of a matrix

2017-02-21 Thread Jeff Newmiller
Why this works does not become clear until you actually pay attention to how matrices are laid out in memory as a vector, and how vector replication works. Those ideas are not that difficult to learn, but they feel different than in other languages (e.g. matlab) and they make a huge difference

[R] Error in match.fun(f) : object 'x' not found

2017-02-21 Thread C W
Dear R list, I am having a little trouble understanding the R code. I want to compute expectation of normal pdf. I did the following: integrate(x*dnorm(x, rate=1), -Inf, Inf) Error in match.fun(f) : object 'x' not found If I did this, I get, integrate(dexp(x, rate=1), -Inf, Inf) Error in

Re: [R-es] Sobre gráficos

2017-02-21 Thread eric
hola Nivaildo, hace dias te escribi directamente a tu correo, pero gmail me manda correos diciendo que no es posible entregarte mi mail, asi es q te escribo x la lista con el permiso de los demas ... mi mail decia: "mega.nz es una nube, ahi yo tengo varios libros, articulos y otros recursos

Re: [R] Correlations Table of Items when compute Cronbach's Alpha

2017-02-21 Thread Mark Sharp
Have you looked at the help page? ?alpha::alpha See the section labeled Value. Look at output <- alpha(data, keys = c(1, 1, 1, -1)) output$r output$r.cor output$r.drop R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Feb 21, 2017, at 9:43 AM, Steven Stoline wrote: > >

Re: [R] Multiply row of a matrix

2017-02-21 Thread William Dunlap via R-help
> Mat * c(3, 1, 0.5) [,1] [,2] [,3] [1,] 3.06 9.0 [2,] 4.05 6.0 [3,] 3.54 4.5 Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Feb 21, 2017 at 8:23 AM, wrote: > If we have the following matrix: > > Mat<-matrix(1:9, byrow=TRUE, nrow=3) > Mat >

[R] Multiply row of a matrix

2017-02-21 Thread ac . dasilva
If we have the following matrix: Mat<-matrix(1:9, byrow=TRUE, nrow=3) Mat [,1] [,2] [,3] [1,]123 [2,]456 [3,]789 I would like to have each row multiplied by a different number. So I would like row 1 multiplied by 3, row2 by 1 and row3 by 0.5 Which

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-21 Thread William Dunlap via R-help
Stray attributes on data.frames may or may not survive some simple operations on the data.frame. E.g., > d <- data.frame(X=1:5, Y=log(1:5), G=factor(rep(c("a","b"),c(2,3 > attr(d, "checked") <- TRUE > wasChecked <- function(x) isTRUE(attr(x, "checked")) > wasChecked(d) [1] TRUE >

[R] Correlations Table of Items when compute Cronbach's Alpha

2017-02-21 Thread Steven Stoline
Dear All: I am using *alpha(data, **check.keys=TRUE) or alpha(data, keys = c(1, 1, 1, -1))* to compute the Cronbach's Alpha. I am using *check.keys=TRUE* or *keys = c(1, 1, 1, -1) *to automatically reverse items. *My question is: *how can I get the correlation tables (matrix) of the

[R] Cronbach's Alpha Values

2017-02-21 Thread Steven Stoline
Dear All: I am using *alpha(data, **check.keys=TRUE) *to compute the Cronbach's Alpha. I am using *check.keys=TRUE* to automatically reverse items. *My question is: *how can I get the correlation tables (matrix) of the reverse items as part of the R output. thank you steve -- Steven M.

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-21 Thread Charles C. Berry
On Tue, 21 Feb 2017, stephen sefick wrote: Sorry for not being clear. I have never used S3 methods before. Below is some R code that sketches out my idea. Is this a sensible solution? Sure. See comments (untested) inline. Chuck test_data <- data.frame(a=1:10, b=1:10, c=1:10) functionA <-

[R] Question about logspline

2017-02-21 Thread George Trojan - NOAA Federal
I have a dataset with values of limited precision. I am trying to plot its density using package logspline. The logspline() call with default parameters causes oscillations in the density plot. My solution was to fuzzify the input values, using function: > fuzz <- function(x, prec) x +

Re: [R] Yates correction

2017-02-21 Thread Marc Schwartz
Hi, In general, statistical questions that are more conceptual in nature, which is the case here, are generally frowned upon on this list, since they are considered off-topic here. That being said, increasingly, both the Fisher Exact test and the use of the Yates correction to the Chi-Square

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-21 Thread stephen sefick
Sorry for not being clear. I have never used S3 methods before. Below is some R code that sketches out my idea. Is this a sensible solution? test_data <- data.frame(a=1:10, b=1:10, c=1:10) functionA <- function(x, impossible_genotype){ ##some data processing y <- x ##return S3 to be

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

2017-02-21 Thread Angus Dempster
Dear all, The new package opusminer is now available on CRAN: . opusminer provides an interface to the OPUS Miner algorithm (implemented in C++) for finding the key associations in transaction data. The OPUS Miner algorithm uses the OPUS search

Re: [R] Yates correction

2017-02-21 Thread David L Carlson
Use fisher.test(). Yates' correction compensates for a tendency for Chi-square to be overestimated in a 2x2 table, but Yates' can overcompensate, reducing Chi-square too much. It's main advantage was when computers were expensive and Fisher's Exact was hard to compute by hand. You can see from

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-21 Thread David Winsemius
> On Feb 20, 2017, at 4:43 PM, stephen sefick wrote: > > Hello All, > > I am writing a package. I would like to encourage the user to look at the > data to rectify errors with function A before utilizing function B to code > these data as binary. I thought about solving this

[R] optimisation - Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2)

2017-02-21 Thread Malgorzata Wieteska via R-help
Hello, I get an error message:Error in checkFunc(Func2, times, y, rho) :   The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2) I try to optimise system of differential equations with 2 extra variables derived from the data.frame. I didn't

[R] Yates correction

2017-02-21 Thread Jomy Jose
I tried to do chi square test for the following observed frequencies - A B A 8 4 B 12 10 R gave the following output:

Re: [R] R scripts attached to e-mails - correct MIME type ?!

2017-02-21 Thread Martin Maechler
> peter dalgaard > on Mon, 20 Feb 2017 19:45:18 +0100 writes: > Not by the mail server as such, no, at least not for that > reason. However, T-bird likely sends .txt as text/plain > and .R as application/octet-stream (or so) and _therefore_ > the

Re: [R] Confused about using data.table package,

2017-02-21 Thread peter dalgaard
Just. Don't. Do. This. (Hint: Threading mail readers.) On 21 Feb 2017, at 03:53 , C W wrote: > Thanks Hadley! > > While I got your attention, what is a good way to get started on ggplot2? ;) -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School

[R] Antwort: Re: Antwort: Re: packrat: Failed to download current version of foreign(0.8-67)

2017-02-21 Thread G . Maubach
Packrat does a beautiful job, creating local project repositories of all used libraries. If only one library is missing the complete repository is not stored. Having all but one library in the repository is far better than having none. I suggest to change the behaviour of packrat to store all

Re: [R] Antwort: Re: packrat: Failed to download current version of foreign(0.8-67)

2017-02-21 Thread Uwe Ligges
Yes, then we cannot help and you have to ask your company how to get the files, of course. Best, Uwe Ligges On 21.02.2017 08:16, g.maub...@weinwolf.de wrote: Hi Mr. Ligges, doing as you said R responds with install.packages("foreign") trying URL

Re: [R] Confused about using data.table package,

2017-02-21 Thread Jeff Newmiller
I suspect Hadley would recommend reading his new book, R for Data Science (r4ds.had.co.nz), in particular Chapter 3. You don't need plyr, but it won't take long before you will want to be using dplyr and tidyr, which are covered in later chapters. -- Sent from my phone. Please excuse my