search for: wangtong

Displaying 20 results from an estimated 34 matches for "wangtong".

2007 Jan 09
4
A question about R environment
Hi all, I created environment "mytoolbox" by : mytoolbox <- new.env(parent=baseenv()) Is there anyway I put it in the search path ? If you need some background : In a project, I often write some small functions, and load them into my workspace directly, so when I list the objects with ls(), it looks pretty messy. So I am wondering if it is possible to creat an
2006 Sep 27
2
How to pass expression as an argument
Hi, I am writing a function and need to pass a function expression as an argument, for instance, myfun <- function( express) { x<- c(1,2,3) y<-express } if I call the above function by myfun( x*2 ), I get 2 as the result, instead of 2,4,6 , could someone help me to fix this problem ? Furthermore, is that
2007 Jan 04
1
need help with debug package
Hi all, I met a problem while using the debug package, I have the following program: mainfun<- function(){ beta<-1 result<-subfun(beta+x) } subfun<-function(expr){ y <- eval(expr, envir=list(x=c(1,2)),enclos = parent.frame()) return(y) } I have no problem using this program without calling the debug
2007 Jan 14
1
Questions about paste and assign
Hi, I would like to assign a value to a member b of the list a in position 3, by calling: assign( target, 2.34, 3) My question is what the "target" should be. I tried target <- paste("a", $, "b") and something else, but haven't got the right answer yet. BTW, if I attached a list named
2007 Apr 01
1
Keep R packages in the R installation
Hi, I just got a quick question here, when I install a new version of R , is there an easy to keep the installed R packages ? Thanks a lot for any help. tong
2007 Dec 27
1
Efficiency of for-loop in R
Hi, I just realized that in Matlab, as long as memory is pre-allocated, doing for-loop doesn't cost more time than doing things in vector form. But it seems in R, it still cost a lot to do for-loop. Is there any improvement in R that I missed. Thanks a lot. Merry Xmas Everyone !
2006 Mar 17
1
How to change the label in plot.ts ?
Hi you guys: I have been wondering if there is any way to change the labeling in plot.ts( ), for example , if I plot two sequences, i always got y labels as "series1", "series2", I tried to use ylab=c((expression(mu_1)),(expression(mu_2))), but it doesn't work. thanks in advance for any help best.
2006 Oct 28
1
A quesiton on data manipulation
Hi, I have a data set (data frame) describing some features of the students in a high school in the following format: Stu ID Year feature 1 feature 2 ............. 1001 1990 1001 1991 1001 1992 1002 1990 1002 1991 1002 1992 Some features of a few of these students are missing, I would like to
2007 Feb 02
2
A question about dput
Hi, I am trying to output a R data set for use in WinBugs, I used dput(list(x=rnorm(100),N=100),file="bug.dat") But I can't get the intended format: list(x=c(.......),N=100), instead, I got something like this (copied the first two lines): [00000000]???73?74?72?75??63?74?75?72??65?28?6C?69??73?74?28?78???? structure(list(x
2005 Jun 28
2
How to import data as numeric array?
Did some search but couldn't find useful result. I am trying to read a n*m dimension data with read.table, what i need is a numeric array, is there any efficient way to allow me get this array directly instead of a list? I tried to use as.array() to change the mode, but seems it doesn't work and i got this error message: "Error in "dimnames<-.data.frame"(`*tmp*`,
2007 Apr 02
2
Compiling C codes in Windows
Hi All, I have been struggling to figure out how to compile c codes for R use. I am using Win XP + Cygwin + R binaries. After I followed all the instructions in " Building R for Windows" from Murdoch's website, I tried to Run something like : R CMD SHLIB C:\R\test.c , but still didn't get any output. My first question is, does this mean I already did
2007 Apr 02
2
Compiling C codes in Windows
Hi All, I have been struggling to figure out how to compile c codes for R use. I am using Win XP + Cygwin + R binaries. After I followed all the instructions in " Building R for Windows" from Murdoch's website, I tried to Run something like : R CMD SHLIB C:\R\test.c , but still didn't get any output. My first question is, does this mean I already did
2006 May 10
1
identify high dimension data point
Hi there, I am having some trouble with the Identify() function, it looks that the identify() function only works on the plot of 2-dimension data set. In high-dimension case , if I use pairs() + identify() in hope to observe all the components of the data point I selected, I get error message. Is there anyway to get around this ? Plus, I also need it to actually compare all the
2006 Sep 05
1
Quick question about lm()
Hi, Feel awkward to ask , but really couldn't find a answer anywhere, How could I extract the R^2 and t-stat. from the result of lm()? Thanks a lot. best
2006 Sep 05
1
A question about gc()
Hi everyone, I am doing some intensive computation: 50000 regressions of the form Y~X with each y of size (1,1000) , even if I break invoke gc() for a few time in the loop, it still breaks down at some point with the error message: Error in .signalSimpleWarning("Reached total allocation of 1024Mb: see help(memory.size)", : recursive default argument reference After
2006 Sep 11
0
Question about do.call()
Hi, I'm writing a function f() which includes probability density function computation, I would like to make this generic, that is , I will specify the density when I call f(), here's what I wrote: do.call(den, args=list(d, arg)) the question is , say, if I let den=dnorm, I have to replace arg with mean=??, sd=??, etc. but I tried arg=c(mean=..,sd=..) and
2006 Sep 19
1
Need help with dataset formation problem
Hi, I have a data set , say, X : [1] [2] mean 0 .8 sd 1 3 I need to use it in do.call() , so when I refer to the first col of X, I need it to be a list with members mean, sd. thus I constructed X as a list of list : X[[1]]<- list(mean=0, sd=1),
2006 Sep 21
1
How to generating diagnal blocks ?
Hi, I am trying to creat a matrix with diagnal blocks, say, I have a matrix X of any dimension (nxm) ,and would like to have: X X X
2006 Sep 23
1
strange warning message
Hi Everyone, I recently start to get this warning message, while loading files in to R. Could someone tell me what does it mean ? I am using R 2.3.0 with Emacs on WinXP. use of NULL environment is deprecated Thanks a lot for any help best
2007 Jan 26
1
Question about the xgobi package
Hi, When I tried an example of the xgobi function, I got the following error. Could someone explain to me what is wrong ? Thanks a lot. xgobi(crabs,colors=c("SkyBlue","SlateBlue","Orange","Red")[rep(1:4,each=50)]) c:/PROGRA~1/R/R-23~1.1/library/xgobi/scripts/xgobi.bat -vtitle 'crabs' -std mmx