Displaying 20 results from an estimated 1000 matches similar to: "Grouping data via an index"
2007 Sep 13
1
Collapsing data frame; aggregate() or better function?
Hello r-help,
I am trying to collapse or aggregate 'some' of a data frame. A very
simplified version of my data frame looks like:
> tester
trip set num sex lfs1 lfs2
1 313 15 5 M 2 3
2 313 15 3 F 1 2
3 313 17 1 M 0 1
4 313 17 2 F 1 1
5 313 17 1 U 1 0
And I want to omit sex from the picture and just get an addition of num,
2007 May 29
1
Partially reading a file (particularly)
Hello,
I am trying to figure out if there exists some R command that allows one
to be
particularly selective when reading a file. I'm dealing with large
fixed-width data
sets that look like
539001..
639001..
639001..
...
539002..
639002..
...
Presently, I am using read.fwf to read an entire file, but I am
interested only in
reading those records beginning with 5. I have been unable to
2007 Jun 14
1
Using subset() in a user-defined function
Hello,
I'm having a problem with using subset() inside a function I'm writing.
Ignoring everything else in the function, the problem can be illustrated
by (where master.frame is the data frame I'm using):
function1 <- function(arg1="", arg2="", arg3=""){
temp.frame <- subset(master.frame, a == arg1 & b == arg2 & c ==
arg3)
}
This
2009 Oct 08
2
lattice: passing multiple lty values to the key/legend
hi all,
It's not clear to me how (or if) I can pass multiple values for lty to a key in xyplot?
I've tried: lines=list(lty=1:3), to no avail.
Do I need to use something other than auto.key?
(Deepayan, if you're out there, I have your book and must admit the answer isn't jumping out at me.)
thanks in advance!
Michael Folkes
example code:
#____________________________
2005 Nov 02
1
x/y coordinates of dendrogram branches
Dear R-users,
I need some help concerning the plotting of dendrograms for hierarchical
agglomerative clustering.
The agglomeration niveau of each step should be displayed at the
branches of the dendrogram.
For this I need the x/y coordinates of the branch-agglomerations of the
dendrogram.
The y-values are known (the heights of the agglomeration), but how can I
get the x-values?
> mydata
2009 Nov 08
3
Obtaining midpoints of class intervals produced by cut and table
Hello list:
I am using "cut" and "table" to obtain a frequency table from a numeric sample vector. The idea is to calculate mean and standard deviation on grouped data. However, I can't extract the midpoints of the class intervals, which seem to be strings treated as factors. How do i extract the midpoint?
Thanks,
jose loreto
[[alternative HTML version deleted]]
2011 Apr 04
2
RODBC excel - need to preserve (or extract) numeric column names
I'm using RODBC to read an excel file (not mine!). But I'm struggling to find a way to preserve the column names that have a numeric value. sqlFetch() drops the value and calls them f1, f2, f3,... (ie field number). this is a different approach from read.csv, which will append "V" prior to the numeric column name. sqlFetch isn't so helpful.
Is there a way to get the
2007 Mar 20
2
Problem adjusting x-labels with bargraphCI
Hello:
I'm having quite a bit of difficulty adjusting the x-labels using bargraphCI. I've tried using text and srt=45 to rotate the labels or mtext for 2 lines to break up the labels. However, using either method, I cannot line up the labels with the midpoints of the bars (they line up with some sort of tick mark that is off the midpoint of the bars). Any suggestions would be greatly
2013 Sep 09
1
Hmisc binconf function value interpretation during narrow confidence intervals
Hello all,
I've been using binconf (package Hmisc) at a range of alpha values and
noticed that using the 'Wilson' method when alpha is larger (i.e. narrow
CI), results in the upper value being smaller than the lower value. The
'exact' and 'asymptotic' methods give results in the realm I'd expect.
But the help file suggests:
"Following Agresti and Coull, the
2011 Mar 04
4
Floating points and floor() ?
Perhaps somebody could clarify for me if the following is a floating
point matter or otherwise, and how am I to correct for it?
> floor(100*.1)
[1] 10
> 100*(1.0-.9)
[1] 10
> floor(100*(1-0.9))
[1] 9
Thanks!
Michael
_______________________________________________________
Michael Folkes
Salmon Stock Assessment
Canadian Dept. of Fisheries & Oceans
Pacific Biological Station
2004 Jun 15
2
S/R/RWeb/ODBC
I'm looking for an optimal approach to access Oracle databases via RWeb
applications. I'm new to R but familiar with programming functions and web
pages for the S+ Statserver. I'm now going through the motions of migrating
S+/Statserver applications to R/RWeb as a feasability exercise. I can access
databases using ODBC directly in R or S, and using Statserver, but I have
not succeeded
2011 Aug 17
3
Convert week value to date
Hello all,
I'm hoping to convert a decimal value for week of the year back to a date object.
Eg:
strptime(paste(2010,1:52,sep=" "),format="%Y %W")
I expected (hoped?) this would give me the date for Monday of each week. Instead, it's giving me 52 values of today's date.
Where am I erring?
Thanks
Michael
_______________________________________________________
2008 Oct 17
1
Use of .First() in Mac OS X gui
Hi,
I am having problems using .First() with the Mac OS X gui version of R 2.7.2
(under OS X 10.5.5); .First is ignored on startup. .First() does work in the
command-line version of R under Mac OS X but my specific task requires the
gui version. I can find no reference to this issue in the Mac OS X FAQ or in
other manuals, does anyone have a solution for this?
Thanks,
Ian
--
Ian Jonsen
2008 Oct 23
0
R CMD Rd2dvi (PR#13200)
Hello,
I can build packages with R-2.8.0 but I cannot run the code:
R CMD Rd2dvi --pdf --no-clean <pkg_name>
=20
Error message:
.: Can't open C:/Apps/R/R280/share/sh/dcf.sh: No such file or directory
The system cannot find the path specified.
=20
The above code works fine in R-2.7.2.
=20
Comparing the bash script Rd2dvi.sh between R-2.7.2 and R-2.8.0 makes me
think that the script is
2005 Jan 06
6
"labels" attached to variable names
Hi,
Can we attach a more descriptive "label" (I may use the wrong
terminology, which would explain why I found nothing on the FAQ) to
variable names, and later have an easy way to switch to these labels in
plots? I fear this is not possible and one must enter this by hand as
ylab and xlab when making plots.
Thanks in advance,
Denis Chabot
2011 Sep 24
2
maptools::sunriset() daylight savings to stardard time change
Hello all,
After beating my head against the wall for a few hours, I give up.
I have two problems.
1. If I use seq() to generate a POSIXct series that crosses a daylight savings to stardard time change I get two values for the first day of change. The time change is Nov 6,2011. The value for Nov 7 turns into 23:00 on Nov 6, thus two values for Nov 6. (see below)
So I put a time value (noon)
2007 Jul 10
2
Plot SpatialLinesDataFrame with xlim & ylim
I'm running windows xp, R 2.3.1 with maptools 0.6-6, I guess.
When plotting from a large SpatialLinesDataFrame and using xlim & ylim to reduce the area, the plot axes automatically have the same scale size, even if xlim and ylim ranges differ.
E.g.:
tmp <- readShapeLines(filepath)
plot(tmp,xlim=c(-126,-119),ylim=c(50,51))
The y-axis range is actually 47-54, same range as the x-axis.
2005 Jun 05
6
Player mysteriously quits...
I posted the other day with a question about a player that mysteriously quits playing the icecast stream. I believe the problem is related to the icecast stream for two reasons. 1) Because it quits on more than one different player (Winamp 5 and Foobar2000) and 2) Because I used to use shoutcast with Winamp 2 and never had this problem. Anyway, I tried to get as much information about the problem
2009 Aug 11
1
Passing a list object to lapply
Hello,
I'm having difficulty passing an object name to a lapply function. Can
somebody tell me the trick to make this work?
#Works
T13702 <- TRACKDATA[["13702.xls"]][["data"]]
min(unlist(lapply(list(T13702), function(x) mdy.date(x[1, 2], x[1, 1],
x[1, 3]))))
16553
#Works
d<-2
assign(paste("T",substr(names(TRACKDATA)[d],1,(nchar(names(TRACKDATA)[d]
2009 Oct 08
1
problem understanding factor levels for use lattice panel order
Hello all,
In order to get the desired order of panels within lattice I realized I needed to define my factor levels.
I now see how to properly do it (attached code), but:
1. I don't understand why I have to use factor() on a variable that is already a factor, and why levels() alone doesn't work to readjust the level order.
2. I just noticed that if I do use levels(xx$v1), it's