similar to: Reshape - strange outputs

Displaying 20 results from an estimated 100 matches similar to: "Reshape - strange outputs"

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
2008 Jul 15
3
Melt (reshape) question
Dear all, I have a grid of 720 columns by 360 rows of global population density values, and hope to convert this to column format using the 'melt' command in the 'reshape' package. I'm not receiving any errors as such, but when the code has finished running, my output looks like this: > head(PopDens.long) Latitude Longitude PopDensity 1 -84.75 V1 0 2
2009 Jun 21
1
Problems with bilinear interpolation of a grid
Dear all, I'm having trouble interpolating a number of gridded datasets that I have. I'm quite new to R so any help/advice that can be offered would be much appreciated! Firstly I'll describe my dataset. The data is a grid of the planet at 1 degree spatial resolution, with each grid cell containing a value describing a particular variable (e.g. population density) for coordinate
2009 Mar 31
0
Row/columns names within 'assign' command
Dear all, I am attempting to add row and column names to a series of tables (120 in total) which have 2 variable parts to their name. These tables are created as follows: # Create table indexes index <- expand.grid(year = sprintf("%04d", seq(1986, 1995)), month = sprintf("%02d", 1:12)) # Read in and assign file names to individual objects with variable name components
2008 Jun 14
1
Correcting the display of colnames and rownames
Dear all, I have a data frame of dimension 720 columns by 360 rows, to which I am trying to add numerical row and column labels to, using the 'sequence' command. The original data, which I read in using 'read.table', had no such labels at all. I've got as far as successfully using the sequence command and getting the labels to display. However, I'm finding that for the
2009 Aug 14
4
Assigning values based on a separate reference (lookup) table
Dear R Users, I have a data frame of 360 rows by 720 columns (259200 values). For each value in this grid I am hoping to apply an equation to, to generate a new grid. One of the parts of the equation (called 'p') relies on reading from a separate reference table. This is Table 4 at: http://www.fao.org/docrep/s2022e/s2022e07.htm#3.1.3%20blaney%20criddle%20method (scroll down a little).
2009 Apr 01
0
回复: R-help Digest, Vol 73, Issue 32
Dear sir,    How to do bilinear time series in R?Is there any functions or packages?  thank you! -----Sincerely yours Kuangnan Fang 方匡南 敬上 department of statistics ,Economics school,Xia men University. Fujian Province (361005) China Mobile Phone:15860721915 SKYPE: ruiqwy MSN Messenger: ruiqwy@hotmail.com QQ:39863401 --- 09年3月31日,周二, r-help-request@r-project.org
2012 Feb 17
5
How to change the order of columns in a data frame?
Dear all, I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the remaining columns X1-Xn should be ordered like this: X1, X2, X3 etc instead of like below. > colnames(pos1) [1] "X" "X1" "X10" "X11" "X12" "X13" "X14" "X15" "X16"
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
2009 Nov 03
2
reshaping pairs of columns
Given a data frame consisting of a pointID and 12 pairs of (lat, long) variables, with names latA, longA, latB, longB, ... latL, longL, I want to reshape it into a data frame with the structure point source lat long 1 A ... ... 1 B ... ... I've looked at reshape and plyr, but can't figure out how to do this. Details of my data frame are below
2012 Dec 11
5
Renaming column names according to another dataframe
Hi, I've 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
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
2009 Aug 20
2
How to extract row values?
Dear All! I'm trying to extract one specific row from a data frame without columnnames being included. I only want a 1-dimensional vector that consists of the specific data on this row. Here's an example: existing data: column names: v1v2v3 Row 1 ab cd ef Row 2 gh ij kl Row 3 mn op qr This is what I want to extract: ab cd ef I do not want: v1v2v3
2009 Nov 29
3
How to z-standardize for subgroups?
Hi folks, I have a dataframe df.vars with the follwing structure: var1 var2 var3 group Group is a factor. Now I want to standardize the vars 1-3 (actually - there are many more) by class, so I define z.mean.sd <- function(data){ return.values <- (data - mean(data)) / (sd(data)) return(return.values) } now I can call for each var z.var1 <- by(df.vars$var1, group,
2007 Jun 22
1
speed issues / pros & cons: dataframe vs. matrix
I'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.
2010 Apr 13
2
transpose but different
Hi all, I want to make extra columns in my datafile where the id of every groupmember is mentioned in separate columns. To explain it better see the example: id<-c(1,2,3,4,5,6,7,8,9,10,11,12) group<-c(1,1,1,1,2,2,3,3,3,3,3,3) a<-as.data.frame(cbind(id,group)) a id group 1 1 1 2 2 1 3 3 1 4 4 1 5 5
1997 Sep 07
0
timeout smbd
Hello, My samba on UNIXWARE 2.1.1 is srill not working, but I can describe the problem different now: smbclient -L some_machine times out after a while, but it tries to connect to the rigth IP and port number. >From a windows NT Machine, the unix-samba machine is visible, but the log-on is VERY slow, after the log-on, everything is normal. I'm using samba-1.9.17 Something else: On a
2010 Jun 10
1
To give column names of a data-frame
Sir, I want to export the results of R in a data frame. So I want to give rownames,columnnames & title to the data-frame.I have applied the following: data.frame(matrix(c(...),nrow=,ncol=),row.names=c("a","b"),col.names=c("c","d"),title="aaa") But, it does not work. Can you help me? Regards, Suman Dhara [[alternative HTML version
2011 Sep 23
1
Newbie question: Converting Table
Hi, I'm new to R, and I have searched helpfiles and this forum on my 2 questions. Hope you guys can help me out! :-) Many thanks in advance! Cheers, Lars Q1: I imported a csv file with columnames subject and class. There are about 1000 different classes... It looks like this: subject1, class1 subject1, class2 subject2, class1 subject2, class3 ... subject999, class1 subject999, class2
2010 Mar 18
1
Imported tables from Access 2007
Hi all, I am very new to R and I'm trying to import data from Microsoft Access. So far, I've managed to do so successfully using the following code: testdb <- file.path("c:\Databse.accdb") channel2 <- odbcConnectAccess2007(testdb) data.table <- sqlFetch(channel2,"data") This successfully imports a table(?) called "data.table". But when I try to