[R] Svyolr-Properly Specifying Start Values

2016-11-29 Thread Courtney Benjamin
Hello R Users, I am trying to use the svyolr command and coming up with the following error: Error in MASS::polr(formula, data = df, ..., Hess = TRUE, model = FALSE, : attempt to find suitable starting values failed >From what I have read online, a possible solution is to specify a value in

Re: [R] files

2016-11-29 Thread Jeff Newmiller
Presumably using read.table instead of read.csv. Get the import working with one sample file first, then do whatever you had to do with one file over and over. You still need to go read up on regex patterns... to get you started the pattern for matching the csv files would be something like

Re: [R] files

2016-11-29 Thread Val
Thank you Sarah, Some of the files are not csv but some are *txt with space delimited. Bdat.txt Bdat123.txt Bdat456.txt How do I do that? On Tue, Nov 29, 2016 at 8:28 PM, Sarah Goslee wrote: > Something like this: > > filelist <- list.files(pattern="^test")

Re: [R] files

2016-11-29 Thread Sarah Goslee
Something like this: filelist <- list.files(pattern="^test") myfiles <- lapply(filelist, read.csv) myfiles <- do.call(rbind, myfiles) On Tue, Nov 29, 2016 at 9:11 PM, Val wrote: > Hi all, > > In one folder I have several files and I want > combine/concatenate(rbind)

[R] files

2016-11-29 Thread Val
Hi all, In one folder I have several files and I want combine/concatenate(rbind) based on some condition . Here is the sample of the files in one folder test.csv test123.csv test456.csv Adat.csv Adat123.csv Adat456.csv I want to create 2 files as follows test_all =

Re: [R] using grepl in dplyr

2016-11-29 Thread Jeff Newmiller
That is not a very selective regex. Actually, a long "or" probably is best, but you don't have to type it in directly. prefixes <- c( "AD", "FN" ) pat <- paste0( "^(", paste( prefixes, collapse="|" ), ")[0-9]{4}$" ) grepl( pat, Identifier ) -- Sent from my phone. Please excuse my brevity.

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 4:09 PM, David Winsemius wrote: > > >> On Nov 29, 2016, at 11:26 AM, Hadley Wickham wrote: >> >> On Tue, Nov 29, 2016 at 11:52 AM, William Dunlap wrote: The other option would be to load dplyr first

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 11:26 AM, Hadley Wickham wrote: > > On Tue, Nov 29, 2016 at 11:52 AM, William Dunlap wrote: >>> The other option would be to load dplyr first (which would give the waring >>> that >stats::lag was masked) and then later load plm

[R] Dendrogram branches and igraph edges

2016-11-29 Thread Hassan Sinky
Hello everyone, I have generated a dendrogram by applying a hierarchical clustering technique to a graph. Given this dendrogram I am trying to efficiently find/ map/ label the dendrogram branches to their corresponding graph edges. Using dendextend I am able to partition the leaves, obtain

[R] using grepl in dplyr

2016-11-29 Thread Glenn Schultz
Hello All, I have a dataframe of about 1.5 million rows from this dataframe I need to filter out identifiers.  An example would be 07-07099, AD-AD0999, and AL-AL, FN-FN.  I am using grepl to identify those of interest as follows:  grepl("^[FN]|[AD]{2}", Identifier)

Re: [R] Convert arc-second to degree

2016-11-29 Thread Ben Tupper
Hello, I haven't downloaded the data, but a mock-up of your steps below does as you ask. You can see the resolution of y is 1 x 1 and each is filled with the sum of 120 x 120 original cells each of which had a value of 1. In this case, the raster package faithfully interprets the fractional

[R] Convert arc-second to degree

2016-11-29 Thread Miluji Sb
Dear all, I am using the Gridded Population of the World (v4) for the year 2010. The data is in GeoTiFF format. Source: http://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-count-adjusted-to-2015-unwpp-country-totals/data-download I imported the data using: library(raster)

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Marc Schwartz
Hi, To provide a [very] small example of what Bert is referring to: DF <- data.frame(Letters = letters[1:4], int = 1:4) > str(DF) 'data.frame': 4 obs. of 2 variables: $ Letters: Factor w/ 4 levels "a","b","c","d": 1 2 3 4 $ int: int 1 2 3 4 > DF Letters int 1 a 1 2 b

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Bert Gunter
No, no. It *is* for transposing. But it is *what* you are transposing -- a data frame -- that may lead to the problems. You will have to read what I referred you to and perhaps spend time with an R tutorial or two (there are many good ones on the web) if your R learning is not yet sufficient to

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread Sarah Goslee
On Tue, Nov 29, 2016 at 12:39 PM, David Winsemius wrote: > > > The other option would be to load dplyr first (which would give the waring > that stats::lag was masked) and then later load plm (which should give a > further warning that dplyr::lag is masked). Then the

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread Hadley Wickham
On Tue, Nov 29, 2016 at 11:52 AM, William Dunlap wrote: >>The other option would be to load dplyr first (which would give the waring >> that >stats::lag was masked) and then later load plm (which should give a >> further >warning that dplyr::lag is masked). Then the plm::lag

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Bert Gunter
It is probably worth mentioning that this (i.e. transposing a data frame) can be a potentially disastrous thing to do in R, though the explanation is probably more than you want to know at this point (see ?t and follow the 'as.matrix' link for details). But if you start getting weird results and

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Elham - via R-help
thank you all,it worked On Tuesday, November 29, 2016 9:49 PM, "Dalthorp, Daniel" wrote: Try David's suggestion to spell the argument "stringsAsFactors" correctly. Then: data <- read.table("your_file_location", sep ="\t", comment.char = "", stringsAsFactors = F,

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Dalthorp, Daniel
Try David's suggestion to spell the argument "stringsAsFactors" correctly. Then: data <- read.table("your_file_location", sep ="\t", comment.char = "", stringsAsFactors = F, header = T) transpose_data <- t(data) -Dan On Tue, Nov 29, 2016 at 9:56 AM, Elham - via R-help

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Bert Gunter
It's 'stringsAsFactors' = FALSE (without my added quotes) with an 's' at the end of 'strings' . -- 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 Tue,

Re: [R] transpose rows and columns for large data

2016-11-29 Thread Elham - via R-help
yes you have right about excel.by R,what should I do for transposing row and column? On Tuesday, November 29, 2016 9:13 PM, David Winsemius wrote: > On Nov 29, 2016, at 9:22 AM, Elham - via R-help wrote: > > Hi, > > I am trying to

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread William Dunlap via R-help
>The other option would be to load dplyr first (which would give the waring that >stats::lag was masked) and then later load plm (which should give a further >warning that dplyr::lag is masked). Then the plm::lag function will be found >first. Another option is to write the package maintainers

Re: [R] transpose rows and columns for large data

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 9:22 AM, Elham - via R-help wrote: > > Hi, > > I am trying to transpose large datasets inexcel (44 columns and 57774 rows) > but it keeps giving me the message we can'tpaste because copy area and paste > area aren't the same size. Is there a way

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 6:52 AM, Sarah Goslee wrote: > > Hi, > > It shouldn't be entirely unexpected: when I load dplyr, I get a series > of messages telling me that certain functions are masked. > > > The following object is masked from ‘package:plm’: > >between >

[R] transpose rows and columns for large data

2016-11-29 Thread Elham - via R-help
Hi, I am trying to transpose large datasets inexcel (44 columns and 57774 rows) but it keeps giving me the message we can'tpaste because copy area and paste area aren't the same size. Is there a way totranspose all the data at one time instead of piece by piece? One dataset has agreat amount

Re: [R] Unexpected interference between dplyr and plm

2016-11-29 Thread Sarah Goslee
Hi, It shouldn't be entirely unexpected: when I load dplyr, I get a series of messages telling me that certain functions are masked. The following object is masked from ‘package:plm’: between The following objects are masked from ‘package:stats’: filter, lag The following objects

[R] Unexpected interference between dplyr and plm

2016-11-29 Thread Constantin Weiser
Hello, I'm struggling with an unexpected interference between the two packages dplyr and plm, or to be more concrete with the "lag(x, ...)" function of both packages. If dplyr is in the namespace the plm function uses no longer the appropriate lag()-function which accounts for the panel

Re: [R] on ``unfolding'' a json into data frame columns

2016-11-29 Thread Hadley Wickham
Two quick hints: * use simplifyDataFrame = FALSE in fromJSON() * read https://jennybc.github.io/purrr-tutorial/ls02_map-extraction-advanced.html (and https://jennybc.github.io/purrr-tutorial/) Hadley On Tue, Nov 29, 2016 at 8:06 AM, Daniel Bastos wrote: > Greetings! > >

[R] on ``unfolding'' a json into data frame columns

2016-11-29 Thread Daniel Bastos
Greetings! In an SQL table, I have a column that contains a JSON. I'd like easy access to all (in an ideal world) of these JSON fields. I started out trying to get all fields from the JSON and so I wrote this function. unfold.json <- function (df, column) { library(jsonlite) ret <-

Re: [R] nls for R version 3.3.2

2016-11-29 Thread J C Nash
You may also want to use tools that are more robust. Package nlmrt uses analytic Jacobian where possible and a Marquardt solver. Package minpack.lm uses a Marquardt solver, but the forward difference derivatives of nls() for its Jacobian. alpha level work in

Re: [R] independent censoring

2016-11-29 Thread Therneau, Terry M., Ph.D.
On 11/29/2016 05:00 AM, r-help-requ...@r-project.org wrote: Independent censoring is one of the fundamental assumptions in the survival analysis. However, I cannot find any test for it or any paper which discusses how real that assumption is. I would be grateful if anybody could point me

Re: [R] errors when installing packages

2016-11-29 Thread peter dalgaard
Presumably a problem at your end. Suspicion points to permission settings on the target directory, or virus checkers "helpfully" moving recently created files to a safe place for scrutiny. (Do you _really_ get errors for "survival" when installing "Hmisc"? It could happen via a dependency, I

Re: [R] reshaping a large dataframe in R

2016-11-29 Thread PIKAL Petr
Hi probably not at all simpler > dat2.p<-split(t(dat), rep(1:(ncol(dat)/4), each=4)) > dat3.p<-as.data.frame(do.call(rbind, lapply(dat2.p, function(x) t(matrix(x, > 4,nrow(dat)) > > all.equal(dat3.p, dat3) [1] TRUE Cheers Petr > -Original Message- > From: R-help

Re: [R] nls for R version 3.3.2

2016-11-29 Thread David Winsemius
> On Nov 29, 2016, at 12:30 AM, Troels Ring wrote: > > Dear friends - updated to R 3.3.2 - tried to install nls - got this sad > response > > package ‘nls’ is not available (as a binary package for R version 3.3.2) > > I'm on windows 7 I don't see an `nls` package on CRAN.

Re: [R] nls for R version 3.3.2

2016-11-29 Thread Berend Hasselman
> On 29 Nov 2016, at 09:30, Troels Ring wrote: > > Dear friends - updated to R 3.3.2 - tried to install nls - got this sad > response > > package ‘nls’ is not available (as a binary package for R version 3.3.2) > > I'm on windows 7 > > Did I do something wrong? Will a

[R] nls for R version 3.3.2

2016-11-29 Thread Troels Ring
Dear friends - updated to R 3.3.2 - tried to install nls - got this sad response package ‘nls’ is not available (as a binary package for R version 3.3.2) I'm on windows 7 Did I do something wrong? Will a binary appear eventually? Would I have to make it myself? Best wishes Troels Ring