similar to: Converting the columns of a data frame to numeric

Displaying 20 results from an estimated 50000 matches similar to: "Converting the columns of a data frame to numeric"

2002 May 28
2
problems with rcmd check
Hello, I have developed a R package. When I pass it through the rcmd check command (windows 98) to see if it is ok, everything works fine until there is a call to the program "sh.exe". It seems that rcmd calls it with the option --c, but it doesn't seem to be a legal option. After that, when rcmd tries to create a directory inside the "package_name.Rcheck" directory there
2002 Jun 19
4
drawing ellipses
Hello again, First I want to thank all the people who answered my question about line width in graphs. I promise I will learn the 'par' help page by heart for the end of the month ! I now want to trace some ellipses to emphasize groups of data. I found how to trace circles with 'symbols()', but no ellipse. I'm planning on writing my own function based on
2002 Jul 09
3
Assignment converts variable to factor
Hello, I would like to know if this behaviour in R is as expected. I have a data frame 'dat' with column var1 being character (and not factor). Then I create a new column 'var2' by: > dat[,"var2"] <- dat$var1; Column var2 is now a factor. But if I do: > dat$var2 <- dat$var1; Then column var2 is character (and not factor). I don't want to have
2012 Jan 10
1
Converting BY to a data.frame
Hello, I am trying to convert BY to a data frame, consider the following example: exampleDF<-data.frame(a=c(1,2),b=c(10,20),name=c("first","second")) exampleBY<-by(exampleDF,with(exampleDF,paste(a,b,sep="_")),               function(x) {                 data.frame(                     name=as.character(x$name),                     a=x$a,                    
2002 Jul 17
1
Output and history
> From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk] > > Daniel Mastropietro <mastropi at uwalumni.com> writes: > > > Hello, > > > > I have the following two questions, rergarding: > > > > (Output) > > 1) Is it possible to have the output of a command automatically > > displayed, without explicitly requesting it after the
2002 Oct 30
2
two small wishes for R
1. allows underscore as part of a variable name 2. Uses C or Java style comments mark. Jason ===== Jason G. Liao, Ph.D. Division of Biometrics University of Medicine and Dentistry of New Jersey 335 George Street, Suite 2200 New Brunswick, NJ 08903-2688 phone (732) 235-8611, fax (732) 235-9777 http://www.geocities.com/jg_liao __________________________________________________ HotJobs - Search
2008 Jan 03
2
retaining formatting when converting a vector to a matrix/data.frame?
Please see example code below. I have a vector ("mydata") of length 10. "mydata" can have various formats (e.g. numeric, text, POSIXct, etc) I use the matrix and data.frame functions to convert "mydata" to a dataframe ("mydf") of 2 columns and 5 rows. What is a "good" way to ensure that the format is retained when I create the
2006 May 05
1
converting code into a function - seperating a data frame with n columns into n individual vectors
I have many very large dataframes with 20 columns each. In order to conserve memory, I wish to separate the data frame into 20 vectors, each named the name of the dataframe followed by .1,.2,.3 .20. (For example purposes, one data frame is named ?testa?.) e.g. testa.1, testa.2, testa.3 I have written the code to do this (see below). I am trying to convert this into a function that I can reuse.
2007 Sep 28
1
Converting to mode numeric within a matrix
Hello, I create a matrix: best <- matrix(0, ncol=2, nrow=num.selected, dimnames=list(the.best$.Name, c("Probability(%)", "Inside"))) best[,1] <- as.numeric(the.best$Total*100) best[,2] <- ifelse(the.best$Weight==0, "No", "Yes") What I want is the second column of mode numeric, but it is of mode character, despite the attempt to convert it to
2008 May 17
1
Correlated Columns in data frame
Dear all, Sorry to post my query once again in the list, since I did not get attention from anyone in my previous mail to this list. Now I make it simple here that please give me a code for find out the columns of a dataframe whose correlation coefficient is below a pre-determined threshold. (For detailed query please see my previous message to this list, pasted hereunder) Thanks and regards,
2006 Apr 14
4
how to count the columns of a data.frame
Hi, I would like to count the columns of a data.frame. I know how to count the rows, but not the columns. Can someone tell me how to do it? My best regards, Giacomo Moro --------------------------------- [[alternative HTML version deleted]]
2012 Jan 08
3
Conditional Loop For Data Frame Columns
Hi, I am trying to create a script that will evaluate each column of a data frame, regardless of # columns, using some function and sorting the results by an index vector: #upload data (112 rows x 73 columns) SD <- read.csv("/Users/johnjacob/Desktop/StudentsData_RInput.csv", header=TRUE) #assign index vector ID <- SD[ ,2] #write indexed mean function meanfun <- function(x) {
2009 May 15
2
Printing to screen a matrix or data.frame in one chunk (not splitting columns)
Hello, I saw this nice trick I want to replicate but I lost the source and I hope one of you can point me to the solution. My problem is that I don't know the correct words to query this. When I print to screen a matrix or data.frame the columns are split and printed below the previous ones; even though I have plenty of screen left. E.g., > my_matrix = matrix(runif(30),nrow=3,ncol=10)
2009 Jul 09
1
Converting indices of a matrix subset
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have two matrices: > m1 <- matrix(1,4,4) > m1 [,1] [,2] [,3] [,4] [1,] 1 1 1 1 [2,] 1 1 1 1 [3,] 1 1 1 1 [4,] 1 1 1 1 > m2 <- matrix(0,3,3) > diag(m2) <- 1 > m2 [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 I want to get indicies from m2
2010 Jul 21
0
Converting Between Character and Numeric Objects
Hello, I'm trying to convert a vector of string objects to a numeric object by initializing the variables with values. I use the function below to scan through a matrix and create mass action flux relationships: makeMassActionFluxes = function(sMatrix) { #Allocate a matrix with identical dimensions as the inputted stoichiometric matrix temp = matrix(nrow = dim(sMatrix)[1], ncol =
2009 Jan 06
2
Converting data frame to symmetric matrix
Dear Sir or Madam, I have the following data frame (which is just a toy example of my larger dataset) L3 <- LETTERS[1:3] x=c(1,1,2,2,3,3,4,4,5,5) y=1:10 d <- data.frame(cbind(x,y), fac=sample(L3, 10, replace=TRUE)) This data frame produces the following output x y fac 1 1 1 C 2 1 2 C 3 2 3 B 4 2 4 B 5 3 5 C 6 3 6 B 7 4 7 B 8 4 8 C 9 5 9 B 10 5
2012 Apr 05
2
indexing data.frame columns
Consider the data.frame: df <- data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = c(2,7,5,2,7,4,5), index = c("A","B","A","C","B","B","C")) I want to select the column specified in 'index' for every row of 'df', to get goal <- c(1, 7, 2, 2, 3, 5, 5) This sounds a lot like the indexing-by-a-matrix
2011 Mar 31
1
Assign Names of columns in data.frame dinamically
Hello List. I have many files of ECG, each one with 7 column and I need only the second column and the name of each ECG. I am doing this but althought I have various days trying this i haven't gotten, so I ask help with this, if somebody cans help me I'll be so thankfully. --------------------------------------------------------------------------------------------------------
2001 Sep 14
1
converting numeric to ordered
Hello all, would someone please tell me why the following code doesn't "work" (i.e. do what i expected!). I wanted to convert numeric variables in a matrix to ordered (for input as nominal variables into the 'daisy' program). Why does the following code seem to work, but the "is.ordered" command reports that the variables are not ordered (factors)?? > xxx <-
2007 Mar 16
1
ideas to speed up code: converting a matrix of integers to a matrix of normally distributed values
Hi all, [this is a bit hard to describe, so if my initial description is confusing, please try running my code below] #WHAT I'M TRYING TO DO I'd appreciate any help in trying to speed up some code. I've written a script that converts a matrix of integers (usually between 1-10,000 - these represent allele names) into two new matrices of normally distributed values (representing