search for: variable1

Displaying 20 results from an estimated 69 matches for "variable1".

Did you mean: variables
2010 Feb 26
3
Preserving lists in a function
...tion makes use of a lot of lists in its defaults. However, we discovered that R does not necessarily preserve the defaults if we were to input them in the form of list() when initializing the function. For example, if you feed the function codes below into R: myfunction=function( list1=list (variable1=1, variable2=2, variable3=3), list2=list (variable1="variable1", variable2="variable2", variable3="variable3"), list3=list (variable1="character", variable2=24,...
2012 Jan 02
4
Create variable with AND IF statement
Hello, I'm using SPSS at work but really would like to switch to R. Right now I'm trying to learn R in reproducing calculations I did with SPSS but am stuck with something that is quite simple and comprehensible in SPSS-Syntax: IF (variable1.fac = 0 AND variable2.num = 0) variable3=1. IF (variable1.fac = 0 AND variable2.num >= 1) variable3=2. IF (variable1.fac = 1 AND variable2.num = 0) variable3=3. IF (variable1.fac = 1 AND variable2.num >= 1) variable3=4. I want to create four different groups out of different conditions of tw...
2012 Feb 20
0
repeating or looping within an apply statement to handle multiple variables
Dear R experts, I would like to please ask for your help with repeating steps in an apply statement. I have a dataframe that lists multiple variables for a given id and visit, as well as drug treatment. > head(exp) id visit variable1 variable2 variable3 variable4 drug 1 3 1 13 10 7 11 0 2 3 5 10 15 9 9 0 3 3 12 9 10 8 8 0 4 7 1 12 8 9 8 1 5 7 5 16 9 3...
2009 Jul 30
3
What is the best method to produce means by categorical factors?
...pting to replicate some of my experience from SAS in R and assume there are best methods for using a combination of summary(), subset, and which() to produce a subset of mean values by categorical or ordinal factors. within sas I would write proc means mean data=dataset; class factor1 factor2 var variable1 variable2; RUN; producing an output with means for each variable by factor groupings as below: *factor1 factor2 obs variable mean* Level A treatmentA 3 variable1 10 variable2 22 treatment...
2010 Jan 30
2
drawing a line that shifts from solid to broken
I am graphing longitudinal data from three time points. I'd like to draw a solid line from point 1 to point 2, and then a dashed line from point 2 to point 3. It works if I do it in two steps: > first.vector <- c(mean(year1$variable1), mean(year2$variable1)) > second.vector <- c(NA, mean(year2$variable1), mean(year3$variable1)) > plot(first.vector, type="b", xlim=c(1,3)) > lines(second.vector, type="b", lty=2) It's clunky, though, and I have a bunch of these to do. Can I streamline it? TIA....
2006 Jul 03
1
analogue of group option of SAS MIXED/random in R
Dear list, I am trying to use lme to build the analogue of the following SAS MIXED random specification: random int+Variable1+Variable2 /subject = Subject group=Condition type=vc; which gives a Condition-blocked heterogeneity in the random effects variance-covariance matrix. Needless to say, I have a hard time in specifying Condition-specific heterogeneities in the variance-covariance parameters. I initially tried the...
2009 Mar 24
2
Calculating percentage Missing value for variables using one object
...able the data is entered over the months. I need to calculate the percentage of missing values for each variable over each month and then plot a graph for that. I am running the following code for doing the same *ds <- read.csv(file="filepath", header=TRUE) attach(ds) may <- length(variable1[variable1==""]) / length(dos[dos=="May-06"]) * 100 jun <- length(variable1[variable1==""]) / length(dos[dos=="June-06"]) * 100 . . . var1 <- c(may, jun, ...........) x <- seq(as.Date("2006-01-01"), as.Date("2007-03-31"), by="...
2012 Jul 05
4
Exclude missing values on only 1 variable
...red variables in my longitudinal dataset and lots of missings. In order to plot data I need to remove missings. If I do > data <- na.omit(data) that will reduce my dataset to 2% of its original size ;) So I only need to listwise delete missings on 3 variables (the ones I am plotting). data$variable1 <-na.omit(data$variable1) does not work. Thank you [[alternative HTML version deleted]]
2011 Apr 18
4
altering identity column
...bservations which are greater than or equal to 60,001 regarding the very first identity column. So I have a transformed dataframe now including 10,000 obeservations (from 60,001 - to 70,000) and if you send "head(transformed_dataframe)" into R it looks like this: variable1 variable2 variable3 variable4 ... 60 001 ... ... ... ... 60 002 ... ... ... ... 60 003 ......
2010 Feb 08
2
the hat ^ in regular expression
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible URL : <https://stat.ethz.ch/pipermail/r-help/attachments/20100208/52a6d080/attachment.pl>
2011 Apr 07
3
Correlation Matrix
...matrices. It is fairly straight forward to build a correlation matrix of an entire data frame. I simply use the command cor(MyDataFrame). However, what I would like to do is construct a smaller correlation matrix using just three of the variable out of my data set. When I run this: cor(MyDataFrame$variable1, MyDataFrame$variable2,MyDataFrame$variable3) I get an error. Is there a way to do this through a built in function or is this something I have to construct manually? Thanks [[alternative HTML version deleted]]
2012 Jul 18
3
Subsetting problem data
..., but now I need to look only at the problem data to reconfigure it. In my data set where there are multiple "cycles" per "patient," and I want to highlight the patients who have a variable was not measured every cycle. Here's a similar example of the data: Patient, Cycle, Variable1, Variable 2 A, 1, 4, 5 A, 2, 3, 3 A, 3, 4, NA B, 1, 6, 6 B, 2, NA, 6 C, 1, 6, 5 C, 3, 2, 2 So in this case, I would want Patient A and Patient B, but not Patient C. Thanks! [[alternative HTML version deleted]]
2009 Dec 04
2
Multiple Channel Variables with AMI Originate
Hi guys I seem to be having a problem, I don't know if it's a bug or whether I'm just doing it incorrectly. I want to set about 3 channel variables when I originate a call via AMI. All the documentation I have found says to do it like this: Variable: variable1=value|variable2=value|variable3=value However when I do this it runs them all together and I end up with: variable1 = "value|variable2=value|variable3=value" Instead of: variable1 = "value" variable2 = "value" variable3 = "value" So I...
2012 Jul 09
4
Skipping lines and incomplete rows
I have a text file that has semi-colon separated values. The table is nearly 10,000 by 585. The files looks as follows: ******************************************* First line: Skip this line Second line: skip this line Third line: skip this line variable1 Variable2 Variable3 Variable4 Unit1 Unit2 Unit3 10 0.1 0.01 0.001 20 0.2 0.02 0.002 30 0.3 0.03 0.003 40 0.4 0.04 0...
2008 Aug 07
4
Obtaining the first /or last record of a subject in a longitudinal study
Dear R users, I was wondering if anyone knows how to obtain(subset) the first and/or the last record of a subject in a longitudinal setup. Normally in SAS one uses first.variable1 and last.variable1. So my question is that is there an R way of doing this. Regards, -- Luwis Diya, Phd student (Biostatistics), Biostatistical Center, School Of Public Health, Catholic University of Leuven, U.Z. St Raphael, Kapucijnenvoer 35, B-3000 Leuven, Belgium, Cell: +32(0)497 22 94 83 Ph...
2006 Sep 24
2
printing a variable name in a for loop
Hello, How do you print a variable name in a for loop? I'm trying to construct a csv file that looks like this: Hello, variable1, value_of_variable1, World, Hello, variable2, value_of_variable2, World, Hello, variable3, value_of_variable3, World, Using this: for (variable in list(variable1, variable2, variable3)){ cat("Hello,", ???variable???, variable, ", World,") } This works fine if I'm...
2009 Jan 29
1
Multiple tables
Dear list, I have a set of 100+ variables. I would like to have one by one crosstables for each variable. I started with table(variable1, variable2) table(variable1, variable3) table(variable1, variable4) ... table(variable2, variable3) table(variable2, variable4) ... It seems rather tedious. Any better ideas around? Thanks for any help! Gerit -- NUR NOCH BIS 31.01.! GMX FreeDSL - Telefonanschluss + DSL f?r nur 16,37 EURO/mtl.!...
2010 Jan 02
2
xyplot: problems with column names & legend
Hello! one more question about xyplot. If I have data which have space in the column names, say "xyz 123". How do I create a working graph where this text is displayed in the legend key? Now when I try something like xyplot("xyz 123" ~ variable1, data = mydata, .......) I get nothing. Also, is it possible to genrate the graph with xyplot(mydata[,1] ~ variable1, data = mydata, .......) and then later in the code specify the names that should be displayed in the legend? Thank you!
2009 Dec 01
3
Using two (...) in a function
...("DAP", "ALT")) ###here it would came the first (...) Vec <- matrix(c(...)) for (i in seq(along <- Vec)){ caracteristica <- Vec[i] varF <- if (caracteristica == "DAP") var1 else var2 ##here I would like to do something like #if ###caracteristica == variable1) variance1 else if (caracteristica == variable2) variance2 else ... } } but to turn this in a function, I would like to replace ("DAP", "ALT") by any variable and var1, var2 to any variance, and not only necessary 2, for example data ("variable1","variable2"...
2010 Sep 01
8
how to replace NA with a specific score that is dependant on another indicator variable
...lots of if statements but I’m sure there most be a neater, better way of doing it. Any ideas at all will be much appreciated, I’m dreading coding up all those if statements!!!!! My problem is as follows: I have a data set with lots of missing data: EG Raw Data Set Category variable1 variable2 variable3 1 5 NA NA 1 NA 3 4 2 NA 7 NA etc Now I want to replace t...