[R] problem with intToChar

2010-06-01 Thread Changbin Du
Hi, Dear R- community, I am use the intToChar function to convert the integers to letters. But the output is mess. Can you guys give some suggestions? Thanks! > outcome.predict [1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 7 4 4 4 4 4 4 4 4 [26] 4 4 4 4 4 4 4 4 4 4 4

Re: [R] problem with intToChar

2010-06-01 Thread Changbin Du
It does not work. > outcome.label<-LETTERS(outcome.predict) Error: could not find function "LETTERS" On Tue, Jun 1, 2010 at 1:48 PM, Henrique Dallazuanna wrote: > Try this: > > LETTERS[outcome.predict] > > On Tue, Jun 1, 2010 at 5:43 PM, Changbin Du wr

Re: [R] problem with intToChar

2010-06-01 Thread Changbin Du
label<-intToChar(as.integer(outcome.predict)) ?outcome.label<-LETTERS(outcome.predict) plot(final.xyf, type="property", property=outcome.predict, labels=outcome.label, palette.name =rainbow, main="Supervised:Prediction ") Thanks so much! On Tue, Jun 1, 2010 at 1:50 PM, Eri

Re: [R] problem with intToChar

2010-06-01 Thread Changbin Du
Thanks to all! Yes, LETTERS[outcome.predict] works! I appreciated your guys help! On Tue, Jun 1, 2010 at 1:53 PM, Henrique Dallazuanna wrote: > use "[" not "(" > > > On Tue, Jun 1, 2010 at 5:50 PM, Changbin Du wrote: > >> It does no

Re: [R] how to label the som notes by the majority vote

2010-06-01 Thread Changbin Du
ar Changbin, > > Please provide a self-contained, minimal example, meaning the whole code > should run and create the plot as it is now, without having to load your > dataset (which we don't have). Otherwise it's impossible to see what's going > on and help you. >

Re: [R] how to label the som notes by the majority vote

2010-06-02 Thread Changbin Du
as.factor(temp.predict))], > main="Mapping plot",labels=label) > > It does not calculate the majority vote itself, it just assigns a label to > the category based on the predicted labels. Which is equivalent in this > case. > > Cheers > Joris > > >

[R] why the dim gave me different results

2010-06-02 Thread Changbin Du
> dim(tmp) [1] 576 12 > tmp 1 10 11 12 13 2 3 4 5 6 7 9 10 0 0 0 0 0 0 12 0 0 0 0 20 0 0 0 0 0 0 15 0 0 0 0 30 0 0 0 0 0 0 11 0 0 0 0 40 0 0 0 0 0 0 11 0 0 0 0 50 0 0 0 0 0 0 12 0 0 0 0 60 0 0 0

Re: [R] why the dim gave me different results

2010-06-02 Thread Changbin Du
Department of Statistics > UC Berkeley > spec...@stat.berkeley.edu > > > > On Wed, 2 Jun 2010, Changbin Du wrote: > > dim(tmp) >>> >> [1] 576 12 >> >

Re: [R] can I use the output of a neural network as the fitness function of genetic algorithm?

2011-02-07 Thread Changbin Du
_ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >

