similar to: storing text and decimal values in a matrix form

Displaying 20 results from an estimated 11000 matches similar to: "storing text and decimal values in a matrix form"

2007 Sep 11
0
Odp: storing text and decimal values in a matrix form
Hi Gon?alo Ferraz <gferraz29 at gmail.com> napsal dne 11.09.2007 16:35:57: > Thanks! What is the easiest way of declaring an empty data frame. Is there > anything similar to: > matrix(0,x,y) > In the help files, I am only finding longer commands that ask me to specify > each individual column. You can either do dat<-data.frame(x=rep(NA,10), y=rep(NA,10)) or to
2012 Jun 22
3
dropping variables from a data frame inside a function
Why doesn't this work? #Drop a variable name from a data frame DropLikeSAS <- function(x,df) { df[[x]] <- NULL 0 } DropLikeSAS("VarName", DataFrameName) Try it. The column VarName will not be deleted from the data frame DataFrameName. But x <-
2004 May 08
3
Indexing column of a matrix with infix $
I'm using 1.9.0 on Windoze 2k and I created a numeric matrix and used colnames() to give it some column names, but if I try to select a column using matrixname$validname I get a null return but if I use matrixname[,4] it works fine. Looking at the help I think this is because a matrix is not a recursive structure and I think it's saying I shouldn't be surprised nor attempt this.
2003 Aug 20
1
question for loop on matrix row level.
For the 1000 simulations, a matrix will be generated each time. And, I need to choose the first row of the generated matrix. The following loop doesn't work though: for (i in 1:1000) { aval[i]<- matrixname[1,] } Any solution? thanks!
2012 Nov 01
4
Loop over several variables
Hey everybody, I am looking for a way to loop commands over several variables in a dataframe. Basically I want to do something like this: ti1<-aggregate(dataframename$y1, by=data.frame(dataframename$aggregationvar), sum,na.rm=TRUE) This works fine as it is but i want to do it for several variables thereby generating several tix. I tried with a for-loop but the
2007 Aug 21
2
extracting month from date in numeric form
Hi, Anyone knows what would be a short way of extracting a month from a date in numeric or integer format? months("1979-12-20") returns "December" in character format. How could I get 12 in numeric or integer format? Thanks! G. [[alternative HTML version deleted]]
2010 Jun 02
3
writing a matrix in a file
Hi, I want to write a matrix (n*m) in a file (Text file) such that the file will be as Result file (below). I use the below command but it write all numbers in one column, > write(paste(matrixname),file="test.txt",append=TRUE) how can I do this? Result file: 5 5 -1 -1 -1 -1 8 8 2 7 6 5 6 6 8 2 7 5 Matrix: [,1] [,2] [,3] [,4] [,5]
2007 Aug 17
4
matching elements from two vectors
Hi, Imagine a vector x with elements (1,2,1,1,3,5,3,3,1) and a vector y with elements (2,3). I need to find out what elements of x match any of the elements of y. Is there a simple command that will return a vector with elements (F,T,F,F,T,F,T,T,F). Ideally, I would like a solution that works with dataframe colums as well. I have tried x==y and it doesn't work. x==any(y) doesn't work
2013 Nov 21
2
overlaying 2D grid on randomly distributed points
Hi, I have a cloud of randomly distributed points in 2-dimensional space and want to set up a grid, with a given grid-cell size, that minimizes the distance between my points and the grid nodes. Does anyone know of an R function or toolbox that somehow addresses this problem? This is a problem of optimizing the location of the grid, not a problem of deciding what should be the grid-cell size,
2010 Oct 04
2
print-show-display a matrix
Hello. I want to print the value a matrix has. The matrix's size is not too big (100*100 cells). I tried print(matrixname) but as it does not fit very well on my screen R splits it into several small matrixes that do overflow my screen. IS it possible somehow to display this matrix as one (even if this needs to go fullscreen) . There might be some function for that like plot cells or
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
2010 Aug 20
3
change object name within for loop
Hi, I am writing a for loop that creates one object, say 'outn' on every round of the loop. I would like the name of each object to include the index of the loop as in, for example: out1, out2, out3, ... And I would like the naming of the object to take place automatically as the loop moves through? Similarly, I would like to be able to call different objects (in1, in2, in3,
2005 Nov 09
2
Sort a dataframe
Dear All, How can I sort a data frame (using one of the column)? Thanks for your support. Regards. Abd. Rahman Kassim (PhD) Head Forest Ecology Branch Forest Management & Ecology Program Forestry and Conservation Division Forest Research Institute Malaysia Kepong 52109 Selangor, Malaysia ***************************************** Checked by TrendMicro Interscan Messaging Security. For any
2009 Jan 21
1
finding row and column indices of date in multiple columns of a data frame
Hi, I have a data.frame SAMPLES with columns: Site Site# Season Day1 Day2 Day3 Day1, Day2, Day3 are class "Date", the other columns are numeric or factor. I have a date "mydate" that may or may not be listed in my data.frame and I need to find that out. If "mydate" is there, I want to get the number of the data.frame row where it occurs.
2020 Jan 28
2
[RFC] Print FP constant assembly in hexadecimal form instead of decimal
Hi: When debugging some floating point assembly, we found it is inconvenient to read the decimal constants in assembly. In hex form many FP numbers are immediately recognizable, their exponents are more obvious etc. We normally use hex form in debugger or LLVM IR, not sure what is the reason that we want to use decimal in assembly? The form change won't change precision or affecting
2011 May 15
3
Rails 3 and saving decimal values from a form
I have an odd bug in one of my applications. When I am using the sqlite3 database the bug is not present. However when I use mysql2 as the database adapter I run into an error saving decimal values from a form. If I submit the value 19.99 my input after the decimal is removed and it is stored in the database as 19.00 What would cause this? The database has the correct settings for the column and
2004 Jun 01
1
converting text coordinates to decimal degrees
I receive GPS readings in a text string such as "0121.6723S 03643.6893E" and need the coordinates as decimal degrees in two separate variables: "-1.361205" and "36.728155". How do I do this in R? mikkel
2009 Jun 25
1
Lose of decimal when using write.table to text file
Good Day, I have the following: >Date<-c("08/05/08","08/06/08","08/07/08") >Weight<-c(209.4,211.8,210.0) >planned.meal<-cbind(Date,Weight) >planned.meal Date Weight 1 08/05/08, 209.4 2 08/06/08, 211.8 3 08/07/08, 210.0 >write.table(planned.meal, file="plannedMeal1.txt", + quote=FALSE, row.names=FALSE) output on
2008 Mar 13
2
joining matrices, vectors, scalars in one object
Hi, I have: a <- matrix(c(0,1,0,1),nrow=2) b <- matrix(c(1,1,1,0,0,0),nrow=3) c <- 1 d <- c(1,0,1) And I would like to join them in an object 'thing' so that I can access a, b, c, or d through an index in a for loop. For example: thing[4] would return [1] 1 0 1 Note however, that I have many of these 'thing' components. So many that a command like thing
2007 Aug 17
1
finding the row(s) for a date in a data frame
Hi, If I have a data frame A with the following format: Day1 Day2 Day3 Day4 1 1979-11-02 1979-11-03 1979-11-04 <NA> 2 1979-12-06 <NA> <NA> <NA> 3 1979-12-13 1979-12-14 1979-12-15 1979-12-16 4 1979-12-20 <NA> <NA> <NA> And a date "1979-12-14", for