[R] Corrupting files while copying (was Re: saveRDS() and readRDS() Why? [solved, pretty much anyway])

2018-11-13 Thread Patrick Connolly
Thanks William, I've used Dolphin for years and never encountered that phenomenon. Even so, that description doesn't fit what's going on here. 1.7 kilobytes is hardly a 'large directory'. The problem seems to be with the way VirtualBox mounts directories which isn't an R issue, nor is the fact

Re: [R] POS tagging generating a string

2018-11-13 Thread Robert David Burbidge via R-help
On 13/11/2018 12:31, Elahe chalabi wrote: Hi Robert, Thanks for your reply but your code returns the number of verbs in each massage. What I want is a string showing verbs in each massage. The output of my code (below) is: # A tibble: 4 x 2   DocumentID verbs    1 478920

Re: [R] Help with Centroids

2018-11-13 Thread Robert David Burbidge via R-help
Hi Sasha, Your attached table did not come through, please see the posting guidelines: "No binary attachments except for PS, PDF, and some image and archive formats (others are automatically stripped off because they can contain malicious software). Files in other formats and larger ones

Re: [R] How to create gridded data

2018-11-13 Thread lily li
Thanks, Sarah's answer helps the question. Now how to change the gridded data back to DF1 format? I don't know how to name the format, thanks. On Tue, Nov 13, 2018 at 10:56 PM David L Carlson wrote: > Sarah's answer is probably better depending on what you want to do with > the resulting data,

Re: [R] saveRDS() and readRDS() Why? [solved, pretty much anyway)

2018-11-13 Thread William Dunlap via R-help
Perhaps you got bitten by Dolphin's non-modal dialogs, as described in https://userbase.kde.org/Dolphin/File_Management: Non Modal Dialogs When Moving, Copying or Deleting files/directories the dialog disappears even when the operation has not yet completed. A progress bar then appears in the

Re: [R] saveRDS() and readRDS() Why? [solved, pretty much anyway)

2018-11-13 Thread p_connolly
This is getting more strange. I normally copy from the shared folder to the appropriate directory using Dolphin, the KDE file manager. If instead I use the standard bash cp command, no corruption happens -- at least with the limited testing I have done. There also seems to be no problem

Re: [R-es] función IF

2018-11-13 Thread Javier Marcuzzi
Estimada Belén Cillero Jiménez El problema es simple, hay que escribirlo nuevamente. Yo al realizar algo con if escribo el primero y pruebo, escribo el segundo y pruebo, voy paso por paso, sobre todo si utilizo if, si lo realizo de otra forma escribo todo junto sin drama, pero if crea esos casos

Re: [R] Interplay rnaturalearth, vwline

2018-11-13 Thread Paul Murrell
There are a couple of important concepts in play here: 1. You are drawing the map with the 'graphics' system, but 'vwline' works in the 'grid' system. 2. In the 'grid' system, you can work with lots of different coordinate systems. The default is usually "npc" (which is 0 to 1), but you

[R-es] función IF

2018-11-13 Thread Belén Cillero Jiménez
Buenas noches Escribo la siguiente sintaxis para crear la variable epa_web$DTANque va a tomar valores entre10 y 8: epa_web$DTAN<-' ' if ((epa_web$DTANT<1) && (epa_web$DTANT!=' ')){ epa_web$DTAN<-1 } else if ((epa_web$DTANT>=1) && (epa_web$DTANT<3)) {epa_web$DTAN<-2 } else if

Re: [R] which element is duplicated?

