similar to: Obtaining variable's names from a list of variables

Displaying 20 results from an estimated 3000 matches similar to: "Obtaining variable's names from a list of variables"

2011 Aug 17
9
too many var in lm
Hello, It might be an easy question but if you have many variables to fit in the lm function, how do you take all without specifying var1+var2+...+var2100 in the terms parameter in response ~ terms? Cheers, Carol
2011 Nov 08
3
lapply to list of variables
Hi Can someone help me with this? How can I apply a function to a list of variables. something like this listvar=list("Monday","Tuesday","Wednesday") func=function(x){x[which(x<=10)]=NA} lapply(listvar, func) were Monday=[213,56,345,33,34,678,444] Tuesday=[213,56,345,33,34,678,444] ... in my case I have a neverending list of vectors. Thanks!
2011 Apr 27
2
ROCR for combination of markers
Dear list   I have 5 markers that can be used to detect an infection in combination. Could you please advise me how to use functions in ROCR/ other package to produce the ROC curve for a combination of markers?   I have used the following to get ROC statistics for each marker. pred <- prediction(y$marker1, y$infectn) perf <-performance(pred,"tpr","fpr")
2012 Aug 02
6
Polygon shaded area
Hi all, I have two vectors (columns) called "efinal" and "efinal 2". I want to plot them on the same plot and "draw" a shaded area beween the two lines using function polygon I have tried all but I don ?t understand the polygon area, can you help me with examples? plot(efinal,type="l",ylim=range(min(efinal2),
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to either make the plot blank or add text to a "blank sheet". I would like to "plot" a page that contains just text, no plot lines, labels, etc. Suggestions? Kevin [[alternative HTML version deleted]]
2011 Oct 10
3
How to test if two C statistics are significantly different?
Hey all, In order to test if a marker is a risk factor, I built two models (using cox proportional hazard model). One model included this marker, and the other is not. Then, I use R package risksetROC to test how much predictive value did the marker add to this model. I get two C statistics by analyzing the linear predictors of the two models into this package. The qustion is How to test if two
2011 Mar 14
7
creating character vector
Is there a way to convince R to create a character vector without using the quotes? This works ex1 <- c("first","second") but when I try this it doesn't ext <- as.character(c(first,second)) it complains. I have many variables to put into character vectors so dispensing with the quotes would be useful. Thanks Jim =============================== Dr. Jim Maas
2009 Aug 12
2
Superscripts in axis label
Hi All, I am trying to lable the y-axis on my scatterplot with the following: "Soil moisture content (m3m-3)" I am using the following coding for plotting the graph: plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab="Soil moisture content (m3m-3)", bty="l", font.main="2", pch=16, las=1, cex.lab="1.13") I have
2011 Jul 28
3
construct a data set
Hi, i want to construct a data set similar to "AirPassengers". Its attributes are following. > attributes(AirPassengers) $tsp [1] 1949.000 1960.917 12.000 $class [1] "ts" How Can I construct a data set similar to it having same class and attributes. Thanks -- Amar Kumar Nandan ?:nandan.amar at gmail.com http://aknandan.co.nr
2011 Aug 17
1
extract variables from model formula
Hi All, I am writing a function to predict values based on a model. It works fine as long as the formula just uses regular variable names. I am having a problem when the variables are wrapped with a function call. For example: m <- lm(mpg ~ factor(cyl), data = mtcars) ## I get the column names using as.character(attr(terms(m), "variables"))[-1L] ## which gives the same column
2012 Feb 21
2
Using substitute in nested function calls
Dear List members, I really, like the feature that one can call R functions with mathematical expressions, e.g. curve(x^2, 0, 1) I wonder, how I can construct in a simple way a function like mycurve = function (expr) {...} such that that a call mycurve(x^2) has the same effect as the call curve(x^2, -100,100) Below is some code that works, but it seems much to complicated: it first
2012 Jul 18
4
contour
Hello Everyone I have the data long format and I want to draw the contour plot with it x1 x2 x3 0 1 2 0 2 1 0 3 5 1 1 4 1 2 2 1 3 3 when I am using contour(x1,x2,x3,col=heat.colors) or fill.contour its giving me an error that increasing x and y expected So please tell me what is the right function to draw contour when the data is not ordered and you cant order
2011 Jul 29
2
Changing font type within y axis labels
I wish place the following axis label in such a manner that some of the text is plain and the scientific name is in italics (i.e. a mixture of two font types) Using plot: mtext("Total Landings of Pecten maximus (tonnes)",font,=3, side=2, line=3) makes everything italic, but how do I apply the font change to only "Pecten maximus"? Rgds Phil
2011 Sep 08
3
Can't load workspaces
I've seen a number of issues with the loading of workspaces discussed previously, but here's another one... I simply can't load any saved workspace at all... Here's an example, starting with an empty workspace and creating a single variable "a". > a<-1:5 > save.image("a.Rdata") > rm(a) > load("a.Rdata") Error in function ()  : unused
2011 Sep 19
3
Replace a for loop with a function
Hi all, I would like to replace the for loop in the code below with a function to improve the speed and to make the script more efficient. The loop creates a vector of integers (x) with the probability of f for each integer. The length of f is variable, but sums to 1. I tried to use a function with optional arguments which did not work. Here is the code: f <- data.matrix(c(0.5,0.15,0.35))
2011 Feb 09
3
Loop in variable names
Hello! I would like to do some tables for several variables and I would like to write a loop that does the table for each variable. I should also point out that my data set has several missing observations and sometimes the observations that are missing are not the same for all my variables. What I would like to do: table(StoreData$CompanyID, !is.na(StoreData$P2))
2010 Feb 04
1
how to plot single frames as a movie?
Dear users, 1. Is there a way to create a movie file to play a sequence of single frames (e.g. plots) at a specified time delay between frames? 2. If making a movie file is not possible, then how can I incorporate in a loop some delay between the frames to be plotted so I can change the playing speed? Sorry if this questions was already in the forum, but I couldn?t find it. Thanks in advance
2024 Feb 29
1
[EXT] Initializing vector and matrices
Hello Eik: Thanks. I do not need to sample. Essentially, I have a do loop which produces 24 vectors of length of some length (say k=300) and 24 matrices of 300x300. Then, I simply need to? take the averages of these 24 vectors and matrices: x=(x1+x2+...+x24)/k y=(y1+y2+...+y24)/k I am just looking for ways to do this in a do loop, which requires initialization (to 0's) of x and y. My
2011 Aug 17
2
question regarding gregexpr and read.table
Hi, I have a silly question regarding the usage of two commands: read.table and gregexpr: For read.table, if I read a matrix and set header = T, I found that all the dash ("-") becomes dots (".") A = read.table("Matrix.txt", sep = "\t", header = F) A[1,1] # "A-B-C-D". A = read.table("Matrix.txt", sep = "\t", header = T)
2011 Aug 15
5
Labelling all variables at once (using Hmisc label)
I have a dataset and a list of labels. I simply want to apply the labels to the variables, all at once. The only way I was able to do it was using a loop:     for (i in 1:length(data))  label(data[,i]) <- data.labels[i] I'd like to find the non-loop way to do it, using apply or the like... Any help appreciated. [[alternative HTML version deleted]]