similar to: Column names of a data frame

Displaying 20 results from an estimated 2000 matches similar to: "Column names of a data frame"

2005 Jun 28
1
Using data frames for EDA: Insert, Change name, delete columns? (Newcomer's question)
I am finding complex analyses easier than some elementary operations in R. In particular I want to do some low level exploratory data analyses with data in a data frame but cannot find commands to easily insert, remove (delete), rename, and re-order (arbitrarily, not sort) columns. I see that the micEcon package has an insertCol command, but that is for matrices, not data frames. I have looked
2013 Feb 03
1
Adding complex new columns to data frame depending on existing column
Hello I have a data frame as below V1 V2 V3 V4 V5 V6 chr1 18884 C CAAAA 2 0 chr1 135419 TATACA T 2 0 chr1 332045 T TTG 0 2 chr1 453838 T TAC 2 0 chr1 567652 T TG 1 0 chr1 602541 TTTA T 2 0 on which I want to perform complex rearrangement such that: if V3 is a string >1 (i.e line 2) then I
2016 Apr 23
2
Data Frame Column Name Attribute
I am attempting to add a calculated column to a data frame. Basically, adding a column called "newcol2" which are the stock closing prices from 1 day to the next. The one little hang up is the name of the column. There seems to be an additional data column name included in the attributes (dimnames?). So when i run HEAD(DATAFRAMENAME) i get the column name = "Open". but
2011 May 03
6
Simple loop
Hello everybody, I am beginning with loops and functions and would be glad to have help in the following question: If i have a dataframe like this Site Prof H 1 1 24 1 1 16 1 1 67 1 2 23 1 2 56 1 2 45 2 1 67 2 1 46 And I would like to create a new column that subtracts the minimum of H from H, but for S1 and P1 only
2002 Jan 18
2
length of dimnames???
Hi: I have made a lot of progress reading and manipulating large data files, thanks to the help of several of you. I am now stuck with writing the final file with the following error (see also the full transcript below): Error in as.matrix.data.frame(x) : length of dimnames[2] not equal to array extent I do not know what it means and could not find how to get around that in the manual nor
2011 Apr 05
2
Help to check data before putting it in a database
The example scene: I have a database with stats about each goal made by my soccer team. This database (a data frame in R) is organized in lines (goals) with a set of columns containing data about these goals (player name, tactic position, etc). For now, this database will be called "data.frame1". What I need is to feed this "data.frame1" with new information about my team
2005 Aug 12
2
coercing created variables into a new data frame using na.omit()
Hi, I am an R newbie and one thing I am having trouble with binding variables that I have created within one data frame into a new data frame when using na.omit(). To illustrate this problem I will give the example I am working on and the approah I have been using:- data.frame1<-filepath.... attach(data.frame1) #create a new variable using a function new.variable<-rep(1,length(weight3))
2007 Aug 14
2
Question about unicode characters in tcltk
hello list, Can someone help me figure out why the following code doesn't work? I'm trying to but both Greek letters and subscripts into a tcltk menu. The code creates all the mu's, and the 1 and 2 subscripts, but it won't create the 0. Is there a certain set of characters that R won't recognize the unicode for? Or am I input the \u2080 incorrectly? library(tcltk) m
2000 Apr 27
1
Equivalent of S> assign( , ,frame=1)
Hi, I'm new to R, and I certainly miss an obvious point. I looked in the doc and the archieve, but could not find what is the R equivalent of the S assign( , ,frame=1). I guess the question is like what is the equivalent of the S frames and how to access them. As an example: oneprog <- function() { initial() res <- subrout() return(res) } initial <- function() { assign
2012 Jan 14
3
add column with values found in another data frame
I am positive this problem has a very simple solution, but I have been unable to find it, so I am asking for your help. I need to know how to look something up in one data frame and add it as a column in another. If I have a data frame that looks like this: > frame1 ID score test age 1 Guy1 10 1 20 2 Guy1 13 2 20 3 Guy2 9 1 33 4 Guy2 11 2 33 and another frame that looks like this:
2008 May 26
1
To draw observation [m, n] from 20 data frames named frame1, ... , frame20
Hi all, I have 20 data frames, named frame1, ... , frame20. Each data frame has the dimension 20x5. I need to build a function that calls out the observation in Row 1, Col 2 from all 20 data frames and places it in a vector of length 20. I have tried the following code: vect <- rep(0,20) for(i in 1:20){ vect[i] <- paste("frame",i,"[1,2]",sep="") } The
2010 Jan 20
1
Merge and join data
Hi, I'm looking to combine two data frames. Several of the columns are in common while the others need to be summed up. The apply functions and the merge functions don't seem to be working. I've included a basic example of what I'm trying to do below. Thanks! Sean data.frame1<-as.data.frame(matrix(c('winter','dredge','515',100,150),1,5))
2011 Nov 10
1
grid.pack and grid.frame bewilder me
Hello R friends, I get quite confused in using the grid graphic function grid.pack( ) and grid.frame ( ). Here is a simple example: library(grid) grid.frame(name="frame1") grid.pack("frame1",rectGrob(width=unit(0.5,"npc"), height=unit(0.5,"npc"), gp=gpar(col="red"))) what I expect is a rectangle with half the default device's
2013 Feb 13
3
match in dependence of 2 columns
Hello, i want to match a column of one data.frame to another, my problem is, that i only want to match the data, if 2 columns are equal. i have a example: data.frame1 cu.nr. name value A 1 Evo 100 B 1 Mer 80 C 2 Ford
2006 Mar 16
3
Did I use "step" function correctly? (Is R's step() function reliable?)
Hi all, I put up an exhaustive model to use R's "step" function: ------------------------ mygam=gam(col1 ~ 1 + col2 + col3 + col4 + col2 ^ 2 + col3 ^ 2 + col4 ^ 2 + col2 ^ 3 + col3 ^ 3 + col4 ^ 3 + s(col2, 1) + s(col3, 1) + s(col4, 1) + s(col2, 2) + s(col3, 2) + s(col4, 2) + s(col2, 3) + s(col3, 3) + s(col4, 3) + s(col2, 4) + s(col3, 4) + s(col4, 4) + s(col2, 5) + s(col3,
2003 Jun 08
1
Need help on data frame
Dear Sir/Madam, I am new in R.I have data corresponding to every day. Problem is that there are some gap i.e. observation couldn't be done on some particular day. I want to place this data frame like exact data frame (every year it will change, Feb 28 or feb29) Maybe I need to make one coulmn of date (for each year, say this dataframe 'frame1'), then I need to place data set on
2018 Feb 25
3
include
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 <NA> <NA> 5 W1 <NA> <NA> 6 Z1 K1 K2 7 Z2 <NA> <NA> 8 Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos],
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1
2018 Feb 25
2
include
Sorry , I hit the send key accidentally here is my complete message. Thank you Jim and all, I got it. I have one more question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2