2018-11-13 Thread Duncan Murdoch
On 13/11/2018 12:58 PM, William Dunlap wrote: You also asked about doing this for the rows of a matrix.  unique() give the unique rows but match operates on a per element, not per row, basis.  You can use split, which operates on rows of a matrix, to help. > m <- cbind(

[R] Using lm on data.frame with categorical data as character column results in error in plot.lm

2018-11-13 Thread Gerhard Burger
Hi all, Not sure if the following could be considered a bug, or just a user error but here goes: We're teaching our students to use the tidyverse for most of their R stuff and the following gives problems (code adapted/shortened to pinpoint problem): ``` iris_long = tidyr::gather(iris, key

[R] Help with Centroids

2018-11-13 Thread sasa kosanic
Dear All, I am pretty new to R and would appreciate a help how to calculate centroids from the latitude and longitude of existing cells (e.g. to get centroid for a new cell I would need to combine latitude and 9161,9162,9163,9164 to 9160 or 10152, 10154 to 10150 etc.) Please see attached

Re: [R] which element is duplicated?

2018-11-13 Thread William Dunlap via R-help
You also asked about doing this for the rows of a matrix. unique() give the unique rows but match operates on a per element, not per row, basis. You can use split, which operates on rows of a matrix, to help. > m <- cbind( A=c(i=5,ii=5,iii=5,iv=4,v=4,vi=4), B=c(2,3,2,2,2,2) ) > unique(m) A B

Re: [R] Unexpected failure of Cholesky docomposition

2018-11-13 Thread Hoffman, Gabriel
There was a typo in my example. Here is the fixed version: # initialize matrix values = c(1,0.725,0,0,0.725,1,0.692,0,0,0.692,1,0.664,0,0,0.664,1) B = matrix(values, 4,4) # show that singular values are positive svd(B)$d # show that matrix is symmetric isSymmetric(B) # B is symmetric positive

Re: [R] Output of arima

2018-11-13 Thread William Dunlap via R-help
Try supplying the order argument to arima. It looks like the default is to estimate only the mean. > arima(b, order=c(1,0,0)) Call: arima(x = b, order = c(1, 0, 0)) Coefficients: ar1 intercept 0.8871 0.2369 s.e. 0.0145 0.2783 sigma^2 estimated as 1.002: log

Re: [R] Unexpected failure of Cholesky docomposition

2018-11-13 Thread William Dunlap via R-help
Aren't singular values always positive or zero? Look at eigen(B)$values to check for positive definiteness. Fix your example - your B is not symmetric. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Nov 13, 2018 at 7:30 AM, Hoffman, Gabriel wrote: > My understanding is that a Cholesky

Re: [R] saveRDS() and readRDS() Why? [solved, pretty much anyway)

2018-11-13 Thread William Dunlap via R-help
It seems like copying the files corrupted them. How did you copy them (with R or cp or copy or ftp, etc.)? I don't see how this has anything to do with R. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 12, 2018 at 7:10 PM, p_connolly wrote: > On 2018-11-13 12:55, William Dunlap

[R] Interplay rnaturalearth, vwline

2018-11-13 Thread Ferri Leberl
Dear All, There is something I don't understand fundamentally about handling geocoords with vwlines, as the axample below may illustrate. vwlines seems to require values somewhere between 0 and 1 as shares of the plot length and width, but obviously that's not the complete story: Point (1,1) is

Re: [R] semiparametric manova

2018-11-13 Thread Yectli Huerta via R-help
> > xtabs(~V1+V2+V3, df) # There are 9 cells with 0 entries. That is the > > problem. > > , , V3 = 9 > > V2 > V1 8 16 24 > 200 5 0 5 > 350 5 5 0 > 500 0 5 5 thanks for the insight yah signature.asc Description: OpenPGP digital signature __

Re: [R] Unexpected failure of Cholesky docomposition

2018-11-13 Thread Bert Gunter
Your understanding is wrong. The eigenvalues, not singular values, must be positive, and they are not. Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On

Re: [R] Unexpected failure of Cholesky docomposition

2018-11-13 Thread Eric Berger
Eigen shows that the matrix is not positive definite (it has a negative eigenvalue). And isSymmetric() also shows it is not symmetric - compare (3,4) and (4,3) On Tue, Nov 13, 2018 at 5:39 PM Hoffman, Gabriel wrote: > My understanding is that a Cholesky decomposition should work on any >

[R] Unexpected failure of Cholesky docomposition

2018-11-13 Thread Hoffman, Gabriel
My understanding is that a Cholesky decomposition should work on any square, positive definite matrix. I am encountering an issue where chol() fails and give the error: "the leading minor of order 3 is not positive definite" This occurs on multiple machines and version of R. Here is a minimal

[R] lm equivalent of Welch-corrected t-test?

2018-11-13 Thread Paul Johnson
Long ago, when R's t.test had var.equal=TRUE by default, I wrote some class notes showing that the result was equivalent to a one predictor regression model. Because t.test does not default to var.equal=TRUE these days, I'm curious to know if there is a way to specify weights in an lm to obtain

Re: [R] How to create gridded data

2018-11-13 Thread David L Carlson
Sarah's answer is probably better depending on what you want to do with the resulting data, but here's a way to go from your original DF1 to DF2: > DF1 <- structure(list(latitude = c(45.5, 45.5, 45.5, 45.5, 46, 46, 46, + 46), longitude = c(110.5, 111, 111.5, 112, 110.5, 111, 111.5, +

Re: [R] How to create gridded data

2018-11-13 Thread Sarah Goslee
If you want an actual spatial dataset, the best place to ask is R-sig-geo R has substantial capabilities for dealing with gridded spatial data, including in the sp, raster, and sf packages. Here's one approach, creating a SpatialGridDataFrame, which can be exported in any standard raster format

Re: [R] How to create gridded data

2018-11-13 Thread S Ellison
You might take a look at the reshape package, which switches from 'long' to 'wide' formats and vice versa in a fairly flexible way. S Ellison > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li > Sent: 13 November 2018 07:22 > To: R mailing

Re: [R] Output of arima

2018-11-13 Thread Eric Berger
Try google'ing for 'variance of an AR(1) process'. With the same seed, if you set n=100, you will get something that will compare well with what you discover from your search. On Tue, Nov 13, 2018 at 2:04 PM Ashim Kapoor wrote: > Dear All, > > Here is a reprex: > > set.seed(123) > b <-

[R] Output of arima

2018-11-13 Thread Ashim Kapoor
Dear All, Here is a reprex: set.seed(123) b <- arima.sim(list(order = c(1,0,0),ar= .9),n=1000,sd=1) arima(b) Call: arima(x = b) Coefficients: intercept 0.2250 s.e. 0.0688 sigma^2 estimated as 4.735: log likelihood = -2196.4, aic = 4396.81 > Should sigma^2 not be equal to

Re: [R] MGCV:: boundary conditions in gam

2018-11-13 Thread Mark R Payne
Perfect! This might be a good example to add to the documentation of mgcv somewhere Thanks. Mark On Thu, 8 Nov 2018 at 22:08, Simon Wood wrote: > This first derivative penalty spline will do it, but the price paid is > that the curves are often quite wiggly. > > > library(mgcv);

Re: [R] which element is duplicated?

2018-11-13 Thread Duncan Murdoch
On 13/11/2018 12:35 AM, Pages, Herve wrote: Hi, On 11/12/18 17:08, Duncan Murdoch wrote: The duplicated() function gives TRUE if an item in a vector (or row in a matrix, etc.) is a duplicate of an earlier item.  But what I would like to know is which item does it duplicate? For example, v <-

[R-es] 10 días para las X Jornadas de Usuari@s de R en Murcia!

2018-11-13 Thread Antonio Maurandi López
Quedan menos de 10 días para las X Jornadas de Usuari@s de R en Murcia! Aquí tienes el *programa*: http://r-es.org/XjuR/pdf/programa-Xjur.pdf * Ponencia Invitada I: Dr. François Husson (http://math.agrocampus-ouest.fr/infoglueDeliverLive/membres/Francois.Husson) * Ponencia Invitada II:

Re: [R] which element is duplicated?

2018-11-13 Thread Martin Maechler
> PIKAL Petr > on Tue, 13 Nov 2018 08:42:22 + writes: > Hi > similar result (with different numerical values) could > be achieved by making v a factor. > > v <- letters[c(2,2,1,2,1,1)] > > vf<-factor(v) > > as.numeric(vf) > [1] 2 2 1 2 1 1 > > Cheers > Petr Yes, as

Re: [R] which element is duplicated?

2018-11-13 Thread PIKAL Petr
Hi similar result (with different numerical values) could be achieved by making v a factor. > v <- letters[c(2,2,1,2,1,1)] > vf<-factor(v) > as.numeric(vf) [1] 2 2 1 2 1 1 Cheers Petr > -Original Message- > From: R-help On Behalf Of Bert Gunter > Sent: Tuesday, November 13, 2018 6:44

Re: [R] missRanger package

2018-11-13 Thread Dénes Tóth
Hi Rebecca, I think it was me how suggested you the missRanger package, so this is actually a follow-up of you previous question about censored imputation of missing values (as far as I can remember). The missRanger package uses predictive mean matching, so take a look at ?missRanger::pmm

Re: [R] How to create gridded data

2018-11-13 Thread Jim Lemon
Hi lily, Something like this should work: DF1<-read.table(text= "latitude longitude Precip 45.5 110.5 3.2 45.5 1115.0 45.5 111.5 1.8 45.5 1122.0 46 110.5 6.1 46 1114.5