similar to: Passing the name of a variable to a function

Displaying 20 results from an estimated 10000 matches similar to: "Passing the name of a variable to a function"

2011 Nov 19
1
Advice on recoding a variable depending on another which contains NAs
Dear colleagues, I would be very grateful for your help with the following. I have banged my head off this question several times in the past, and repeatedly over the last week. I have looked in the usual places and found no obvious solution. I fear that this just means I didn't recognize it, but I'd be very grateful for your help. I am scoring 8000 psychometric tests - the SCQ, if
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
2006 Nov 25
3
Multiple Conditional Tranformations
Greetings, I'm learning R and I'm stuck on a basic concept: how to specify a logical condition once and then perform multiple transformations under that condition. The program below is simplified to demonstrate the goal. Its results are exactly what I want, but I would like to check the logical state of gender only once and create both (or any number of) scores at once.
2005 Oct 14
1
Predicting classification error from rpart
Hi, I think I'm missing something very obvious, but I am missing it, so I would be very grateful for help. I'm using rpart to analyse data on skull base morphology, essentially predicting sex from one or several skull base measurements. The sex of the people whose skulls are being studied is known, and lives as a factor (M,F) in the data. I want to get back predictions of gender, and
2006 Jul 18
1
Classification error rate increased by bagging - any ideas?
Hi, I'm analysing some anthropometric data on fifty odd skull bases. We know the gender of each skull, and we are trying to develop a predictor to identify the sex of unknown skulls. Rpart with cross-validation produces two models - one of which predicts gender for Males well, and Females poorly, and the other does the opposite (Females well, and Males poorly). In both cases the error
2011 Jan 05
3
Advice on obscuring unique IDs in R
Dear colleagues, This may be a question with a really obvious answer, but I can't find it. I have access to a large file with real medical record identifiers (mixed strings of characters and numbers) in it. These represent medical events for many thousands of people. It's important to be able to link events for the same people. It's much more important that the real record numbers
2010 Jan 20
3
Mutliple sets of data in one dataset....Need a loop?
Hi I'm hoping someone can help me I am a relative newbie to R. I have data that is in a similar format to this... Experiment Score1 Score2 X -0.85 -0.02 X -1.21 -0.02 X 1.05 0.09 Y -1.12 -0.07 Y -0.27 -0.07 Y -0.93 -0.08 Z 1.1 -0.03 Z 2.4 0.09 Z -1.0 0.09 Now I can easily have a look at the overall correlation of score 1 and 2 by doing this plot(data[,2], data[,3]) or fit <-
2007 Feb 16
1
SPSS and library(foreign)
Hi, I have a valid SPSS .sav file (which I can open happily in SPSS v11 on Windows XP). Opening it in R2.41 on Linux we get this message :- > HSE3023 <- read.spss("HSE.sav") Error in read.spss("HSE.sav") : error reading system-file header In addition: Warning message: HSE.sav: Variable X234 indicates variable label of invalid length 256 Now variable X234 has indeed a
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
2007 Feb 09
1
Using variable names in for loops - Generating plots semi-automatically from a series of variables Partly solved
Hi, This code is trying to produce a series of graphics files, with plots of male and female disease rates by age, one plot per disease. The dataframe contains a variable 'Age' and a set of variables called 'Male_CVD, Female_CVD,Male_RTA,Female_RTA, and so on. For each disease, I want to pull out the column of data containing the word 'Male' and plot this against age, and then
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 =
2002 Feb 04
2
Help with accessing elements of a list
Hi, As part of the analysis of a longitudinal study, I have a list, called wg, on R 1.3.1 for windows created as follows - wg <- by(xx, xx$mrn, function(xx) lm(xx$maternal.wt ~ xx$gestation, data=xx)) xx is a data.frame, and so wg contains the results of 293 linear regressions, as lm objects. Now what I want is to extract the 293 intercepts and regression coefficients as a vector, and
2003 Nov 20
3
Problem with Trellis graphics in nlme
Hi, I would be grateful for help with a problem which is irritating me. I am quite sure that I am doing something stupid, but I can't see what it is. I am running R 1.7 on Windows 2000. The graphics device is the PC screen. The graphics from the nlme demonstration in Bates an Pinheiro's manual work just as advertised. The CO2 data and the Orthodont data dsiplay
2012 Mar 10
0
Help with confidence intervals for gam model using mgcv
Hi, I would be very grateful for advice on getting confidence intervals for the ordinary (non smoothed) parameter estimates from a gam. Motivation I am studying hospital outcomes in a large data set. The outcomes of interest to me are all binary variables. The one in the example here, Dead30d, is death within 30 days of admission. Sexf is gender (M or F), Age is age in years at the start
2010 Jan 26
1
Maptools runs out of memory installing the help files for spCbind-methods
Hi, I'd be grateful for help with the following:- Running R version 2.9.2 (2009-08-24) on Gentoo Linux, on an x86 PC. I am trying to install maptools, (via CRAN from maptools_0.7-29.tar.gz'), for the first time. All runs smoothly until the installation gets to "*** installing help indices" for spCbind-methods, about two thirds of the way through the help files, at which point
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
2010 Apr 26
1
help with code
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 Oct 02
1
[LLVMdev] alias analysis and functions
Hi, I am trying to use alias analysis (Anderson) and noticed that for pointers to functions I don't get the expected result: a pointer that clearly may point to a function is reported as NoAlias. I use -anders-aa -aa-eval -print-no-aliases -print-may-aliases -print-must-aliases Here is a test case: ///////////////try_calls_aliases.c #include <stdio.h> typedef int (*PF)(); PF
2010 Aug 13
1
Installing rJava fails on Gentoo (amd64) with Sun JDK - checking JNI data types... error
Installing rJava fails consistently, whether installed via the command line as below, or through "install.packages( 'rJava' )", and whether 0.84 or 0.85 is used, with the message :- "checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to