Re: [R] [FORGED] same column name in a data frame

2017-03-13 Thread Rolf Turner
On 14/03/17 14:56, Jinsong Zhao wrote: Hi there, I happened to find the following code can generate a data frame with same column name. x <- data.frame(a=c(1,2,3)) y <- data.frame(a=c(2,3,4)) z <- cbind(x,y) However, in this case, one can not use the $ to extract the second column, right? I

[R] Reshaping from long to wide with duplicate idvar and timevar

2017-03-13 Thread Sebastien Bihorel
Hi, I would like to reshape a data.frame from long to wide format. However, the reshape function does not seem to accept data containing rows with duplicate idvar and timevar. Building upon the ?reshape example: summary(Indometh) wide <- reshape(Indometh, v.names = "conc", idvar = "Subject",

[R] same column name in a data frame

2017-03-13 Thread Jinsong Zhao
Hi there, I happened to find the following code can generate a data frame with same column name. > x <- data.frame(a=c(1,2,3)) > y <- data.frame(a=c(2,3,4)) > z <- cbind(x,y) However, in this case, one can not use the $ to extract the second column, right? Is it possible to prevent the cbi

Re: [R] replace

2017-03-13 Thread Marc Schwartz
> On Mar 13, 2017, at 5:53 PM, Val wrote: > > HI all, > > if first name is Alex then I want concatenate the second column to Alex > to produce Alex and the second column value > > DF1 <- read.table(header=TRUE, text='first YR > Alex2001 > Bob 2001 > Cory2001 > Cory2002 > Bob

[R] replace

2017-03-13 Thread Val
HI all, if first name is Alex then I want concatenate the second column to Alex to produce Alex and the second column value DF1 <- read.table(header=TRUE, text='first YR Alex2001 Bob 2001 Cory2001 Cory2002 Bob 2002 Bob 2003 Alex2002 Alex2003 Alex2004') Out

Re: [R] Principle Coordinate Analysis of unweighted UniFrac distances on R

2017-03-13 Thread Bert Gunter
Please read and follow the posting guide. Plain text only + code that you tried + reproducible exam (google it). In general, we do not do tutorials here, but someone may indeed be able to refer you to one on the web. Googling "principal coordinates analysis tutorial R" appeared to bring up releva

[R] Principle Coordinate Analysis of unweighted UniFrac distances on R

2017-03-13 Thread Thilini Maddegoda Vidanelage
Dear all, First of all, I am so grateful if you can help me in analyzing principle coordinate analysis of unweighted UniFrac distances on R. I am analyzing microbial species profile of an individual (BA) versus reference population (HMP) and want to generate a PCoA graph to see whether there any

[R] Error: memory exhausted (limit reached?)

2017-03-13 Thread Guillaume MULLER
Hello everyone, I was working on a DeepNet project at home, with an old PC with 4Gb RAM, running Ubuntu 16.04. For efficiency reason, I stored my dataset as a csv file with write.csv and reloaded it at will with read.csv. I did it several time, everything was working fine. This morning, at wo

[R] ?????? Linear Mixed-Effects Model

2017-03-13 Thread ????
Thank You -- ԭʼ�ʼ� -- ��: "Bert Gunter"; ʱ��: 2017��3��11��(��) 11:44 �ռ���: "��˳"; : "r-help"; : Re: [R] Linear Mixed-Effects Model Have you read the docs? Is this some kind of homework? -- this list does not do homework. We expect m

Re: [R] problem with PCA

2017-03-13 Thread David L Carlson
The manual is talking about the angle between the variables in p dimensional space were p is the number of variables. The angle can appear differently in 2-dimensions depending on your viewing angle (which dimensions you are ignoring, think of how the 2-dimensional shadow of a 3-dimensional obje

Re: [R] Extract student ID that match certain criteria

2017-03-13 Thread Jim Lemon
Hi Roslinazairimah, What you seem to want is fairly simple: dt<-c("AA14068","AA13194","AE11054","AA12251","AA13228", "AA13286","AA14090","AA13256","AA13260","AA13291", "AA14099","AA15071","AA13143","AA14012","AA14039", "AA15018","AA13234","AA13149","AA13282","AA13218") dt[grep(pattern="AA14"

Re: [R] field values from text file to dataframe

2017-03-13 Thread Ulrik Stervbo
I imagine that the FieldStateOption is irrelevant, so you might be able to create a data.frame like this: library(tidyr) fl <- readLines("pdf_dump.txt") fl <- grep("FieldStateOption", fl, value = TRUE, invert = TRUE) field_number <- vector(mode = "integer", length = length(fl)) tmpid <- 0 for(i

Re: [R] field values from text file to dataframe

2017-03-13 Thread Jim Lemon
Hi Vijayan, You have a bit of a problem with repeated field names. While you can mangle the field names to do something like this, I don't see how you are going to make sense of multiple "FieldStateOption" fields. The strategy I would take is to collect all of the field names and then set up rows w

Re: [R] Extract student ID that match certain criteria

2017-03-13 Thread Ulrik Stervbo
Hi Roslinazairimah, As Bert suggested, you should get acquainted with regular expressions. It can be confusing at times, but pays off in the long run. In your case, the pattern of "^[A-Z]{2}14.*" might work. Best, Ulrik On Mon, 13 Mar 2017 at 06:20 roslinazairimah zakaria wrote: > Another que