Displaying 20 results from an estimated 7000 matches similar to: "help in output file"
2011 Jun 22
1
question about read.columns
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.columns to read the data into R?
I have tried the following codes, but it does not work
2010 May 26
1
how to Store loop output from a function
HI, Dear R community,
I am writing the following function to create one data set(*tree.pred*) and
one vector(*valid.out*) from loops. Later, I want to use the data set from
this loop to plot curves. I have tried return, list, but I can not use the
*tree.pred* data and *valid.out* vector.
auc.tree<- function(msplit,mbucket) {
* tree.pred<-data.frame()
2010 Apr 21
2
?rpart
HI, Dear R community,
Last friday, I used the codes, it works, but today, it does not run?
> fit.dimer <- rpart(outcome ~., method="class", data=p.df)
Error in `[.data.frame`(frame, predictors) : undefined columns selected
DOEs anyone have comments or suggestions? Thanks in advance!
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
2010 Sep 07
1
change the for loops with lapply
cv.fold<-function(i, size=3, rang=0.3){
cat('Fold ', i, '\n')
out.fold.c <-((i-1)*c.each.part +1):(i*c.each.part)
out.fold.n <-((i-1)*n.each.part +1):(i*n.each.part)
train.cv <- n.cc[-out.fold.c, c(2:2401, 2417)]
train.nv <- n.nn[-out.fold.n, c(2:2401, 2417)]
train.v<-rbind(train.cv, train.nv) #training data for feature
2010 May 12
1
exact the variables used in tree construction
> fit.dimer <- rpart(as.factor(out) ~ ., method="class", data=p_df)
>
> fit.dimer$frame[, "var"]
[1] NE WC <leaf> TA <leaf> <leaf> WG WD WW WC
[11] <leaf> <leaf> <leaf> CT <leaf> FC <leaf> YG QT <leaf>
[21] <leaf> <leaf> NW DP DY <leaf> SK
2010 Dec 16
1
my function does not work for large data set
Dear R community,
I have one function, it works for small data set, but does not work on large
data set, can anyone help me with this?
> #creat new variable by dividing each aa dimer by total_length.
> imper<-function(x, file) {
+ round(x/file$length, 5)
+ }
> dim(test)
[1] 999 2402
> test[varname[2:2401]]<-
2010 Apr 23
1
help in conditional histogram
Dear Dr. Sarkar,
When I try to run the codes, I found the following problem:
> h<- sample(1:14, 319, rep=T)
> c<- sample(1:14, 608, rep=T)
> n<- sample(1:14, 1140, rep=T)
> vt<-c(h, c, n)
> ta<-rep(c("h", "c", "n"), c(319, 608, 1140))
>
> to<-data.frame(vt,ta)
> library(lattice)
Attaching package: 'lattice'
2010 May 11
1
how to extract the variables used in decision tree
HI, Dear R community,
How to extract the variables actually used in tree construction? I want to
extract these variables and combine other variable as my features in next
step model building.
> printcp(fit.dimer)
Classification tree:
rpart(formula = outcome ~ ., data = p_df, method = "class")
Variables actually used in tree construction:
[1] CT DP DY FC NE NW QT SK TA WC WD WG WW
2010 May 25
4
R eat my data
HI, Dear R community,
My original file has 1932 lines, but when I read into R, it changed to 1068
lines, how comes?
cdu@nuuk:~/operon$ wc -l id_name_gh5.txt
1932 id_name_gh5.txt
> gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t",
skip=0, header=F, fill=T)
> dim(gene_name)
[1] 1068 3
--
Sincerely,
Changbin
--
Changbin Du
DOE Joint Genome
2010 Apr 06
2
help output figures in R
somfunc<- function (file) {
aa_som<-scale(file)
final.som<-som(data=aa_som, rlen=10000, grid=somgrid(5,4, "hexagonal"))
pdf(file="/home/cdu/changbin/file.pdf") #output graphic file.
plot(final.som, main="Unsupervised SOM")
dev.off()
}
I have many different files, if I want output pdf file with the same name
as for each dataset I feed to the function
2010 May 03
1
rpart, cross-validation errors question
I ran this code (several times) from the Quick-R web page (
http://www.statmethods.net/advstats/cart.html) but my cross-validation
errors increase instead of decrease (same thing happens with an unrelated
data set).
Why does this happen?
Am I doing something wrong?
# Classification Tree with rpart
library(rpart)
# grow tree
fit <- rpart(Kyphosis ~ Age + Number + Start,
2003 Sep 29
1
CP for rpart
Hi All,
I have some questions on using library rpart. Given my data below, the
plotcp gives me increasing 'xerrors' across different cp's with huge xstd
(plot attached). What causes the problem or it's not a problem at all? I am
thinking 'xerror's should be decreasing when 'cp' gets smaller. Also what
the 'xstd' really tells us? If the error bars for
2010 Sep 24
1
How to read this file into R.
Dear community,
I have one file named ca_boost_feature.txt,
Feature selection (Boosting:0.0025,5)!
H.2.C C.1.D C.3.R E.0.N C.2.S C.0.G H.3.G
log file: ep
If I want to use the second line of this file, how to read it into R?
varr<-read.table("/home/cdu/operon/carbonic/ca_boost_feature.txt", sep=" ",
skip=1, header=F, strip.white=TRUE, nrows=1)
Warning message:
In
2010 Jun 02
1
how to label the som notes by the majority vote
HI, Dear R community,
I am using the following codes to do the som. I tried to label the notes by
the majority vote. either through mapping or prediction.
I attached my output, the left one dont have any labels in the note, the
right one has more than one label in each note. I need to have only one
label for each note either by majority vote or prediction.
Can anyone give some suggestions or
2010 Apr 26
3
R.GBM package
HI, Dear Greg,
I AM A NEW to GBM package. Can boosting decision tree be implemented in
'gbm' package? Or 'gbm' can only be used for regression?
IF can, DO I need to combine the rpart and gbm command?
Thanks so much!
--
Sincerely,
Changbin
--
[[alternative HTML version deleted]]
2001 Sep 14
0
rpart or Postscript problem?
I've run into another postscript/rpart problem unrelated to the issues I've
mentioned in a previous query.
I'm using 1.3.1 on a Win2K box.
>plotcp(some.rpart.object)
draws a very nice plot on the windows graphic device. If I save this as a
postscript file, either by opening a postscript device before calling
plotcp, or by saving the graphics window as a postscript file, the
2001 Nov 14
3
rpart:plotcp doesn't allow ylim argument (PR#1171)
Full_Name: Gregory R. Warnes
Version: R 1.3.1
OS: Solaris 2.8
Submission from: (NULL) (192.77.198.200)
rpart library version 3.1-2
Error message:
> plotcp(fit.thirds.1,ylim=c(0.7,1.5));
Error in plot.default(ns, xerror, axes = FALSE, xlab = "cp", ylab = "X-val
Relative Error", :
formal argument "ylim" matched by multiple actual arguments
>
This can be
2012 Feb 17
1
Different cp values in rpart() using plotcp() and printcp()
hi,
I have a question regarding cp values in rpart(). When I use plotcp() I get
a figure with cp values on the x-axsis, but then I use printcp() the cp
values in that list are different from the values in the figure by
plotcp(). Does someone know why?
Silje
[[alternative HTML version deleted]]
2008 Dec 17
1
pruning trees using rpart
Hi,
I am using the packages tree and rpart to build a classification tree to
predict a 0/1 outcome. The package rpart has the advantage that the function
plotcp gives a visual representation of the cross-validation results with a
horizontal line indicating the 1 standard error rule, i.e. the
recommendation to select the most parsimonious model (the smallest tree)
whose error is not more than one
2010 Mar 24
0
how to solve error in precict( ) while using with rpart?
Hello,
I am working with rpart function but geting some error in prediction.
the same code works fine with iris dataset.
but applying other dataset it doesn't work.
sample code is given for reference.
> acc_model<-rpart(V1~V2+V3+V4+V5+V6+V7+V8, data=accEx.train)
> plotcp(acc_model)
>