search for: columnname

Displaying 20 results from an estimated 57 matches for "columnname".

Did you mean: column_name
2007 Apr 22
1
names( d$columnname )
dear R wizards --- would it make sense for names(d$columnname) to be "columnname"? I can preserve the columnname through x=subset(dataset, select="columnname"), of course, but it would seem that x=d$columnname could also do this. No? Sincerely, /iaw
2011 Jul 27
1
Referencing a column using a function argument
...rly straight forward. Any help at all from more experienced users is appreciated! I'd like to write a function that uses a column name as an argument. However, I run into problems when I try to reference this column within the function. For example, findCutoff <- function(tableName, columnName) { temporaryTable <- subset(tableName, select = c(V1, V4, columnName)) x <- length(tableName$columnName [tableName$columnName > 6] ) ...etc. } I know a couple of ways to reference a column: 1. tableName$columnName 2....
2009 Jun 25
2
variable driven summary of one column
Hello, how can I get a variable driven summary of one column of my data.frame? Usually I would do > summary(data$columnname) to get a summary of column named "columnname" of my data.frame named "data". In my case the columnname is not static but can be set dynamically. So I save the chosen columname in something like variable <- "columnname" but how can I now get the summary of the sp...
2010 Jul 26
4
using string variable as order() function argument
...d like this: sorted = mytable**[order(column3) , ] which results in properly sorted table: ** id col1 col2 col3 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 1 10 0 4 8 **But when trying to use a string variable instead of "column3" name: columnname = "column3" **sorted = mytable**[order(columnname) , ]** this command is not properly evaluated and the effect is somewhat strange. Would you suggest some solution? Thanks a lot! Mirek
2012 Jan 13
2
question: how to select a column from a dataframe in a function
Hi, I am creating a function and ran into the problem of selecting a column from a dataset. It seems as though the $ function (as in data$columnname) does not apply in the function. In simplified version: This works: testf2<-function(data,columnnumber){print(data[,columnnumber])} But this doesn't: testf<-function(data,column){print(data$column)} Even though the first solution works, I would like to be able to insert the columnname...
2012 Aug 07
2
What is this called? lapply(datum,"[[","ColumnName")
Hello R users I recently learned how to use this command: lapply(datum,"[[","ColumnName") Unfortunately, I don't know how exactly it works, what it's called (in particular the "[[" part], and what other things you can do with it (retrieve multiple columns?). Given datum is a list of dataframes with the same column, but different number of rows, lapply(...
2008 Jun 17
2
Reshape or Stack? (To produce output as columns)
Dear all, I have used 'read.table' to create a data frame of 720 columns and 360 rows (and assigned this to 'Jan'). The row and column names are numeric: > columnnames <- sprintf("%.2f", seq(from = -179.75, to = 179.75, length = 720)). > rnames <- sprintf("%.2f", seq(from = -89.75, to = 89.75, length = 360)) > colnames(Jan) <- columnnames > rownames(Jan) <- rnames A sample of the data looks like this: > head(Jan)...
2006 Jul 03
1
difficult data manipulation question
...ew matrix 2) whenever the column name is not unique, take the one that has the most non zero elements ? ( in the case of ties, i don't care which one is picked ). so, in this case, the resulting matrix would just be the first 4 columns. i realize ( or atleast i think ) that sum( TEMP[(TEMP[,columnname] !=0) ,columnname) will give me the number of non elements in a column with the name columnmame but how to use this deal with the non uniqueness to solve my particular problem is beyond me. plus, i think the command will bomb because columnname will not always be unique ? Thanks for any help. I re...
2012 Feb 17
5
How to change the order of columns in a data frame?
....926 10730.647 27053.421 I am trying to first change the first column name to something without an X and save as a vector. I would then remove the X from each position use the vector for renaming the columns. Then the column 2-n could be ordered, I hope... colnames(pos)[1] <- "Mass" columnNames <- colnames(pos) Does any of you have an idea how to do this, or perhaps there is a smoother solution? Would it be easier to solve it if the contents of the first column were extracted and used as row names instead? Best regards, Joel [[alternative HTML version deleted]]
2008 Jun 14
1
Correcting the display of colnames and rownames
...(but without the '.'). I have tried numerous attempts at addressing this. I'm currently as far as adopting the following approach; I'll show what I've done for just the column headings - I've adopted the same approach for row headings, with the same results/problem so far. columnnames <- seq(from = -179.75, to = 179.75, length = 720) as.numeric <- colnames(Jan) colnames(Jan) <- make.names(columnnames) N.B. 'Jan' (as in January) refers to the data frame in question. So my thinking here is to assign the values to be used as column labels to 'columnnames'...
2008 Jul 15
3
Melt (reshape) question
...correspond to my real Longitude values. I've had a good look through the script and tried tweaking a few things, but with no luck. I've pasted the code below, so that you can see what I've done, and maybe you someone spot a fundamental error of mine, or something that I'm missing. columnnames <- sprintf("%.2f", seq(from = -179.75, to = 179.75, length = 720)) rnames <- sprintf("%.2f", seq(from = 89.75, to = -89.75, length = 360)) read.table("gpw_pop_density_hd_1995a.asc", colClasses = "numeric", na = "-99") -> PopDens colname...
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an auto-serialized column ("serialize :columnName"). Thing is, MySQL, depending on how it''s configured (like, by default), has a bad habit of just truncating your data if it''s too wide for the column, with no error raised. Yeah, I can probably reconfigure MySQL and/or my AR connection to it. But I''m wanting to dist...
2013 Apr 30
2
R Function to extract columnNames
Hi, May be this helps: funcName<- function(df1, x){ ?whatCol=df1[[x]] ?print("Got it") ?print(whatCol) ?} ? funcName(df,"ColA") #[1] "Got it" #[1] 1 2 3 4 5 ? funcName(df,"ColB") #[1] "Got it" #[1] A B C D E #Levels: A B C D E A.K. >I am trying to extract the 2nd column from a dataframe using a function called funcName. Note this is an
2006 Aug 17
2
how to check if the value is repeated?
hi! as the subject says, :P how can i check if a value is already in a table?? ty!! -- Posted via http://www.ruby-forum.com/.
2012 Dec 11
5
Renaming column names according to another dataframe
...e got a dataframe having a code as column name. Addtionally I have another dataframe with a two columns (and lots of rows), the first containing the code and the second some Text (real name). Now I'd like to use the information (pairs of code and name) of the second dataframe to rename all the columnnames in the first dataframe. How is it possible to achieve that? Here a small example of the two dataframes: df <- data.frame(A=(1:10),B=(1:10),C=(1:10)) df_names <- data.frame(code=c("A","B","C","D","E"),name=c("Col A","Col B&quo...
2010 Apr 13
2
transpose but different
...9 10 12 NA NA 12 3 7 8 9 10 11 NA NA What I have been trying so far is reshape, but this doesn???t put the id???s of the groupmembers of different groups under the same columnname. It makes new columnnames per group. Couls somebody help me out with this? I really appreciate it Regards, Naomi Duijvesteijn Disclaimer: De informatie opgenomen in dit bericht (en bijlagen) kan vertrouwelijk zijn en is uitsluitend bestemd voor de geadresseerde...
2007 Jun 22
1
speed issues / pros & cons: dataframe vs. matrix
...ve read that certain operations performed on a matrix (e.g. ribind, cbind) are often much faster compared to operations performed on a data frame. Other then the "bind functions", what are the main operations that are significantly faster on a a matrix? I know that data frames allow for columnnames and rownames, and that each column in a data frame can have different data types. Are there any other advantages of storing data in a a dataframe rather then a matrix? --------------------------------- [[alternative HTML version deleted]]
2011 Dec 02
2
order function give back row name
Hello, I have a matrix results with dimension 1x9 double matrix XLB XLE XLF XLI 1 53.3089 55.77923 37.64458 83.08646 I'm trying to order this matrix > print(order(results)) [1] 3 1 2 4 how can the function order return the columnname XLF XLB XLE XLI instead of 3 1 2 4 any idea ? Thank you in advance --
2012 Mar 15
1
Accessing variable's name as an attribute?
...want to make use of loops where possible to build groupedData objects from each of the relevant columns along the lines of: sfa <- na.omit(read.csv("SFAFinalData.csv", header = TRUE)) factorsList <- colnames(sfa) noFactors <- length(factorsList) for (i in seq(4,noFactors)) { columnName <- factorsList[i] dataset <- groupedData(sfa[,columnName] ~ TIME|ID, data=sfa, labels = list("Weeks post injury", columnName)) } Of course at present this simply results in sequential overwriting of dataset with the latest groupedData object. What I want to do with each iterati...
2010 May 07
3
Find the three best values in every row
Hello, i have a dataframe with the GDP for different Country (in the columns) and Years (in the rows). Now i want for every year the best three values, if possible with name of the countries (columnnames). For the best it's no problem but for the other two values. Thanks, Alfred