Displaying 20 results from an estimated 8000 matches similar to: "extremely simple "for loop" question"
2006 Apr 03
2
head function
hi all
can anyone tell me what is head() function in r. what
is it's utility?
thanks in advance
---------------------------------
[[alternative HTML version deleted]]
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
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
2006 Apr 14
2
another very simple loop question
I have a dataset with 4 years of students, and normally I want to
estimate things using each individual year, so I have a for loop as
follows
for (i in 1:4){}
However, the only way I know how to calculate estimates using all four
years of data is to put the estimations outside of the loop. Is there
anyway to make a for loop that uses all four years at once, then uses
each individual year?
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
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?
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
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
2008 Aug 14
2
Simple (?) subset problem
I can't figure out the syntax I need to get subset to work. I'm trying
to split my dataframe into two parts. I'm sure this is a simple issue,
but I'm stumped. I either get all or none of the original "rows".
> XTTable <- xtabs( ~ direction_ , SurveyData)
> XTTable
direction_
EASTBOUND
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
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
2006 Apr 07
4
saving estimates from a for loop for later use
Thanks to the help of many on this list, I am now an R user and have
been able to write some functioning code to do matching estimation.
I have two for loops (i in 1:3, and j in 0:2). Within the loops, I
had been creating matrices of relevant estimation coefficents in order
to make lots of LaTeX tables.
Well, now I want to be able to combine the results of many different
estimations from within
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
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
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