Displaying 20 results from an estimated 10000 matches similar to: "head function"
2006 Apr 12
2
extremely simple "for loop" question
I am sorry to ask such a simple question, but my knowledge of
programming language is extremely limited, and I couldn't find the
answer in any of the normal resources.
I want to do a for loop in which m takes on the values 1, 5, 10, 15,
20. What is the syntax for doing that?
I had been doing a loop for m in 1:20, but I only want those values above.
Thanks,
Brian
2006 Apr 03
4
argv[0] --- again
dear R group: I have the probably fairly common problem that I would
like to have one code.R file do different things if it is invoked from
a symbolic link, which should be easy to uncover.
$ ln -s code.R code-0.R
$ ln -s code.R code-1.R
$ R CMD BATCH code-1.R
what needs to be in code-1.R to put code-1.r into a character vector?
help appreciated.
regards, /ivo welch
PS : I read
2006 Apr 13
2
Plotting positions in qqnorm?
Do you know of a reference that discusses alternative choices for
plotting positions for a normal probability plot? The documentation for
qqnorm says it calls ppoints, which returns qnorm((1:m-a)/(m+1-2*a))
with "a" = ifelse(n<=10, 3/8, 1/2)? The help pages for qqnorm and
ppoints just refer to Becker, Chambers and Wilks (1988) The New S
Language (Wadsworth & Brooks/Cole),
2003 Apr 21
2
Anyone familiar with Cumulants or good reference books?
Hey, R-listers
I want to get some statistical books on Cumulants for
studying.
So will you please give me some suggestions on
these related books?
Thanks for your point.
Fred
2004 May 06
3
strptime
Delving into the murky world of dates and times I found this:
dates <- c("02/27/92", "02/27/92", "01/14/92", "02/28/92", "02/01/92")
> times <- c("23:03:20", "22:29:56", "01:03:30", "18:21:03", "16:56:26")
> x <- paste(dates, times)
> z <- strptime(x, "%m/%d/%y
2008 Sep 25
2
How to order some of my columns (not rows) alphabetically
Hello,
I have a dataframe with 9 columns, and I would like to sort (order) the
right-most eight of them alphabetiaclly, i.e.:
ID1 ID2 F G A B C E D
would become
ID1 ID2 A B C D E F G
Right now, I'm using this code:
attach(data)
data<-data.frame(ID1,ID2,data[,sort(colnames(data)[3:9])])
detach(data)
but that's not very elegant. Ideally I could specify which columns to
sort and
2003 Apr 21
4
help.start in R-1.7.0 with Netscape 7.0.
I'm experiencing a new and annoying phenomenon which seems to consist
of an unfortunate interaction between R-1.7.0 and netscape version 7.
When I invoke help.start(), a netscape window duly appears
with the browser pointed at the file .../R/doc/html/index.html
as one would hope and expect.
However if I then ask for help on a function, e.g.
> help(glm)
the help does NOT get displayed
2005 Oct 31
2
Help with try or tryCatch
I am having trouble with try and tryCatch.
I have read the documentation but I just don't get it.
Here is what I am trying to do. I am testing a function which has a number
of parameters. I want to test it for different values of the parameters
and I have some loops, in the middle of which is a test of the function.
Sometimes the routine fails and so I have put the bit that might fail
2005 Mar 11
5
sample function
Hi everyone, I need help.
I want to have a "uniform" kind distribution. When I used sample function I
got almost twice many zeros compared to other numbers. What's wrong with my
command ?
temp <-sample(0:12, 2000, replace=T,prob=(rep(1/13,13)))
hist(temp)
Thanks in advance,
Taka,
2008 Feb 11
4
R programming style
I am aware of one (unofficial) guide to style for R programming:
http://www1.maths.lth.se/help/R/RCC/
from Henrik Bengtsson.
Can anyone provide further pointers to good style?
Views on Bengtsson's ideas would interest me as well.
David Scott
_________________________________________________________________
David Scott Department of Statistics, Tamaki Campus
The University of Auckland,
2007 May 28
2
RODBC and Date/Time variables
This is really a query about MySQL which I am trying to use to set up a
database which I will then access with RODBC.
I have my data in a .csv file, and some of the fields are date/time
fields. I tried to create a table using mysql with the definition of the
date/time field given by
CallDate DATETIME,
but I got an error saying that the first row has
28/07/2006 0:00
in that field. What I
2005 May 31
2
POSIX problem
I am having trouble with creating a POSIXct object. If I create a variable
of class Date first out of the date part of my data, I am ok, but if I
just paste the date and time parts together and try and create the POSIXct
object, I have problems.
Here is a toy example created from the actual data which caused the
problem. I am using R 2.0.1 on Windows XP.
> # Data frame with dates and
2003 Apr 22
7
Subject: Eliminate repeated components from a vector
X-Mailer: VM 7.00 under 21.4 (patch 6) "Common Lisp" XEmacs Lucid
Reply-To: fjmolina at lbl.gov
FCC: /home/f/.xemacs/mail/sent
Does anyone know how I can eliminate repeated elements from a vector?
2007 Jun 11
1
Recoding
I want to do some recoding of variables: code Age into groups and recode a
factor into a smaller number of levels.
There are a couple of options for recode functions, in the car package and
in memisc, and I think in gmisc.
Does anyone have any opinions on the the easiest, most reliable approach
for these problems?
David Scott
_________________________________________________________________
2008 Jan 27
2
[OT] Open source archive program on windows
I am looking for a recommendation for an open source competitor to Winzip.
I seem to recall Brian Ripley mentioning one in the last year or so, but
couldn't find it in the mail archives. (Searching on Ripley there is
somehow not terribly useful.)
Suggestions?
David Scott
_________________________________________________________________
David Scott Department of Statistics, Tamaki Campus
2002 Jun 18
5
insert number in vector
Hello R-users,
I need to create a vector inserting an 1 after each value of another vector.
For example:
vec1<-c(2,3,4)
I need to create a vector with the values 2,1,3,1,4
Does anyone know how create this vector without loops (vec1 could have 1000
elements)
Thank you,
Juan
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2003 May 02
3
letters to numbers conversion
Hello List
How do I turn
R> simple.example.alphabetic
[,1] [,2] [,3]
[1,] "a" "b" "c"
[2,] "d" "e" "f"
[3,] "g" "h" "i"
into
R> simple.example.numeric
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
[ie "a" becomes 1, ..., "z"
2003 Feb 13
6
generic handling of NA and NaN and NULL
Hello everybody
I have a generic problem which the following toy function illustrates:
f <- function(n) {
if(abs(n) < pi) {
return(TRUE)
} else {
return(FALSE)
}
}
I want it to return TRUE if abs(n)<pi and FALSE otherwise. f() is
fine as far as it goes, but does not deal well with NA or NaN or NULL
(I want these to signal some problem with the
2008 Mar 20
2
Cygwin and Rtools
I have just got a new machine and had a basic cygwin installed before it
was given to me. It didn't include make. Previously I have installed
Rtools to build packages and now I have got myself a bit confused as to
whether to just install make from the cygwin packages or to install
rtools. I would welcome any advice. I had a look at the rtools section in
the Administration Manual and the
2002 Dec 12
2
width and length arguments to postscript()
Hi everyone
This must be a FAQ but I can't find it anywhere...
I want a postscript image of a contour() plot, with axes of equal
length. Try
R> postscript(file="~/f.ps")
R> contour(matrix(rnorm(100),10,10))
R> dev.off()
This isn't what I want: the plotting region is, as documented, quarter
of an inch shy of the paper edge and the axes appear to be different
lengths.