Re: [R] tikzDevice and Sweave

2016-01-17 Thread Duncan Mackay
Hi I use Sweave and some tikz in latex but not in Sweave Your problem is that you left out Sweave in the preamble It must be in the preamble of any Sweave document I added sizing so that it is not off the page. I do not know if Sweave options will cover this or you have to set it. eg

[R-es] Nuevas versiones de R

2016-01-17 Thread Javier Marcuzzi
Estimados Hay algo bueno porque es sobre R, pero no se si tan bueno al aparecer versiones de varios R. No lo mire, no lo utilice, pero existe y negarlo es un error, utilizarlo depende el contexto. Sobre las nuevas versiones de R comparto lo siguiente:

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Charles C. Berry
On Sun, 17 Jan 2016, Lars Bishop wrote: I’d appreciate your help on understanding the following. It is not very clear to me from the model.matrix documentation, why simply changing the order of terms in the formula may change the number of resulting columns. Please note I’m purposely not

Re: [R] The "cloud" CRAN server.

2016-01-17 Thread Rolf Turner
On 17/01/16 23:51, peter dalgaard wrote: On 17 Jan 2016, at 05:07 , Rolf Turner wrote: In another thread you wrote: One note: The "cloud" CRAN server is nowadays reachable as https://cloud.r-project.org and that is now the preferred URL. Should I

Re: [R] tikzDevice and Sweave

2016-01-17 Thread Duncan Murdoch
On 17/01/2016 3:25 PM, Naresh Gurbuxani wrote: I want to use tikz() function in tikzDevice package so that it generates a pdf file to be included in the bigger tex file. Below code works, but directly inserts tikz commands in the output tex file. This works: <>= This does not work: <>= Full

Re: [R] Ordinal regression with some categories combined for some data

2016-01-17 Thread Bob O'Hara
Thanks, Thierry & Duncan. I'll go down the survival analysis route. The data are for central American epiphytes, so not your usual species. Visually there's definitely differences in the times of germination, but not in eventual germination, so that's straightforward. Bob On 17 January 2016 at

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
Question: I(a*b) would work as long as both “a" and “b” are numeric. Is there a way I can force the behaviour of model.matrix when one of these variables is a factor (as in "f1:trt" from my example below)? Specifically, based on my example below, I would like to always return the first matrix

Re: [R] tikzDevice and Sweave

2016-01-17 Thread Duncan Murdoch
On 17/01/2016 3:40 PM, Duncan Murdoch wrote: On 17/01/2016 3:25 PM, Naresh Gurbuxani wrote: I want to use tikz() function in tikzDevice package so that it generates a pdf file to be included in the bigger tex file. Below code works, but directly inserts tikz commands in the output tex file.

Re: [R] featurised matrix factorisation in R

