Displaying 20 results from an estimated 6000 matches similar to: "Multiple Conditional Tranformations"
2006 Dec 15
1
Switching labels on a factor
Hi All,
I'm perplexed by the way the unclass function displays a factor whose
labels have been swapped with the relevel function. I realize it won't
affect any results and that the relevel did nothing useful in this
particular case. I'm just doing it to learn ways to manipulate factors.
The display of unclass leaves me feeling that the relevel had failed.
I've checked three books
2006 Dec 18
1
Applying variable labels across a data frame
Hi All,
I'm working on a class example that demonstrates one way to deal with
factors and their labels. I create a function called myLabeler and apply
it with lapply. It works on the whole data frame when I subscript it as
in lapply( myQFvars[ ,myQFnames ], myLabeler ) but does not work if I
leave the [] subscripts off. I would appreciate it if anyone could tell
me why. The program below
2009 Jul 11
3
Reading data entered within an R program
Dear R-helpers,
I know of two ways to reading data within an R program, using
textConnection and stdin (demo program below). I've Googled about and
looked in several books for comparisons of the two approaches but
haven't found anything. Are there any particular advantages or
disadvantages to these two approaches? If you were teaching R beginners,
which would you present?
Thanks,
Bob
2006 Dec 28
2
Aggregation using list with Hmisc summarize function
Hi All,
I'm using the Hmisc summarize function and used list instead of llist to
provide the by variables. It generated an error message. Is this a bug,
or do I misunderstand how Hmisc works with lists? The program below
demonstrates the error message.
Thanks,
Bob
x<-1:8
group <- c(1,1,1,1,2,2,2,2)
gender<- c(1,2,1,2,1,2,1,2)
mydata<-data.frame(x,group,gender)
2010 Jul 28
1
specifying an unbalanced mixed-effects model for anova
hi all - i'm having trouble using lme to specify a mixed effects
model.
i'm pretty sure this is quite easy for the experienced anova-er, which
i unfortunately am not.
i have a data frame with the following columns:
col 1 : "Score1" (this is a continuous numeric measure between 0 and
1)
col 2 : "Score2" (another continuous numeric measure, this time
bounded between 0
2010 Oct 20
1
Adding Legend about two quantile lines at ggplot
Hi, all.
I'd like to add legend on my graph but I can't. My code is follows.
library(ggplot2)
score1<-rnorm(100,0,5)
score2<-rnorm(400,10,15)
mydata<-data.frame(score1,score2)
ggplot(mydata,aes(y=score2,x=score1))+geom_point()+stat_quantile(quantiles=c(0.50),col="red")+stat_quantile(quantiles=c(0.90),col="blue",size=2)
I like to add legend indicating the
2010 Aug 04
4
Passing the name of a variable to a function
Dear colleagues,
I have a problem which has bitten me occasionally. I often need to
prepare graphs for many variables in a data set, but seldom for all.
or for any large number of sequential or sequentially named variables.
Often I need several graphs for different subsets of the dataset
for a given variable. I run into similar problems with other needs
besides graphing.
What I would like to
2008 Apr 04
2
NA vs. <NA>
Dear R-Helpers,
Why does R show character missing values in vectors as NA and when
stored in a data frame as <NA>? I've searched but did not find an
explanation.
Thanks,
Bob
> gender <- c("f","f","f",NA,"m","m","m","m")
> gender
[1] "f" "f" "f" NA "m" "m"
2008 Feb 12
3
How many R packages?
Hi All,
I searched around to find the number of R packages currently available,
but didn't find anything, so I choose all repositories & told it to
install. The list contained about 2,856 (correcting roughly for those
installed). But the list includes repetitions such as 19 names that
begin with "bvbovine".
Selecting only CRAN and CRAN(extras) I get 1,344.
Is there an easier
2010 Apr 16
4
score counts in an aggregate function
Dear R-Users,
I have a big data set "mydata" with repeated observation and some missing
values. It looks like the format below:
userid sex item score1 score2
1 0 1 1 1
1 0 2 0 1
1 0 3 NA 1
1 0 4 1 0
2 1 1 0 1
2 1 2 NA 1
2 1 3 1
2010 Feb 25
2
Restructure some data
Suppose I have a data frame like "dat" below. For some context, this is the format that represents student's taking a computer adaptive test. first.item is the first item that student was administered and then score.1 is the student's response to that item and so forth.
item.pool <- paste("item", 1:10, sep = "")
set.seed(54321)
dat <- data.frame(id =
2009 Apr 07
2
newbie query: simple crosstabs
I've been playing around with various table tools, trying to construct a
fairly simple cross-tab. It shouldn't be hard, but for some reason it
turning out to be (for me).
If I want to see how many men and how many women agree with a agree/disagree
question (coded 1,0), I can do this:
>attach(mydata)
>mytable <- table(male, q1.bin) # gender and a binary response variable
2008 Mar 08
5
Non-visible functions are asterisked
Dear R-Helpers,
I suspect I'm about to ask a FAQ, but I haven't been able to find an
answer in the FAQ, AItR or an R Site Search. When I look at the methods
of summary (below) it says, "Non-visible functions are asterisked". I
looked at the help file for summary.princomp, which did not comment on
it being non-visible. I ran its help file example, which printed visible
output. I
2009 Feb 12
2
SAS Institute Adding Support for R
Hi Folks,
SAS Institute is adding official support for R:
http://support.sas.com/rnd/app/studio/Rinterface2.html
Cheers,
Bob
=========================================================
Bob Muenchen (pronounced Min'-chen),
Manager, Research Computing Support
U of TN Office of Information Technology
Stokely Management Center, Suite 200
916 Volunteer Blvd., Knoxville, TN
2010 Apr 26
1
Help with replacement of certain values in dataset with SAS code equivalent
I am new to R and have tried for a good while to figure out how to code this
in R. The dataset below:
FTIStandKey
State
County
FTITract
CoverType
Ver_CT
V_Origin
V_SpGrp
NAH6005-001
Texas
Jasper
NAH6005
PPLB-2000-U
PPLB-2000-U
P
P
NAH6005-002
Texas
Jasper
NAH6005
NHHX-1950-O
NHHX-1950-I
N
H
NAH6253-001
Texas
Tyler
NAH6253
PPLB-2001-U
PPLB-2001-U
P
P
2009 Jan 23
2
The Quality & Accuracy of R
Hi All,
We have all had to face skeptical colleagues asking if software made by
volunteers could match the quality and accuracy of commercially written
software. Thanks to the prompting of a recent R-help thread, I read, "R:
Regulatory Compliance and Validation Issues, A Guidance Document for the
Use of R in Regulated Clinical Trial Environments
(http://www.r-project.org/doc/R-FDA.pdf).
2008 Mar 10
1
When to quote a package name
Dear HelpeRs,
I'm confused about the role of quotes around package names on the
library and detach functions. Books on R use both approaches:
library(Hmisc)
describe(mydata)
detach(package:Hmisc)
and
library("Hmisc")
describe(mydata)
detach("package:Hmisc")
The help file for detach says "quoted or unquoted" and the help file for
library says about the
2007 Apr 09
3
do.call vs. lapply for lists
Hi All,
I'm trying to understand the difference between do.call and lapply for
applying a function to a list. Below is one of the variations of
programs (by Marc Schwartz) discussed here recently to select the first
and last n observations per group.
I've looked in several books, the R FAQ and searched the archives, but I
can't find enough to figure out why lapply doesn't do what
2007 Feb 10
1
JGR data editor question
Hi All,
I'm learning JGR 1.4-15 with R 2.4.1 in Windows XP (all patches
applied). JGR looks great but I'm having trouble getting the data editor
to save my results. I don't see anything in R-help about it. Here are
the steps I followed:
1. I chose "Tools>Object Browser" & double-clicked on a data frame,
"mydata".
2. A spreadsheet editor popped up and
2007 Sep 09
1
stacking data frames with different variables
Hi All,
If I need to stack two data frames, I can use rbind, but it requires
that all variables exist in both sets. I can make that happen, but other
stat packages would figure out where the differences were, add the
missing variables to each, set their values to missing and stack them.
Is there a more automatic way to do that in R?
Below is an example program.
Thanks,
Bob
# Top data frame has