Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Noted. Thank you as well! :) On Tue, Jun 25, 2019 at 5:05 PM Richard O'Keefe wrote: > This has nothing to do with your problem, but given the heavy use of "=" > to bind keyword parameters in R, I find the use of "=" for assignment as > well confusing. It makes code harder to read than it needs

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Thank you! The following is the result of the corrected code using >cnames > cnames [1] "sample.NA.NA.NANA" "TCGA.27.1832.01.NA.NA.NANA" "TCGA.27.1831.01.NA.NA.NANA" [4] "TCGA.28.5216.01.NA.NA.NANA" "TCGA.16.0846.01.NA.NA.NANA" "TCGA.28.5218.01.NA.NA.NANA" [7] "TCGA.06.0178.01.NA.

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Richard O'Keefe
This has nothing to do with your problem, but given the heavy use of "=" to bind keyword parameters in R, I find the use of "=" for assignment as well confusing. It makes code harder to read than it needs to be. The historic " <- " assignment makes the distinction obvious. On Wed, 26 Jun 2019 at

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Rui Barradas
Hello, The following works. First, get the colnames you have posted in a format that R can process. in your code you would skip this. cnames <- scan(what = character(), text = ' "sample.NA.NA.NANA" "TCGA.27.1832.01.NA.NA.NANA" "TCGA.27.1831.01.NA.NA.NANA" "TCGA.28.5216.01.NA.NA.NANA" "TCGA.16.

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Doing so results in the following subset of my data... >colnames(meth)[1:10] [1] "sample.NA.NA.NANA" "TCGA.27.1832.01.NA.NA.NANA" "TCGA.27.1831.01.NA.NA.NANA" [4] "TCGA.28.5216.01.NA.NA.NANA" "TCGA.16.0846.01.NA.NA.NANA" "TCGA.28.5218.01.NA.NA.NANA" [7] "TCGA.06.0178.01.NA.NA.NANA" "TC

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
So I can run the suggested `stringsAsFactors=FALSE` argument following the 'colnames(meth)[1:10]' one I just used? Best, Spencer On Tue, Jun 25, 2019 at 3:28 PM Jeff Newmiller wrote: > A "very large" output from dput(head(meth)) may just mean that"meth" has > factors instead of character colum

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Jeff Newmiller
A "very large" output from dput(head(meth)) may just mean that"meth" has factors instead of character columns. I recommend using the `stringsAsFactors=FALSE` argument if the data frame is being loaded using read.table or one of its variants. It almost always makes better sense to create factors

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Mr. Barradas, Oh haha my mistake. The following is the output you requested [1] "sample.NA.NA.NANA" [2] "TCGA.27.1832.01.NA.NA.NANA" [3] "TCGA.27.1831.01.NA.NA.NANA" [4] "TCGA.28.5216.01.NA.NA.NANA" [5] "TCGA.16.0846.01.NA.NA.NANA" [6] "TCGA.28.5218.01.NA.NA.NANA" [7] "TCGA.06.0178.01.N

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Rui Barradas
Hello, No, you have not understood, post the colnames, not the row.names. Run colnames(meth)[1:10] and post the output of that code line. Hope this helps, Rui Barradas Às 19:31 de 25/06/19, Spencer Brackett escreveu: The requested reprex Rendering reprex... Error in parse(text = x, ke

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
The requested reprex Rendering reprex... Error in parse(text = x, keep.source = TRUE) : :26:2: unexpected ')' 25: 26: 2) ^ And the subset of the data row.names = c(NA, 6L), class = "data.frame") Best, Spencer On Tue, Jun 25, 2019 at 2:25 PM Rui Barradas wrote: > Hello, > >

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Rui Barradas
Hello, No I wasn't expecting a very large file. Try to make a reproducible example. If the problem seems to be with the sapply/strsplit post a subset of the data like just some of the colnames: colnames(meth)[1:10] This would allow us to run the code you are having trouble with. Hope this

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
The result of dput(head(meth)) is a very large data table/listing of data by category of what I presume to be the data from the two TCGA .txt files I referenced previously. Is this the output you were expecting? On Tue, Jun 25, 2019 at 12:19 PM Rui Barradas wrote: > Hello, > > 1) That error com

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Rui Barradas
Hello, 1) That error comes from not closing }) after the paste() instruction. The complete statement would be colnames(meth) = sapply(colnames(meth), function(i){ c1 = strsplit(i, split ='\\', fixed = T)[[1]] c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse = "") p

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
The following is what I have implemented thus far... The file object for the two files listed in lines 1-2 was set in my working directory, and are under the folder "Vakul's GBM Code"... hence the source of the odd 'prefix' for .txt files shown >library(data.table)>.anno = as.data.frame(fread(fil

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Mr. Barradas, I got the same "output" as before, which is the + indicating that the expression is incomplete (according to some R users response in this chain). Should the argument perhaps be c1 = strsplit(i, split = '\\', fixed = T)[[1]] thereby eliminating the "." ? The reprex and error me

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Rui Barradas
Hello, Maybe with c1 = strsplit(i, split = '\\.', fixed = T)[[1]] instead of split = '.' The dot is a metacharacter that matches any character so it has to be escaped. Hope this helps, Rui Barradas Às 16:11 de 25/06/19, Spencer Brackett escreveu: c1 = strsplit(i,split ='.', fixed = T)[[1

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread David Winsemius
On 6/25/19 6:29 AM, Spencer Brackett wrote: Mr. Barradas, My apologies for the delayed response. No, (meth) is not a dataset within CRAN. I’m not sure why my supervisor wrote that in as the object for the bit of script I shared previously. Assuming that the correct object for this particula

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Hello, The following is the bit of code I was having trouble with reproducing; (meth) being the set matrix of the dataset I am working within R... colnames(meth) = sapply(colnames(meth), function(i){ c1 = strsplit(i,split ='.', fixed = T)[[1]] c1[4] = paste(strsplit(c1[4],split = "",fixed = T

Re: [R] Output for pasting multiple vectors

2019-06-25 Thread Spencer Brackett
Mr. Barradas, My apologies for the delayed response. No, (meth) is not a dataset within CRAN. I’m not sure why my supervisor wrote that in as the object for the bit of script I shared previously. Assuming that the correct object for this particular command is to be a data, the one with which we

[R] FW: IRT discrimination value (ltm and psych package)

2019-06-25 Thread shr...@outlook.com
Sent from Mail for Windows 10 From: shr...@outlook.com Sent: Tuesday, June 25, 2019 10:57:30 AM To: Eric Berger Subject: IRT discrimination value (ltm and psych package) Hello Sir, I am learning R and its syntax an