similar to: How to print the frequency table (produced by the command "table" to Excel

Displaying 20 results from an estimated 1000 matches similar to: "How to print the frequency table (produced by the command "table" to Excel"

2016 Apr 26
0
How to print the frequency table (produced by the command "table" to Excel
Hi jpm miao, You can get CSV files that can be imported into Excel like this: library(prettyR) sink("excel_table1.csv") delim.table(table(df[,c("y","z")])) sink() sink("excel_table2.csv") delim.table(as.data.frame(table(df[,c("y","z")])),label="") sink() sink("excel_table3.csv")
2006 May 08
2
On the speed of apply and alternatives?
Dear all, I have to handle a large matrix (1000 x 10001) where in the last column i have a value that all the preceding values in the same row has to be compared to. I have made the following code : # generate a (1000 x 10001) matrix, testm # generate statistics matrix 1000 x 4: qnt <- c(0.01, 0.05) cmp_fun <- function(x) { LAST <- length(x) smpls <- x[1:(LAST-1)] real
2008 Jul 31
1
rollapply() to portions of a matrix
Hi everyone, I have a rollapply statement that applies a function, in steps, over a data matrix as follows: #Code start testm<-rollapply(mat, 100, by=100, min, na.rm=F) #Code end This moves down matrix 'mat' and calculates the minimum value over a 100 row range, every 100 rows (i.e. no overlaps). NAs are not removed. I want to modify this statement somehow so that the rollapply()
2009 Jul 30
1
stepwise variable selection method wanted
Hi List, I am looking for a variable selection procedure with a forward-backward selection method. Firstly, it is meant to work with the cophenetic correlation coefficient (CPCC) and intended to find the variable combination with the highest cophenetic correlation. Secondly, it is aimed at Gower metric with wards method (though this could be easily extended) aimed at categorical data. What I
2013 May 03
10
Why can't R understand if(num!=NA)?
I have a program, when I write if(num!=NA) it yields an error message. However, if I write if(is.na(num)==FALSE) it works. Why doesn't the first statement work? Thanks, Miao [[alternative HTML version deleted]]
2012 Jul 27
2
How can I access an element of a string?
Dear Daniel and Jorge, Thank you very much and it does help. If I have a string "ABCD", how can I access the second element of the string "B"? Thanks, Miao 2012/7/27 Daniel Nordlund <djnordlund@frontier.com> > > -----Original Message----- > > From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] > > On Behalf Of jpm miao
2013 Apr 03
3
Generating a bivariate joint t distribution in R
Hi, I conduct a panel data estimation and obtain estimators for two of the coefficients beta1 and beta2. R tells me the mean and covariance of the distribution of (beta1, beta2). Now I would like to find the distribution of the quotient beta1/beta2, and one way to do it is to simulate via the joint distribution (beta1, beta2), where both beta1 and beta2 follow t distribution. How could we
2012 Mar 12
3
A question on histogram - area much less than 1
Hello, I have problem running the histogram function "hist". The area under the histogram is much lower than 1. Could anyone tell me what the problem is? Thanks, (The total number of observation is 992 (close to 1000), so the probability that 0<Y1<35 is approximately 0.277) miao rm(list=ls()) par(mfrow=c(1, 1)) Y <- cbind(matrix(35*0.5,1,277), matrix(35*1.5, 1, 146),
2013 Apr 17
3
Transformation of a variable in a dataframe
HI, I have a dataframe with two variable A, B. I transform the two variable and name them as C, D and save it in a dataframe dfcd. However, I wonder why can't I call them by dfcd$C and dfcd$D? Thanks, Miao > A=c(1,2,3) > B=c(4,6,7) > dfab<-data.frame(A,B) > C=dfab["A"]*2 > D=dfab["B"]*3 > dfcd<-data.frame(C,D) > dfcd A B 1 2 12 2 4 18
2012 Feb 17
4
How can I tabulate time series data (in RStudio or any other R editor)?
Hello, I have a question on how to tabulate the time series data. I use RStudio, but if can be done in any other R editor, it should work in RStudio as well. > a1<-11:22 > a1ts<-ts(a1, frequency=4, start=c(1978,1)) > a1ts Qtr1 Qtr2 Qtr3 Qtr4 1978 11 12 13 14 1979 15 16 17 18 1980 19 20 21 22 If I click the variable "a1ts" on the
2013 Jun 11
2
How can we access an element in a structure
Hi, I have a structure, which is the result of a function How can I access the elements in the gradient? > dput(test1) structure(-1.17782911684913, gradient = structure(c(-0.0571065371783791, -0.144708170683529), .Dim = 1:2, .Dimnames = list(NULL, c("x1", "x2")))) > test1[[1]] [1] -1.177829 > test1 [1] -1.177829 attr(,"gradient") x1
2012 Apr 12
4
Definition of "lag" is opposite in ts and xts objects!
Example: Will ts objects be obsolete or modified? > a [,1] 1983 Q1 2.747365190 1983 Q2 2.791594762 1983 Q3 -0.009953715 1983 Q4 -0.015059485 1984 Q1 -1.190061246 1984 Q2 -0.553031799 1984 Q3 0.686874720 1984 Q4 0.953911035> lag(a,4) [,1] 1983 Q1 NA 1983 Q2 NA 1983 Q3 NA 1983 Q4 NA 1984 Q1 2.747365190 1984 Q2
2012 Feb 21
2
Debugging using RStudio or any other R editor
Hello, I am using RStudio and have trouble finding out the problematic line in the presence of a bug. Could I view the line NUMBER which contains a bug? Is there any R editor able to do it? Thanks, Miao [[alternative HTML version deleted]]
2012 Nov 08
2
A question on "xyplot" function in Lattice package
Hi, I am using xylot function in Lattice package. I find it excellently written, but I don't know how to find resources on this function. One thing I would like to change is the line type. To my knowledge, type ="l" means a regular line, type "g" means broken lines, but I can't find a complete list of the choices. The info obtained from the query in R is limited.
2013 May 03
2
Declare a set (list?) of many dataframes or matrices
Hi, I would like to read several datasets and would like to create a set (list? sequence?) of many empty dataframes. How could this be done? How could I declare a set (list? sequence?) of many empty matrices? Thanks, Miao [[alternative HTML version deleted]]
2012 Jul 27
2
How can I access the title of a table read via read.csv?
Hi, I have a table which I can read via read.csv: fx1<-read.csv(file="A_FX_M.csv", header=TRUE) TIME REER NTD JPY GBP HKD 1 198001 124.26 36.030 237.96 2.263980 4.8366 2 198002 126.59 36.030 244.05 2.290426 4.8765 3 198003 128.33 36.026 248.62 2.206045 4.9960 4 198004 127.85 36.063 251.67 2.215330 4.9760 5 198005 124.40 36.050 228.35 2.302026 4.8891 6 198006
2013 Apr 18
2
How can I ask R to skip the title when reading the data?
I have many xls grade report sheets with the same format XXX High School Grade Report Confidential Yes Math English Science John 90 85 90 Mary 75 88 93 …… Since the reports are prepared on a regular basis, I have many reports with identical format. Without the title “XXX High School Grade Report Confidential Yes”, I can just change the xls to csv and read them via read.csv. How
2012 Oct 01
2
Input and output of time series data - any function or packages that helps?
Hello, I work with time series data. From time to time I run programs to produce results that are in time series form (e.g., quarterly or monthly data). After a few days I might need to access part of the results and to run another program. Is there any function or package (like dataframe or zoo?) that might help so that I don't need to copy the results manually to a csv or xls file?
2012 Sep 27
2
Is there a function that runs AR model with Schwarz Bayesian Information Criteria (BIC)?
Hello, Is there a function in R by which one can run AR model with Bayesian Information Criteria (BIC)? To my knowledge, functions ar and ar.ols could select the order only by AIC. Thanks, Miao [[alternative HTML version deleted]]
2012 Dec 14
2
How can I read the following complicated table
Hello, I have a table (in a txt file) which look like this: Monday 12 78 89 Tuesday 34 44 67 Wednesday 78 98 2 Thursday 34 55 4 Then the table repeats Monday , Tuesday, ... followed by several numbers My goal is to read values after the table. My problem is a little more complicated, but I just present a simpler case for ease of illustration. Is there any way to ask R to "read