search for: centroin

Displaying 20 results from an estimated 72 matches for "centroin".

Did you mean: centroid
2006 Oct 07
3
ifelse(logical, function1, function2) does not work
Why this kind of assignment does not work? n <- 1 f <- ifelse(n == 1, sin, cos) f(pi) this must be rewritten as: n <- 1 f <- cos if (n == 1) f <- sin f(pi) [oops. 1.224606e-16 instead of zero. Damn floating point errors :-/] Alberto Monteiro
2008 Oct 02
4
Load a program at the front end
I want to run a R program, prog.R, interactively. My question is, is there a way I can start prog.R on the shell terminal when invoking R, instead of using source() inside R? TIA, Gang
2007 Jul 05
4
Me again, about the horrible documentation of tcltk
How on Earth can I know what are the arguments of any of the functions of the tcl/tk package? I tried hard to find, using all search engines available, looking deep into keywords of R, python's tkinter and tcl/tk, but nowhere I found anything remotely similar to a help. For example, what are the possible arguments to tkgetOpenFile? I know that this works: library(tcltk) filename <-
2008 Aug 18
2
A doubt about "lm" and the meaning of its summary
I have a conceptual problem (sort of). Maybe there's a simple solution, maybe not. First, let me explain the test case that goes ok. Let x be a (fixed) n-dimensional vector. I simulate a lot of linear models, y = m x + c + error, then I do a lot of regressions. As expected, the estimated values of m (let's call them m.bar) are distributed according to a Student's t distribution.
2008 Apr 29
4
XML write?
Is there any function to write a XML structure, after it was read using xmlTreeParse? Ex: library(XML) x <- xmlTreeParse("Irpf2008/aplicacao/dados/12345678901/12345678901.xml") # write it... Alberto Monteiro PS: please, brazilians, don't be offended by my foul language!
2007 Sep 17
3
Histogram with colors
Is there a simple way to plot a histogram with colors? For example, suppose I generate random points in the N(2,1) distribution: x <- rnorm(100000, mean = 2, sd = 1) Now I would like to plot the histogram: hist(x) but I would like to show the bars with x < 0 in red, and the bars with x >= 0 in lightgreen. Is there any simple way to do it? I think I can do it in two steps:
2008 Apr 18
3
Function redefinition - not urgent, but I am curious
This is just my curiousity working. Suppose I write: f1 <- function(x) x + 1 f2 <- function(x) 2 * f1(x) f2(10) # 22 f1 <- function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we "freeze" the definition of f1? f1 <- function(x) x + 1 f2 <- function(x) # put something here 2 * f1(x) # probably put something else here
2009 Oct 01
5
How to use Subpopulation data?
Dear Helpers   I have a sample frame and i have sampled from it using three methods and now i want to calculate the statistics but i only get the population parameters.   H <- matrix(rnorm(100, mean=50000, sd=5000)) sampleframe=data.frame(type=c(rep("H",100)),value=c(H)) sampleframe   str=strata(sampleframe,c("type"),size=c(20,), method="srswor")
2006 Oct 05
5
[Fwd: Re: Block comments in R?]
Ooops! Sorry, I send it only to Uwe Ligges the first time. Best, Philippe Grosjean This is perhaps another solution, more elegant in the way the block comment is written... but it requires to redefine `!` and slows it a little bit because it tests first its arguments before calling .Primitive(!): It takes advantage of `!` being not defined for character arguments: > !2 [1] FALSE >
2007 Apr 18
10
importing excel-file
Dear R-experts, It is a quite stupid question but please help me. I am very confuced. I am able to import normal txt ant mat-files to R but unable to import .xls-file I do not understand the online help. Can please anyone send me the corresponding command lines? The .xls-file is attached. In my file we use commas for the decimal format (example: 0,712), changes might be needed. Thanks, Corinna
2007 Mar 23
5
Get "home" directory and simple I/O
Is there any generic function that gets the "home" directory? This should return /home/<user> in Linux and x:/Documents and Settings/<user> (or whatever) in Windows XP. Another (unrelated) question: what is the _simplest_ way to read and write R variables to/from files such that they are stored in a human-readable but R-like form? For example, if (say), x is a vector
2004 Jan 14
1
NLS mensagem error...
Hi R-masters, I have a problem with nls() and my research data. Look this example: X2000<-c(1.205268,2.850695,5.100860,8.571610,15.324513,25.468599,39.623418,61.798856,91.470006,175.152509) age<-c(37,42,47,52,57,62,67,72,77,82) fit <- nls(X2000~R*exp(A*age),start=list(R=.1,A=.1)) Error mensage: Error in nls(X2000 ~ R * exp(A * age), start = list(R = 0.1, A = 0.1)) :
2005 Mar 12
1
Database reorganization
Hi people, I need reorganization several databases. I would like to know if that is possible in R. My problem is like that: original data base: Age x1980 x1981 1 5 8 3 7 9 5 9 15 7 11 20 future data base year age x 1980 1 5 1980 3 7 1980 5 9 1980 7 11 1981 1 8 1981 3 9 1981 5
2006 Sep 24
2
plotCI
Hi R masters! I need a Help with plot confidence intervals for one equation. I use library gplots and plotCI command in this script: require(gplots) ano <-1980:2002 rf<-exp(91.37162-0.04720281*ano) ciw.f<-sqrt(1.766073e-08) plotCI(ano,rf,uiw=ciw.f) But in the graph not shown the errors bar and I have this error msg zero-length arrow is of indeterminate angle and so skipped
2007 Mar 29
1
Wikibooks
As a big fan of Wikipedia, it's frustrating to see how little there is about R in the correlated project, the Wikibooks: http://en.wikibooks.org/wiki/R_Programming Alberto Monteiro
2007 Nov 19
2
biplot
Hi, I am wondering how to draw biplot with the same scales on both plots? For example, if the two plots have much different scales, generally the two x-y's are scaled so that the two plots are sitting in the center automatically. How to disable this? Thanks -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..."
2008 Mar 06
1
write in rimage package
Is there any way to write an imagematrix generated by the rimage package? Reproducible example: library(rimage) x <- read.jpeg(system.file("data", "cat.jpg", package="rimage")) png("newcat.png") plot(x) dev.off() The newcat.png image is different from the original file, because there are ugly white borders around it. Alberto Monteiro
2008 Mar 08
1
Change the index argument of a series
This is probably very trivial - so I can't find an answer in the help files. When I have a series x (x[1], x[2], ... x[n]) and I want to construct a new series y (y[1], y[2], ... y[m]) such that y's are either interpolations of the x's (when m > n) or a weighted mean (when m < n), is there any direct function to do it? For example, passing from 3 to 4 would be the same as
2008 Jun 06
2
Plot matrix as many lines
Suppose that I have a matrix like: m <- rbind(c(1,2,3,4), c(2,3,2,1)) Is there any way to efficiently plot the _lines_ as if I was doing: plot(m[1,], type="l") points(m[2,], type="l", col="red") (of course, in the "real world" there much more than just 2 lines and 4 columns...) Alberto Monteiro
2006 Sep 30
1
Simple graphics
Is there any way that I can do something like this: png("file.png", width=200, height=200) polygon(c(50, 50, 150, 150), c(50, 150, 150, 50)) dev.off() and then have a png file with a 100 x 100 pixels rectangle in the middle of it? It seems that when I call "plot", it redefines the image coordinates to some "optimized" value and then I lose any information to