similar to: split the data.frame

Displaying 20 results from an estimated 1000 matches similar to: "split the data.frame"

2006 May 16
0
solution of split data.frame
Dear Folks: My recent question concerning split data.frame has been solved using both following approaches. (Question is listed at the end.) solution 1: Try melt from the reshape package (by Gabor) library(reshape) melt(DF, 1:2) You may may need to resort it if the order is important. solution 2: good for large dataset (by Robert) "If your data set is really big, i.e. bigger than R
2006 Apr 27
2
add city and point in the map
Dear Helpers: I'm trying to use packages "maps" and "mapdata" (see blow) to display the research resutls on map (Mid-Atlantic region). In particular, I need to mark a number of points in the map by giving their latitude and longitude information. For instance, I would like to mark a point on (long, lat) =(75.56027, 39.09271). Also, I need to mark several cities that I
2006 May 18
1
How to write output in a specific formate with irregular space
Dear R users: My question is how to write output in a specific formate with irregular spacing? Say that I have the following DF with three columns (A-C): A B C a10 100.0 212 The objective is to write an output file such that column A occupies 1-10 spaces aligned to the left, column B occupies 11-15 spaces aligned to the right, and finally column C takes 16-25 spaces
2006 Jul 11
1
problem of fixed-formated output using sprintf
Dear R users: I'm trying to generate a output file with fixed format using function "sprintf" in R. However, the execution time in R is very long even the toy data (smaller size df) seems to work fine. The syntax that I used is as follows: df.fmt <- sprintf("%2s%2s%2.4f", df$v1, df$v2, df$v3) write.table(df.fmt, output.name,...) The actual dataset is a df with the
2018 Feb 25
4
reshaping column items into rows per unique ID
Hi All I have a datafram which looks like this : CustomerID DietType 1 a 1 c 1 b 2 f 2 a 3 j 4 c 4 c 4 f And I would like to reshape this so I can
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
I'm writing a function and keep getting the following error message. myfunc <- function(lst) { lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate",
2004 Mar 10
3
How to use MLE-class?
Hi there, I had successfully use "MLE" function to solve my problem. Is there anyone knows how to get related information? i.e., value of likelihood function, information matrix, and etc. I know MLE-class can do it but I can not find any information tells me how to do it. Thanks a billions, Yihsu [[alternative HTML version deleted]]
2007 Dec 09
3
editor under MAC system
Dear R-user; I recently switched from PC to MAC. Is there a compatible editor as Win-editor with package RWinEdit for MAC? Thanks Yihsu Chen [[alternative HTML version deleted]]
2006 May 18
2
create a vector
Dear R users: I have an elementary question: how to creat a vector of [A1, A2, A3...... A300]? I know c(1:300) would give 1, 2, 3, ...., 300 but not sure how to attch a A to each element. Thank you Yihsu Chen The Johns Hopkins University
2011 Jun 09
2
Problem with a if statement inside a function
I have a really long functions, and at the end of the function, I am using a if statement to tag certain keywords based on whether they have certain values contained in them. However, the if statement doesn't seem to work. When I had split up the commands into various functions, it worked fine, but I'm not sure what going on now that it's combined into a single function. myfunc
2006 May 19
1
Writing to a file with fixed precision
Dear R users; A follow-up question regarding writing to a file with fixed precision: Assuming for each column of x, I would like to have a different format, then I modify the code as: x.fmt <- apply(x, 1, function(x) sprintf("%.14f %.10f %2.5f", x)) where three different formats are %.14f %.10f %2.5f. The error message I got is "Error in sprintf(fmt, ...) : too few
2008 Dec 11
4
how to plot implicit functions
Dear R users -- I think this question was asked before but there was no reply to it. I would appreciate any suggestion any of you might have. I am interested in plotting several "implicit functions" (F(x,y,z)=0) on the same fig. Is there anyone who has an example code of how to do this? Thank you Yihsu
2007 Feb 22
2
write fixed format
Dear R users; Is there a function in R that I can put "text" with proper alignments in a fixed format. For instance, if I have three fields: A, B and C, where both A and C are text with 3 characters and left alignment; B is a numeric one with 2 decimals and 3 integer space digits. How can I put the following row in a file? (note there is a space between a and 2, and after b.)
2011 Jun 09
1
Using a function inside a function
I'm trying to run a function inside a function but get an error message. lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate", "rates"), suffix3 =
2007 Jul 09
1
ca.jo
Dear R users; I'm using ca.jo for a VECM model. Is there a way that I can get sd/p-value to see whether coefficients estimated are statistical significant? Thank you Yours, Yihsu [[alternative HTML version deleted]]
2008 Feb 01
1
calculation fraction/ratio
Dear R users I wonder if there is a quick way to calculate the ratio/fraction of a list/data frame. For example, if I have a data frame with two fields: "Index" and "A". I would like to know the fractions of A's within the same "Index". That is, for Index =1, three fractions will be "1/(1+2+3)=0.17", "2/(1+2+3)=0.33", and
2018 Feb 25
0
reshaping column items into rows per unique ID
Hi Allaisone, If you want a data frame as the output you will have to put up with a few NA values unless each Customer has the same number of diet types: a1df<-read.table(text="CustomerID DietType 1 a 1 c 1 b 2 f 2 a 3 j 4
2018 Feb 25
0
reshaping column items into rows per unique ID
I believe you need to spend time with an R tutorial or two: a data frame (presumably the "table" data structure you describe) can *not* contain "blanks" -- all columns must be the same length, which means NA's are filled in as needed. Also, 8e^5 * 7e^4 = 5.6e^10, which almost certainly will not fit into any local version of R (maybe it would in some server version --
2011 Oct 03
3
Best method to add unit information to dataframe ?
Dear all, I'd like to have a dataframe store information about the units of the data it contains. You'll find below a minimal exemple of the way I do, so far. I add a "units" attribute to the dataframe. But I dont' like the long syntax needed to access to the unit of a given variable (namely, something like : var_unit <- attr(my_frame,
2006 May 22
2
Subset a list
I have a data frame of ~200 columns and ~20,000 rows where each column consists of binary responses (0,1) and a 9 for missing data. I am interested in finding the columns for which there are fewer than 100 individuals with responses of 0. I can use an apply function to generate a table for each column, but I'm not certain whether I can subset a list based on some criterion as subset() is