similar to: Export dataframe to txt

Displaying 20 results from an estimated 50000 matches similar to: "Export dataframe to txt"

2006 Oct 26
4
Header of dataframe
Hi I am fairly new to R and I would appreciate some help to hopefully a trivial problem. I created a function: summary.aggregate <- function(y, ...) { temp.mean <- aggregate(y, FUN=mean, ...) temp.sd <- aggregate(y, FUN=sd, ...) temp.length <- aggregate(y, FUN=length, ...) temp <- data.frame(cbind(mean=temp.mean$x,stdev=temp.sd$x,n=temp.length$x)) } this outputs e.g.:
2007 Jan 08
3
Speeding things up
Hi, is it possible to do this operation faster? I am going over 35k data entries and this takes quite some time. for(cnt in 2:length(sdata$date)) { if(sdata$value[cnt] < sdata$value[cnt - 1]) { sdata$ddtd[cnt] <- sdata$ddtd[cnt - 1] + sdata$value[cnt - 1] - sdata$value[cnt] } else sdata$ddtd[cnt] <- 0 } return(sdata) Thank you, Benjamin
2006 Feb 03
2
(newbie) Saving the workspace in .txt format
(newbie question) How do I save the workspace in Windows text format (with the file extension .txt)? Also, having saved it and edited it, how do I load it back into the workspace? The setup is: Windows XP Home Edition Service Pack 2 R 2.2.0 English language Administrator privileges are enabled Tom Jones, a veteran computer professional who is a newbie to R
2005 Mar 13
4
Output a dataframe from R to excel
Hi, I am trying to output an dataframe from R to Excel file. Can anyone tell me how to do it? Thanks a lot. Eg. R dataframe: A B C 1 2 1 3 4 2 . . . [[alternative HTML version deleted]]
2005 Feb 23
1
to print dataframe
Dear all, Is it possible to print a dataframe without the row numbers? For example if I have a dataframe like that: >df <- data.frame(name1=sample(LETTERS,10),name2=sample(c(0,1),10,replace=TRUE)) after printing name1 name2 1 O 1 2 H 0 3 R 0 4 T 0 5 V 1 6 E 0 7 W 0 8 P 1 9 G 0 10 J 1
2007 Mar 14
4
abs(U) > 0 where U is a vector?
Hi, I am looking for a way to compare if every element of a vector is > 0. i.e. while(abs(U) > 0) { .. } is there a function for this or do I have to write one? I'd appreciate your help! Benjamin
2003 Feb 26
3
multiple plot overlay - dataframe
I hope you could help me with this. I have a dataframe with 5 columns, the first column determining the X values, and the rest four determining four separate Y vectors. How can I plot them on the same graph, overlaying each other? Thanks. Elena Zheleva
2006 Feb 08
6
dataframe subset
I have a dataframe with a column, say "x" consisting of values, each value appearing different times, e.g. x: 1,1,1,1,2,2,4,4,4,9,10,10,10,10,10 ... and a vector, including e.g.: y: 2,9,10,... I need a subset of the dataframe: all rows where x is equal to one of the values in y. Currently I use a loop for this, but because x and y are large this is very slow. Is there any idea how to
2007 Jan 15
4
How to format R code in LaTex documents
Hi, I am planning on putting some R script in an appendix of a LaTex document. Can anyone recommend me a way of how to format it? Is there a way to keep all line breaks without having to insert \\ in every single line? Thank you! Benjamin
2006 Feb 08
1
adding variable into dataframe by indice
R-Helpers, I am trying to insert a value into a dataframe. This value is a proportion calculated by counting the number of those individuals with that value and then inserting the proportion at the end of the dataframe to only those individuals with the given value. The problem I am running into is that the proportions are not being attached to only those individuals with the specified value
2006 Jun 19
2
saving rounded numbers as a new variable in a dataframe
A basic question, but one that eludes me. I have created a new variable $numurder, which I have rounded off. I want to save the rounded off version of this variable to an existing datafile called 'ngri.csv' . numurder <-c((murder*no.of.cases)/100) [[1]] [1] 48.952 112.073 182.160 974.610 122.140 663.432 150.856 18.988 137.925 198.045 68.930 203.148 30.056 100.955
2007 Jan 09
2
Logical operations or selecting data from data.frames
Hi all, why doesn't something like this does not work? speedy <- (sdata$VaR < sdata$DdtdAbs) && sdata$DdtdDuration >= qpois(pct,lambda) && sdata$Ddtd > MinDD or sdata$Ddtd[sdata$Ddtd > 0 && sdata$VaR < sdata$DdtdAbs] sdata looks like this: dataId date value Ddtd VaR DdtdAbs DdtdDuration 18948 79637 2004-07-27 10085.10
2004 Jun 14
4
Coercing a dataframe column to datetime
I am trying to coerce a data frame column from character to datetime using strptime but keep getting an error because the length of the coerced object is always 9. What am I doing wrong here: ................................................................. > ds <- cbind(1:2, c("02/27/92 23:03:20", "02/27/92 22:29:56")); ds [,1] [,2] [1,]
2006 Jan 02
1
"7:9, 12:14" in dataframe to c(7:9, 12:14)
I want to do something like df[df$b %in% df2[i, 2], ] where df$b is a numeric vector and df2[i, 2] is a factor with levels like "7:9, 12:14". For example: a <- c(paste("A", 1:10, sep = ""), paste("B", 1:10, sep = "")) b <- 1:20 df <- as.data.frame(cbind(a, b)) df$b <- as.numeric(levels(df$b))[as.integer(df$b)] f <-
2006 Oct 12
3
Cross two dataframe
Dear r-users! I would like to cross two data frame which have the same row number but different in the number of column. Can anybody help me for this case ? Thanks a lot in advance -------------------------------------------------------------------------------- Majid Iravani PhD Student Swiss Federal Research Institute WSL Research Group of Vegetation Ecology Z?rcherstrasse 111
2005 Dec 02
3
extracting rows of a dataframe
Hi look at the following session, in which I have a dataframe, and I want to extract the second row, without the first column. Everything works as expected until the last line, where I set the names of x to NULL, and get a non-desired object (I want c(4,3).). Three questions: (1) why is as.vector(a[2,-1]) not a vector? (2) How come setting names to NULL gives me bad weirdness? (3) Can I
2010 Mar 17
3
Converting "factors" to "numeric" in a dataframe
I am currently trying to write a program that minimises the amount of work required for “auditable” qPCR data. At the moment I am using an Excel (.csv) spreadsheet as source data that has been transposed to the column format required for R to read. Unfortunately, this means I have* *to manually confirm the whole data set prior to doing any analysis, which is taking a considerable amount of time!
2007 Jan 05
4
Fast Removing Duplicates from Every Column
Hi, I'm looking for some lines of code that does the following: I have a dataframe with 160 Columns and a number of rows (max 30): Col1 Col2 Col3 ... Col 159 Col 160 Row 1 0 0 LD ... 0 VD Row 2 HD 0 0 0 MD Row 3 0 HD HD 0 LD Row 4 LD HD HD 0 LD ... ... LastRow HD HD LD 0 MD Now I want a dataframe that looks like this. As you see
2004 Apr 13
1
par() in .Rprofile
Dear all I installed new version (from binaries) and I noticed that par(bg="white") which I have in my .Rprofile causes error message on startup But if I issued this command immediately after startup everything worked as expected. I did not see any note in changes file or elsewhere. Should I specify white background in .Rprofile differently? Or is there some other recommended way
2011 Apr 06
3
Calculated mean value based on another column bin from dataframe.
Dear list, I have a dataframe with two column as fellow. > head(dat) V1 V2 0.15624 0.94567 0.26039 0.66442 0.16629 0.97822 0.23474 0.72079 0.11037 0.83760 0.14969 0.91312 I want to get the column V2 mean value based on the bin of column of V1. I write the code as fellow. It works, but I think this is not the elegant way. Any suggestions?