Displaying 20 results from an estimated 100 matches similar to: "naming things in functions"
2002 Dec 12
0
if problem in function
Dear all,
I have written a function for calculating the volume of a tree (=trad) or
snag (=h?gst).
The included volume regreesion model includes ten parameter values, which
are tree species specific.
bj?rk.formh?jd.pars is an object which includes the parameter values
(parameter set) for birch (=bj?rk).
There is one row per tree in the data object.
> relev.kols[1:5,
2011 Oct 18
1
Repeat a loop until...
Dear all,
I know there have been various questions posted over the years about loops but I'm afraid that I'm still stuck. I am using Windows XP and R 2.9.2.
I am generating some data using the multivariate normal distribution (within the 'mnormt' package). [The numerical values of sanad and covmat are not important.]
> datamat <-
2011 Oct 25
1
regression using GMM for mulltiple groups
Inthe code below I was trying to to obtain the GMM estimates for CAPM
(REGRESSION) for 36 stocks each have 180 observations,however it only gives
me one output rather than 36.
In SAS i would just put in a *By statement*. I have a variable TICKER that
categorize them into 36 groups.
*How can I obtain all 36 output instead of just one.*
**
2010 Feb 16
1
Math.factor error message
Dear R-helpers,
I am using a vrtest on time series data. My commands are as follows;
read.table("B.txt",sep="\t",fill=TRUE, na.strings = "NA")
require(vrtest)
rm(list=ls(all=TRUE))
datamat <- read.table("B.txt",sep="\t",fill=TRUE, na.strings = "NA")
column <- 1
nob <- nrow(datamat)
y <-
2004 Jul 23
0
problem lme using corSymm()
Hi,
I got a computational problem with lme (nlme library R 1.9.1) using
corSymm(). Here is the data:
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.19639793 0.09127954 0.11733288 0.07598273 0.06545106 0.06211532
[2,] 0.22773467 0.10981912 0.16052847 0.38101187 0.18353474 0.24072918
[3,] 0.46743388 0.45733836 0.32191178 0.43356107 0.39159746 0.53984221
[4,]
2003 Jan 29
3
multinomial conditional logit models
A multinomial logit model can be specified as a conditional logit
model after restructuring the data. Doing so gives flexibility in
imposing restrictions on the dependent variable. One application is
to specify a loglinear model for square tables, e.g. quasi-symmetry
or quasi-independence, as a multinomial logit model with covariates.
Further details on this technique and examples with several
2011 Jun 27
1
Hardy Weinberg Simulation
Hello,
I am trying to simulate 10 relicates of 100-tables. Each table is a 2 x 3
and 80% pf the tables are true nulls and 20% are non-nulls. The nulls follow
the Hardy Weinberg distribution (ratio) 1:2:1.
I have the code below but the p-values are not what I am expecting. I want
to use the Cochran Armitage trend test to get the p-values.
num.reps=10
num.vars=1000
pi0 = 80
num.subjects = 100
2011 Jan 12
1
Grouped bars in barplot
Dear all,
I am trying to make a barplot with clustered pairs of bars, using class=numeric data and the following command:
barplot(c(bline_precip[10,9], bline_runoff[10,9], cccma_precip[10,9], cccma_runoff[10,9], csiro_precip[10,9], csiro_runoff[10,9], ipsl_precip[10,9], ipsl_runoff[10,9], mpi_precip[10,9], mpi_runoff[10,9], ncar_precip[10,9], ncar_runoff[10,9], ukmo_precip[10,9],
2010 May 10
2
Warning message
Hello,
I want to draw a histogram of the mean of sample observations drawn from multivariate t distribution. I am getting the following error corresponding to the code I used. Though I am getting the graph, but I am curious to know the warning message.
Warning messages:
1: In if (freq) x$counts else { :
the condition has length > 1 and only the first element will be used
2: In if (!freq)
2012 Nov 21
0
Question about VAR (Vector Autoregression) in differences.
Folks,
I have been using the VAR {vars} program to find a fit for the following bi-variate time series (subset):
bivariateTS<-structure(c(0.950415958293559, 0.96077848972081, 0.964348957109053,
0.967852884998915, 0.967773510751625, 0.970342843688257, 0.97613937178359,
0.980118627997436, 0.987059493773907, 0.99536830931504, 1.00622672085718,
1.01198013845981, 1.01866618122606,
2008 Jan 07
1
numerical data frame
Dear All,
I've successfully import my synteny data to R by using scan command. Below show my results. My major problem with my data is how am i going to combine the column names with the data( splt) where i have tried on cbind but a warning message occur. I have realized that the splt data only have 5 column instead of 6. Please help me with this!!
I want my data to be a numerical
2005 Jul 28
4
CSV file and date. Dates are read as factors!
I am using read.csv to read a CSV file (produced by saving an Excel file
as a CSV file). The columns containing dates are being read as factors.
Because of this, I can not compute follow-up time, i.e.
Followup<-postDate-preDate. I would appreciate any suggestion that would
help me read the dates as dates and thus allow me to calculate follow-up
time.
Thanks
John
John Sorkin M.D., Ph.D.
Chief,
2004 Apr 27
2
Gcc 3.4.0 and syslinux-2.09 menu
The menu directory won't compile with gcc 3.4.0 because gcc complains
that "ebp" cannot be used as a constraint. If preserving ebp is
necessary then it will have to be done in the assembler code. Gcc 3.3.3
just seems to ignore the constraint. It didn't do anything special to
preserve the register.
I also noticed that getnumrows returns the contents of 0x484 which is
the
2010 Feb 09
3
subset in a matrix
Hi,
I have a matrix of data values like the example bellow. I would like to
extract a subset of the matrix for the values where the first column is
negative. I am using the subset function. However, I am getting an error
message that the conditional variable doe snot exist. For some reason, the
subset operation only works if I transform the matrix to a data set using
as.data.set(). The help
2010 Feb 22
1
rownames cannot allocate vector of size
Hi,
On R 2.10.1 for Windows, when I do the following to duplicate the
structure of a large numeric matrix called matrix1:
matrix2 <- matrix(0,nrow=nrow(matrix1),ncol=ncol(matrix1))
and then
rownames(matrix2) <- rownames(matrix1)
I get a "cannot allocate vector of size xxMb" error
but if I instead do:
rnames <- list()
rnames <- rownames(matrix1)
matrix2 <-
2010 Mar 22
1
sets package: converting a set to data frame?
I just started using nice package "sets"
and I wonder if there are utilities to convert (some) sets to data frame
(as in the example below)
> library(sets)
> a <- gset(elements = list(e('A', 0.1), e('B', 0.8)))
> lst <- as.list(a)
> nr <- length(lst)
> rnames <- character()
> for (i in 1:nr) rnames[i] <- lst[[i]]
> df <-
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
2006 Aug 28
1
Extracting column name in apply/lapply
Hi,
any good trick to get the column names for title() aside from running lapply on the column indexes?
Thanks
Nick.
apply(X[,numCols],2,function(x){
nunqs <- length(unique(x))
nnans <- sum(is.na(x))
info <- paste("uniques:",nunqs,"(",nunqs/n,")","NAs:",nnans,"(",nnans/n,")")
hist(x,xlab=info)
#
2017 Mar 20
2
IO error when writing to disk
Hello,
Here a small improvement for R.
When you use the function write.table, if the disk is full for example, the
function doesn't return an error and the file is written but truncated.
It can be a source of mistakes because you can then copy the output file
and think everything is ok.
How to reproduce
-------------------------
>> write.csv(1:10000000, 'path')
You must have
2018 Jul 05
0
write.table with quote=TRUE fails on nested data.frames
Looks like I?m bumping a lot into unexpected behaviour lately, but I think I found a bug again, but don?t have access to Bugzilla:
Write.table (from core-package utils) doesn?t handle nested data.frames well, the quote arguments only marks top-level character (or-factor columns) for quoting, so this fails:
df <- data.frame(a='One;Two;Three',