2016-01-17 Thread Sandeep Rana
Thanks Berend, Through NMF we would be able to capture relationship between users and items and discover latent factors/topics of those users items. I want to combine the above with effect of user features(e.g: gender, age, location, time… etc.) and item features (e.g.: item_category, price,

[R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Pradeep Bisht
Hello Experts , Being a SAS developer I am finding it difficult to perform some of data cleaning in R that are quite easy to perform in SAS . I have been trying to read a .dat file and after a lot of attempts have failed to find a solution . Maybe R doesn't have the functionality right now or I

Re: [R] Split Strings

2016-01-17 Thread Adrian Dușa
Try this: mylist <- list("pc_m2_45_ssp3_wheat", "pc_m2_45_ssp3_wheat", "ssp3_maize", "m2_wheat") mylist <- lapply(mylist, function(x) unlist(strsplit(x, split="_"))) allstrings <- unique(unlist(mylist)) lapply(mylist, function(x) allstrings[match(allstrings, x)]) [[1]] [1] "pc""m2""45"

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
This is very helpful, thanks! Lars. > On Jan 17, 2016, at 1:34 PM, Charles C. Berry wrote: > > On Sun, 17 Jan 2016, Lars Bishop wrote: > >> I’d appreciate your help on understanding the following. > >> It is not very clear to me from the model.matrix documentation, why

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Rolf Fankhauser
Hello Pradeep I downloaded divorce.dat but I could not find tabs between the columns. You defined tab as separator, so your columns should be separated by tabs. Therefore read.table reads the whole first line and wants to save the result as numeric because you defined the first column as

[R] Split Strings

2016-01-17 Thread Miluji Sb
I have a list of strings of different lengths and would like to split each string by underscore "_" pc_m2_45_ssp3_wheat pc_m2_45_ssp3_wheat ssp3_maize m2_wheat I would like to separate each part of the string into different columns such as pc m2 45 ssp3 wheat But because of the different

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Ben Tupper
Hi Pradeep, Any software would be challenged to determine the boundaries between your columns. ff <- 'http://data.princeton.edu/wws509/datasets/divorce.dat' txt <- readLines(ff) head(txt) # [1] " idheduc heblack mixed years div " " 9 12-15 yearsNo

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Uwe Ligges
This is not a tab delimited file (as you apparently assume given the code), but a fixed width format, hence I'd try: url <- "http://data.princeton.edu/wws509/datasets/divorce.dat; widths <- c(9, 13, 10, 8, 10, 6) f5 <- read.fwf(url, widths = widths, skip = 1, strip.white = TRUE) names(f5) <-

[R] tikzDevice and Sweave

2016-01-17 Thread Naresh Gurbuxani
I want to use tikz() function in tikzDevice package so that it generates a pdf file to be included in the bigger tex file. Below code works, but directly inserts tikz commands in the output tex file. This works: <>= This does not work: <>= Full code is given below:

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Uwe Ligges
Dear Rolf, I'll take a look how to fix it tomorrow, your proposal is very welocme, of course, Best, Uwe On 18.01.2016 00:01, Rolf Turner wrote: On 18/01/16 10:48, Uwe Ligges wrote: This is not a tab delimited file (as you apparently assume given the code), but a fixed width format, hence

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Pradeep Bisht
A Big thanks to everyone to help me solve this problem . My bad I assumed the file is delimited by tab which it was not . Its a fixed width file and the code that Uwe gave is just perfect . It was cleaver to skip the first row since the delimiter cannot be specified in this case .I added few more

Re: [R] Reading a tab delimted file of varying length using read.table

2016-01-17 Thread Rolf Turner
On 18/01/16 10:48, Uwe Ligges wrote: This is not a tab delimited file (as you apparently assume given the code), but a fixed width format, hence I'd try: url <- "http://data.princeton.edu/wws509/datasets/divorce.dat; widths <- c(9, 13, 10, 8, 10, 6) f5 <- read.fwf(url, widths = widths, skip =

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread peter dalgaard
> On 17 Jan 2016, at 19:34 , Charles C. Berry wrote: > > > IIRC, there are some heuristics involved harking back to the White Book. I > recall there have been discussions of whether and how this could be fixed > before on this list and or R-devel, but I cannot seem to lay

Re: [R] Split Strings

2016-01-17 Thread William Michels via R-help
> str_1 <- list("pc_m2_45_ssp3_wheat", "pc_m2_45_ssp3_wheat", "ssp3_maize", > "m2_wheat") > str_2 <- strsplit(unlist(str_1), "_") > max.length <- max(sapply(str_2,length)) > str_3 <- lapply(lapply(str_2, unlist), "length<-", max.length) > str_3 See:

[R] (no subject)

2016-01-17 Thread maryam firoozi via R-help
hello, we want to do genomic blup in r.i know that use pedigree package. the formule is gblup( P~1,data=ped[,c('ID','P')],M=M,lambda=1/h2-1) P:phenotype variance ped:pedigree M: matrix marker or genotype my ped has 4500 ID.but my M has 9000 individual.becasue i have two row for each ID in M

Re: [R] Problems with data structure when using plsr() from package pls

2016-01-17 Thread CG Pettersson
Thanks a lot to both of you for the effort and nice suggestions. I have tested all suggested coding variants and I do succeed in changing the data structure, for example like this (with a test using str()) > names(n96) <- paste("n96", 1:96) > frame1 <- cbind(gushVM, n96) > > str(frame1)

[R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
I’d appreciate your help on understanding the following. It is not very clear to me from the model.matrix documentation, why simply changing the order of terms in the formula may change the number of resulting columns. Please note I’m purposely not including main effects in the model formula

Re: [R] The "cloud" CRAN server.

2016-01-17 Thread peter dalgaard
> On 17 Jan 2016, at 05:07 , Rolf Turner wrote: > > > In another thread you wrote: > >> One note: The "cloud" CRAN server is nowadays reachable as >> >>https://cloud.r-project.org >> >> and that is now the preferred URL. > > Should I understand from this that

Re: [R] Ordinal regression with some categories combined for some data

2016-01-17 Thread Frank Harrell
This does seem to be a good situation for ordinal regression. The R rms package's orm function allows for thousands of categories in Y. But it doesn't handle censoring. This discussion would be better for stats.stackexchange.com Frank --

Re: [R] Aggregate records to 10min

2016-01-17 Thread Fankhauser GEP Data Consulting
Hi Jim, Thanks a lot! It works now. I didn't remember how to access the datetimes in w10min. names(...) is the solution! Rolf Jim Lemon wrote: Hi Rolf, If I get the above, perhaps if you change the names of w10min after applying the calculation: