similar to: Finding the position of a variable in a data.frame

Displaying 20 results from an estimated 10000 matches similar to: "Finding the position of a variable in a data.frame"

2006 Jul 31
2
if function and apply
Runninn R.2.3.1 Windows XP I have a dataset just imported from SPSS. It has any number of 99's as missing data and it looks like the next dataset will have custom missing codes. I have abouat 120 variables and an N of 2000. "I think" thatI would like to apply a function to the data.frame (or to a matrix of the data if needed) to recode all the 99's to NA. I thought that I
2008 Jul 31
4
Identifying common prefixes from a vector of words, and delete those prefixes
For example, c("dog.is.an.animal", "cat.is.an.animal", "rat.is.an.animal"). How can I identify the common prefix is ".is.an.animal" and delete it to give c("dog", "cat", "rat") ? Thanks _________________________________________________________________ [[alternative HTML version deleted]]
2011 Aug 03
1
Coefficient names when using lm() with contrasts
Dear R Users, Am using lm() with contrasts as below. If I skip the contrasts() statement, I get the coefficient names to be > names(results$coef) [1] "(Intercept)" "VarAcat" "VarArat" "VarB" which are much more meaningful than ones based on integers. Can anyone tell me how to get R to keep the coefficient names based on the factor levels
2008 Feb 26
2
Combining series of variables using identifier
R users, I have df like this a <- data.frame( indx = 1:20, var1 = rep(c("I20", "I40", "A50", "B60"), each=5), var1_lab= rep(c("cat", "dog", "mouse", "horse"), each=5), var2 = rep(c("B20", "X40", "D50",
2007 Mar 04
1
Scoping issue?
Hello, The code below is supposed to be a wrapper for matplot to do columnwise visible comparison of several matrices, but I'm doing something wrong because I can't access an argument called 'colnum'. I'd be most grateful for some insight. Thanks, John Thaden Little Rock, AR ################################ # mmatplot is a matplot wrapper to compare the same column of #
2006 Aug 08
3
Pairwise n for large correlation tables?
Hello, I'm using a very large data set (n > 100,000 for 7 columns), for which I'm pretty happy dealing with pairwise-deleted correlations to populate my correlation table. E.g., a <- cor(cbind(col1, col2, col3),use="pairwise.complete.obs") ...however, I am interested in the number of cases used to compute each cell of the correlation table. I am unable to find such a
2006 Jul 04
1
[Fwd: formatting using the write statement]
>I have a series of write statements because >i am writing to a file >where the characters strings are the column names of a dataframe >and the numbers are the elements in a particular row. >So, a file might look like > >AAA 2.1 >BB 3.1 >AHLZ 0.2 > >and it would be named "rowname".mls. > >so, each time i get to a new row, i create a new file and
2007 Jun 06
2
lookup in CSV recipe
I await Luke''s node settings implementation with interest. At the moment however, I have this sort of ugliness: $site = $hostname ? { fred => "opsera", barney => "bedrock", default => "unknown site", ... } So I''ve knocked up this little function to use CSV files instead. Now I can just do: $site =
2011 May 18
4
Loop stopping after 1 iteration
Hi all, This is a very basic question, but I just can't figure out why R is handling a loop I'm writing the way it is. Here is the script I have written: grid_2_series<-function(gage_handle,data_type,filename) series_name<-paste(gage_handle,data_type,sep="_") data_grid<-read.table(file=paste(filename,".txt",sep=""))
2009 Feb 25
1
Using gregexpr with multiple search elements
Dear list, I am trying to use gregexpr to see if entries in a dataframe have either of two possible values for a string. here's an example text<-c("fat", "rat", "cat", "dog", "log", "fish") If I just wanted to find if any one of the elements in text match the pattern "at" I would do gregexpr("\\at", text)
2009 Mar 29
2
Burt table from word frequency list
Dear all, I have a word frequency list from a corpus (say, in .csv), where the first column is a word and the second is the occurrence frequency of that word in the corpus. Is it possible to obtain a Burt table (a table crossing all words with each other, i.e., where rows and columns are the words) from that frequency list with R? I'm exploring the "ca" package but I'm
2007 Sep 13
2
Multivariate, multilevel regression?
Dear WizaRds, This is mostly a statistics question, but I'm figuring that R is the right solution (even before I start!) I have some bio data of heart rate versus time (rats taken from resting to maximal heart rate). I want to regress heart rate on time. The data have been normalized such that resting heart rate is zero at time=0, so that all curves intersect at the origin (and at the origin
2009 Jan 22
2
"latex" in Hmisc: cell formating
Hi list, Could you explain the error I see here? Thanks! ## I'm using R 2.8.0 on WinXP, Hmisc_3.4-3 > table1 <- matrix(10, 180,7) > cell.format <- matrix("", ncol=7, nrow=180) > cell.format[c(seq(3,180,6),seq(4,180,6)),] <- "color{red}" > cell.format[c(seq(5,180,6),seq(6,180,6)),] <- "color{green}" > > latex(table1,
2011 Apr 04
1
moving mean and moving variance functions
Hello Lets say as an example I have a dataframe with the following attributes: rownum(1:405), colnum(1:287), year(2000:2009), daily(rownum x colnum x year) and foragePotential (0:1, by 0.01). The data is actually stored in a netcdf file and I'm trying to provide a conceptual version of the data. Ok. I need to calculate a moving mean and a moving variance for each cell on the following
2007 Jul 19
3
help with heatmap - how to remove annoying "X" before numeric values?
Hello All, I have a simple question based on how things are labeled on my heat map; particularly, there is this annoying "X" that appears before the numeric value of all the labels of my columns. Let's say I have the following silly data, stored in "temp.txt" 1905 1910 1950 1992 2011 2020 Gnat 0.08 0.29 0.29 0.37 0.39 0.43 Snake
2010 Nov 28
3
Where is gdata?
Hi folks, Win 7 64 bit R 32 bit > install.packages("gregmisc") Installing package(s) into ‘C:\Users\satimiswin764\Documents/R/win-library/2.12’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- also installing the dependency ‘gmodels’ trying URL 'http://cran.ms.unimelb.edu.au/bin/windows/contrib/2.12/gmodels_2.15.0.zip' Content type
2010 May 13
1
ggplot2: qplot won't work
I have a script running in the StatET Eclipse environment that executes the ggplot2 command qplot in a function: # Creates the plot createPlot <- function(){ print("Lets plot!") qplot(1:10, letters[1:10]) } When executing the qplot line directly, it works. When executing the script it does not open a window and it it does not plot. Is there something important I have forgotten? I
2007 Nov 17
2
Rename Variable and package gdata
Dear R-helpers, I hope someone can help me with the following problem: I derived a variable from many others and produced data.frame: toktempo When I look at the variable name I get: names(toktempo) [1] "otok.V5" But I want the variable name to be Tempo so I googled around to find info about renaming variables. I found a webpage which seemed to indicate to me that there was a
2010 Apr 24
4
assign value between different type: Double vs Integer
Dear list, just to put it in a simple way: i read.csv from csv file to create a gdata then, create array gdata34 however, when making a loop for assigning gdata34[1,m]<-gdata[m,4], this is what happen gdata[1,4] 's real value is 10354, however, the gdata34[1,4] turns to be 883 then i checked the type: gdata[1,4] is integer, while gdata34[1,4] is double. Can any one give me some help
2018 Apr 12
2
Turn off replication
On Wed, Apr 11, 2018 at 7:38 PM, Jose Sanchez <josesanc at carc.unm.edu> wrote: > Hi Karthik > > Looking at the information you have provided me, I would like to make sure > that I?m running the right commands. > > 1. gluster volume heal scratch info > If the count is non zero, trigger the heal and wait for heal info count to become zero. > 2. gluster volume