[R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
HI, Dear R community, I try to create 100 dummy variables like the following: ack$id_1 <- (ack$ID==1)*1 ack$id_2 <- (ack$ID==2)*1 .. . ack$id_100 <- (ack$ID==100)*1 I used the following codes: for(i in 1:100){ ack$id_[i] <- (ack$ID==i)*1 } But only one colum

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
> "Is the room still a room when its empty? Does the room, > the thing itself have purpose? Or do we, what's the word... imbue it." > - Jubal Early, Firefly > > r-help-boun...@r-project.org wrote on 02/24/2011 01:23:54 PM: > > > [image removed] > &

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
Thanks, David! On Thu, Feb 24, 2011 at 11:30 AM, David Winsemius wrote: > > On Feb 24, 2011, at 1:23 PM, Changbin Du wrote: > > HI, Dear R community, >> >> I try to create 100 dummy variables like the following: >> >> ack$id_1 <- (ack$ID==1)*1 >>

Re: [R] create dummy variables by for loop

2011-02-24 Thread Changbin Du
atrix to create dummy variables: > > mydummies = model.matrix(~myfactor)[, -1] > > You'll get as many dummy variables as values you have in ack$ID - > minus 1 (for the reference level). > Dimitri > > On Thu, Feb 24, 2011 at 2:30 PM, Changbin Du wrote: > > Thanks to al

Re: [R] R² for non-linear model

2011-03-16 Thread Changbin Du
list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Sincerel

[R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
Dear R community, I have a data set like the following: probe_name chr_id position array1 array2 array3 array4 array5 array6 array7 1C-3 10 16566949 10 10 10 10 10 10 10 2C-3AAAB 17 33478940 10 10 10 10 10 10 10 3C-3AAAC

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
op > based on that test? > > Michael > > On Mon, Aug 22, 2011 at 12:35 PM, Changbin Du wrote: > >> Dear R community, >> >> I have a data set like the following: >> >> probe_name chr_id position array1 array2 array3 array4 array5 array6 >> array7

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
n(x){any (x != 10)}) > # apply the test function row-wise to get a logical vector of which rows to > keep > > Answer = M[rowsToKeep,] # keep only those rows > > Hope this helps, > > Michael > > > On Mon, Aug 22, 2011 at 12:56 PM, Changbin Du wrote: > >> H

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
ch rows to > keep > > Answer = M[rowsToKeep,] # keep only those rows > > Hope this helps, > > Michael > > > On Mon, Aug 22, 2011 at 12:56 PM, Changbin Du wrote: > >> HI, Michael, >> >> What I want to do is remove all the rows, for which array1, arr

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
PS -- Is your data guaranteed to be an integer? If you have floating point > data, it's good practice to use something more like > > abs(x - 10) > 1e-8 > > rather than x != 0 in your code. If you need to use this formulation, just > put it inside the any() statement. >

[R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
HI, Dear R community, I want to split a data frame by using two variables: let and g > x = data.frame(num = c(10,11,12,43,23,14,52,52,12,23,21,23,32,31,24,45,56,56,76,45), let = letters[1:5], g = 1:2) > x num let g 1 10 a 1 2 11 b 2 3 12 c 1 4 43 d 2 5 23 e 1 6 14 a 2 7

Re: [R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
Thanks for the great helps from David, Jim and Liviu. It solved my problem. Appreciated! On Thu, Sep 1, 2011 at 11:01 AM, David Winsemius wrote: > > On Sep 1, 2011, at 1:53 PM, Changbin Du wrote: > > HI, Dear R community, >> >> I want to split a data frame by using

Re: [R] how to split a data frame by two variables

2011-09-01 Thread Changbin Du
e to be > *very* large before it mattered. > > -Don > > > -- > Don MacQueen > > Lawrence Livermore National Laboratory > 7000 East Ave., L-627 > Livermore, CA 94550 > 925-423-1062 > > > > > > On 9/1/11 11:08 AM, "Changbin Du" wrote: >

[R] question about read.columns

2011-06-22 Thread Changbin Du
HI, Dear R community, I have a large data set names dd.txt, the columns are: there are 2402 variables. a1, b1, ..z1, a11, b11, ...z11, a111, b111, ..z111.. IF I dont know the relative position of the columns, but I know I need the following variables: var<-c(a1, c1,a11,b11,f111) Can I use read.

Re: [R] question about read.columns

2011-06-22 Thread Changbin Du
Hi, Gabor, Thanks so much, I will try it and let you know the results. Appreciated! On Wed, Jun 22, 2011 at 2:54 PM, Gabor Grothendieck wrote: > On Wed, Jun 22, 2011 at 5:45 PM, Changbin Du wrote: > > HI, Dear R community, > > > > I have a large data set names dd

Re: [R] question about read.columns

2011-06-22 Thread Changbin Du
quot;/house/homedirs/c/cdu/operon/gh5/hypo_re.dimer", header=FALSE, sep="\t",sql="select varr from file", quote="", fill=T) *Error: could not find function "read.csv.sql"* On Wed, Jun 22, 2011 at 2:57 PM, Changbin Du wrote: > Hi, Gabor, > &g

Re: [R] question about read.columns

2011-06-22 Thread Changbin Du
On Wed, Jun 22, 2011 at 3:04 PM, Gabor Grothendieck wrote: > On Wed, Jun 22, 2011 at 6:01 PM, Changbin Du wrote: > > I found the following errors: > > > > > >> library(sqldf) > > Loading required package: DBI > > Loading required package: RSQLite > &

Re: [R] question about read.columns

2011-06-22 Thread Changbin Du
I will try this first. Thanks, Gabor! On Wed, Jun 22, 2011 at 3:15 PM, Gabor Grothendieck wrote: > On Wed, Jun 22, 2011 at 6:10 PM, Changbin Du wrote: > > My R is 2.12.0. > > > >> R.version.string > > [1] "R version 2.12.0 (2010-10-15)" >

Re: [R] question about read.columns

2011-06-22 Thread Changbin Du
#x27;sqldf' had non-zero exit status When I try to remove the */house/homedirs/c/cdu/library/00LOCK'* by rm -r 00LOCK, I got the following errors: cdu@nuuk:~/library$ rm -r 00LOCK *rm: cannot remove `00LOCK/RSQLite/libs/.nfs0001301e52e00004': Device or resource busy*

[R] how to replace the following string

2011-06-27 Thread Changbin Du
HI, Dear R-community, I have one vector of the following string, > test<-c("H.1.Y", "N.0.E", "G.1.N", "E.0.P", "W.2.G", "W.4.G", "W.3.W", "W.0.N", "D.1.H") > test [1] "H.1.Y" "N.0.E" "G.1.N" "E.0.P" "W.2.G" "W.4.G" "W.3.W" "W.0.N" "D.1.H" *I want to change them into* "H{1}Y" "N{0}E" "G{1}N" "

Re: [R] how to replace the following string

2011-06-27 Thread Changbin Du
"W.0.N" "D.1.H" > > sub("\\.([0-9]+)\\.", "{\\1}", test) > [1] "H{1}Y" "N{0}E" "G{1}N" "E{0}P" "W{2}G" "W{4}G" "W{3}W" "W{0}N" "D{1}H" > > > > > On

Re: [R] R on Multicore for Linux

2011-07-22 Thread Changbin Du
Nabble.com. >[[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self

[R] create variables through a loop

2011-09-22 Thread Changbin Du
HI, Dear R community, I am trying to created new variables and put into a data frame through a loop. My original data set: head(first) probe_name chr_id position array1 1C-7SARK 1 849467 10 2C-4WYLN 1 854278 10 3C-3BFNY 1 854471 10 4C-7ONNE

Re: [R] create variables through a loop

2011-09-22 Thread Changbin Du
ments for a function are. > > More generally, this sort of thing may be best handled in a list rather > than an set of independent variables. > > Michael Weylandt > > On Thu, Sep 22, 2011 at 1:07 PM, Changbin Du wrote: > >> HI, Dear R community, >> >>

Re: [R] create variables through a loop

2011-09-22 Thread Changbin Du
) > > first.out <- do.call("cbind", list(first, result.fun)) > print(first.out) > > which provides this output. > > x y z a b > 1 1 6 11 1 4 > 2 2 7 12 2 5 > 3 3 8 13 3 6 > > More generally, you really should read about how arguments and ass

Re: [R] create variables through a loop

2011-09-22 Thread Changbin Du
s? What > about (untested): > > for (i in 1:2) { > first <-cbind(first, result.fun[[i]]) > } > > you will then have to look at > names(first) > and change the last part of it to > paste("array",2:3,sep="") > > Hope that works! > JC &

Re: [R] create variables through a loop

2011-09-22 Thread Changbin Du
10 10 10 10 5 10 10 10 10 6 10 10 10 10 Appreciated your great helps! On Thu, Sep 22, 2011 at 10:55 AM, Changbin Du wrote: > Thanks so much, Michael! > > > head(first) > probe_name chr_id position array1 > 1C-7S

Re: [R] create variables through a loop

2011-09-22 Thread Changbin Du
C-7SARK 1 849467 10 10 10 10 10 > 10 > 6C-7SCGC 1 874609 10 10 10 10 10 > 10 > array07 array08 array09 array10 > 1 10 10 10 10 > 2 10 10 10 10 > 3 10 10

[R] get the first character element from a list

2012-02-09 Thread Changbin Du
test<-c("20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL", "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL") > test [1] "20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL" [2] "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL" fields1<-str

Re: [R] get the first character element from a list

2012-02-09 Thread Changbin Du
Thanks so much, David! I will try. On Thu, Feb 9, 2012 at 3:04 PM, David Winsemius wrote: > > On Feb 9, 2012, at 5:01 PM, Changbin Du wrote: > > test<-c("20120111_181515_001_**CCL54D_A01_S02_APL932_PL11_DL_** >> 20120111.CEL", >> "20120111_181516_002_

<    1   2