similar to: Deleting multiple variables

Displaying 20 results from an estimated 1000 matches similar to: "Deleting multiple variables"

2008 Jun 20
2
Problems with basic loop
I'm having trouble creating a looping variable and i can't see wher ethe problem arises from any hep gratfully appreciated First create a table x<-table(SURVEY$n_0,exposed) > x exposed False True Under 16 24 1 16-19 68 9 20-24 190 37 25-34 555 204 35-44 330 87 45-54 198 65 55-64 67 35 65+
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello! I am aggregating using a formula in aggregate - of the type: aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata) However, I actually have an object (vector of my variables to be aggregated): myvars<-c("var1","var2","var3") I'd like my aggregate formula (its "cbind" part) to be able to use my "myvars" object. Is it
2008 Jun 06
2
Merging two dataframes
Hi All, Newbie question for you all but i have been looking at the archieves and the help dtuff to get a rough idea of what i want to do I would like to merge two dataframes together based on a keyed variable in one dataframe linking to the other dataframe. Only some of the cases will match but i would like to keep the others as well. My dataframes have 67 and 28 cases respectively and i would
2012 Jul 21
4
rhsape2 bug?
All, I believe I am running the latest version of rshape2 (1.2.1). But this code: library(reshape2) tmp <- melt(smiths, id.vars=1:2, measure.vars=c("age","weight","height"), variable.name="myvars", value.name="myvals" ) names(tmp) Produces this output: > names(tmp) [1] "subject" "time"
2009 Sep 15
2
Viewing Function Code
Hi All, I'd like to see the function code behind the barplots2() function in the gplots package, however i come across a bit of a stumbling block of a hidden function, can anyone help? > library(gplots) > methods(barplot2) [1] barplot2.default* Non-visible functions are asterisked > barplot2 function (height, ...) UseMethod("barplot2") <environment:
2008 Jun 17
2
Calling functions
Another newbie question. I've written a function and saved the file as Xtabs.R, in a central place on a network so others will be able ot use the function, My question is how do i call this function? I've tried to chance the working directory, and tried to load it via; > library(Xtabs, lib.loc="//filer/common/technical/surveys/R_test") but neither seem to work? the function
2011 Aug 04
2
Efficient way of creating a shifted (lagged) variable?
Hello! I have a data set: set.seed(123) y<-data.frame(week=seq(as.Date("2010-01-03"), as.Date("2011-01-31"),by="week")) y$var1<-c(1,2,3,round(rnorm(54),1)) y$var2<-c(10,20,30,round(rnorm(54),1)) # All I need is to create lagged variables for var1 and var2. I looked around a bit and found several ways of doing it. They all seem quite complicated - while in
2008 Dec 05
1
Loop swith String replacement
Hi All, I'm trying to split my dataset, into multiple datasets that i'll analyse later, i wanted to do this dynamically as i might need to rerun the code later. I was looking at doing this via a loop, (Are other methods more appropriate? Would a function be better?) However i'm not sure in R how do do string replacement within the loop in order to create unique dataset names based on
2009 Aug 25
1
Help with nls and error messages singular gradient
Hi All, I'm trying to run nls on the data from the study by Marske (Biochemical Oxygen Demand Interpretation Using Sum of Squares Surface. M.S. thesis, University of Wisconsin, Madison, 1967) and was reported in Bates and Watts (1988). Data is as follows, (stored as mydata) time bod 1 1 0.47 2 2 0.74 3 3 1.17 4 4 1.42 5 5 1.60 6 7 1.84 7 9 2.19 8 11 2.17 I then
2008 Dec 31
3
Paste in a FOR loop
Hi All, I've been having a little trouble using R2HTML and a loop, but can't figure out where the problem lies, any hints gratefully received. My code at the minute, (Which does work) is in the following: library(R2HTML) HTMLStart(outdir = file.path("C://Example_work","R_projects","Dynamic_creative"),filename = "RMDC_mockup",Title="Mock up for
2008 Aug 05
2
Selecting Variables
Hi All, i have a dataset that i want to dynamically inspect for the number of variables that start with "Exposure_" and then for these count the entries across each case i.e ID Exposure_1 Exposure_2 Exposure_3 1 y y y 2 y y - 3 y - - So the corresponding new variables
2012 Jun 27
1
Error: figure margins too large
Hello, I am running cluster analysis, and am attempting to create a graph of my clusters. I keep on getting an error that says that my figure margins are too large. d <- file.choose() d <- read.csv(d,header=TRUE) mydataS <- scale(d, center = TRUE, scale=TRUE) #Converts mydataS from a matrix to a data frame mydataS2 <- as.data.frame(mydataS) #removes "coden"
2011 Oct 19
1
Subsetting data by eliminating redundant variables
Dear All, I am new to R, I have one question which might be easy. I have a large data with more than 250 variable, i am reducing number of variables by redun function as in the example below, n <- 100 x1 <- runif(n) x2 <- runif(n) x3 <- x1 + x2 + runif(n)/10 x4 <- x1 + x2 + x3 + runif(n)/10 x5 <- factor(sample(c('a','b','c'),n,replace=TRUE)) x6 <-
2012 Aug 01
1
optim() for ordered logit model with parallel regression assumption
Dear R listers, I am learning the MLE utility optim() in R to program ordered logit models just as an exercise. See below I have three independent variables, x1, x2, and x3. Y is coded as ordinal from 1 to 4. Y is not yet a factor variable here. The ordered logit model satisfies the parallel regression assumption. The following codes can run through, but results were totally different from what I
2012 Mar 19
2
Reshape from long to wide
Hi, I'm a total beginner in R and this question is probably very simple but I've spent hours reading about it and can't find the answer. I'm trying to reshape a data table from long to wide format. I've tried reshape() and cast() but I get error messages every time and I can't figure why. In my data, I have the length of two fish from each family. My data table (called
2011 Dec 12
1
Package/command for creating a table of panel models ?
Hello Everyone (Quick) question: Does anyone know a package/command or simply a way of creating a table of different panel data estimations (estimated using /*plm()*/ ) just as *mtable()* does for models estimated with /*lm()*/? It seems *mtable* (and *apsrtable* equally) only support /*lm*/ and some other classes but unfortunately not /*plm*/. I am pretty sure others must have encountered this
2003 May 20
1
surprising behaviour of "bgroup": sets all in greek letters
Dear R user community I wanted to use "bgroup" for plotting a math formula with a big "{" on the left, and nothing on the right. i used text( 10, 10, pos=4, cex=1.8, expression(F(x) == bgroup("{", x, "")), ...) on a 40 x 20 plot. surprisingly, bgroup sets "Phi(xi) = { xi" i.e. replaces alphabetic characters with greek letters in the entire
2007 May 09
1
How to read several text files at once!
Dear R users, I am a beginner in R. I have 506 text files (data frame) in one folder namely DATA. The files are called A1 to A253 (253 files) and B1 to B253 (another 253 files). Each file has two columns; V1 (row number) and V2 (the value for each row name). Now I would like to add the values of V2 in each A-file with its relative value in B-file and save it as a new data frame named as C (e.g. C1
2008 Oct 13
2
Timestamps and manipulations
Hi All, I've a couple of questions i've been struggling with using the time features, can anyone help? sample data Timestamp user_id 27/05/08 22:57 763830873067 27/05/08 23:00 763830873067 27/05/08 23:01 763830873067 27/05/08 23:01 763830873067 05/06/08 11:34 763830873067 29/05/08 23:08 765253440317 29/05/08 23:06 765253440317 29/05/08 22:52 765253440317
2009 Oct 12
1
List mappings and variable creation
Hi All, I have a questions about associative list mappings in R, and if they are possible? I have data in the form show below, and want to make a new 'bucket' variable called combined. Which is the sum of the control and the exposed metric values This combined variable is a many to many matching as values only appear in the file if they have a value > 0. conversion.type filteredID