Displaying 20 results from an estimated 10000 matches similar to: "how to use different variable to store values with different length in a loop"
2009 Jun 22
2
what's the R command to make the following?
Hi,
I have a simple question, suppose I have the date "05/16/2008", what would
be the command to get the month, day and year?
Thanks,
-Jack
[[alternative HTML version deleted]]
2010 Mar 12
3
how to plot only the upper triangle using the pairs function?
Hi,
I am trying to use function pairs to plot the scatterplot, but I only want
to keep the upper triangle, what's the argument to do this?
Thanks,
-Jack
[[alternative HTML version deleted]]
2011 Aug 17
2
question regarding gregexpr and read.table
Hi,
I have a silly question regarding the usage of two commands: read.table and
gregexpr:
For read.table, if I read a matrix and set header = T, I found that all the
dash ("-") becomes dots (".")
A = read.table("Matrix.txt", sep = "\t", header = F)
A[1,1]
# "A-B-C-D".
A = read.table("Matrix.txt", sep = "\t", header = T)
2009 Jul 01
2
Multi-tenant parking broken in 1.6.1.1?
Hello, all. With the assistance of very helpful folks, our brand new
multi-tenant setup seems to be working smoothly from start to finish
with just a bump or two. The biggest is parking. Now that we got most
kinks worked out, I'm a little more comfortable in trying to resolve
this.
There seem to be two problems:
1. Parking assigns parking spaces from the default group no matter
2009 Nov 10
1
how to suppress the output from stepAIC?
Hi,
I am now running a cross-validation using coxph coupled with stepAIC for
model selection, is there anyway to suppress the output? It's too much.
-Jack
[[alternative HTML version deleted]]
2008 Dec 09
1
Can elastic net do binary classification?
Hi, List
The elastic net package (by Hastie and Zou at Stanford) is used to do
regularization and variable selection, it can also do regression. I am
wondering if it can perform binary classification (discrete outcome).
Anybody having similar experience?
Many thanks,
-Jack
[[alternative HTML version deleted]]
2008 Jan 10
1
question on how to extract values from atomic vector
Dear List,
I have an atomic vector named "Results"
Results
[1] 1 1 1
attr(,"prob")
[1] 0.6666667 1.0000000 1.0000000
Levels: 0 1
when I type
attributes(Results)
$levels
[1] "0" "1"
$class
[1] "factor"
$prob
[1] 0.6666667 1.0000000 1.0000000
However, when I type
Results$prob
It has the following warning message:
NULL
Warning message:
In
2011 Aug 17
1
question regarding headers with space in the names
Hi,
After I read an xlsx file into the work space:
A <- read.xlsx("B.xls", header = T, check.names = F)
There are several headers with the names like:
colnames(A) [1:4]
# [1] "A 1" "B"
[3] "C 2" "D"
I can get the content of column 2 and column 4 easily by
A$B or A$D
However, I can not type
2009 Jun 27
1
Multiple parking lots use default park positions
Hello, all. I'm having a deeply frustrating time getting multiple
parking lots to work and am wondering what I am doing wrong. I am using
Asterisk 1.6.1.1. I defined two separate parking lots in features.conf
as follows:
[parkinglot_a100] ; SSI
context => a100-parking
parkpos => 900-920
findslot => next
[parkinglot_a10] ; EBC
context => a10-parking
parkpos => 800-820
2018 Mar 12
0
Equivalent of gtools::mixedsort in R base
???
> y <- sort( c("a1","a2","a10","a12","a100"))
> y
[1] "a1" "a10" "a100" "a12" "a2"
> mixedsort(y)
[1] "a1" "a2" "a10" "a12" "a100"
**Please read the docs!** They say that mixedsort() and mixedorder() both
take a **single
2010 Jul 14
1
question about SVM in e1071
Hi,
I have a question about the parameter C (cost) in svm function in e1071. I
thought larger C is prone to overfitting than smaller C, and hence leads to
more support vectors. However, using the Wisconsin breast cancer example on
the link:
http://planatscher.net/svmtut/svmtut.html
I found that the largest cost have fewest support vectors, which is contrary
to what I think. please see the scripts
2018 Mar 12
1
Equivalent of gtools::mixedsort in R base
x <- c( "a1", "a10", "a2" )
y <- c( "b10", "b2", "a12", "ca1" )
DF <- expand.grid( x = x, y = y )
# randomize
set.seed( 42 )
DF <- DF[ sample( nrow( DF ) ), ]
# missing from gtools
mixedrank <- function( x ) {
seq.int( length( x ) )[ gtools::mixedorder(x) ]
}
o <- do.call( order, lapply( DF, mixedrank ) )
2009 Jul 10
3
strange strsplit gsub problem 0 is this a bug or a string length limitation?
I was working with the rmetrics portfolioBacktesting function and dug into
the code to try to find why my formula with 113 items, i.e. A1 thru A113,
was being truncated and I only get 85 items, not 113.
Is it due to a string length limitation in R or is it a bug in the strsplit
or gsub functions, or in my string?
I'd very much appreciate any suggestions
============Input script:
2008 Oct 13
2
Multiple mailboxes per user
My users currently have mail delivered to mulitple MailDir locations
via procmail.
~/mail/inbox/
~/mail/graph/
~/mail/spam/
I would like all these mailboxes to be exported via dovecot IMAP and
appear as folders. However, I can't anything beyond the INBOX working.
My approach is via 'namespaces'.
My config file is changed thusly:
$ sudo dovecot -n
# 1.0.15:
2012 Aug 16
4
Column Extraction from matrix
Hi all,
I have a 4 by 100 matrix. I wish to extract each column and make it into a 2
by 2 matrix.
I also want to assign names for each 2X2 matrix.
For example
set.seed(2)
a=matrix(rnorm(400),ncol=100)
a1=matrix(a[,1],ncol=2)
a2=matrix(a[,2],ncol=2)
.
.
.
a100=matrix(a[,100],ncol=2)
Any simple ideas. Thanks.
B
--
View this message in context:
2012 Jun 28
3
loop through and modify multiple data frames
Hi
Newbie question:
I have a set of data frames that I want to do the same calculations on each.
I've found out that I can put them in a list and loop through the list
to do the calculation, but not put the results back into each
data.frame..
For example three data frames cats, dogs, birds
where >cats
name eats_kg
1 bob 3
2 garfield 4
3 chuck 6
and dogs and birds are similar but not
2012 Mar 04
1
Store vectors as values in xts time-series object
Hi R programmers,
I have stumbled across what seems a very simple problem. My goal is to
create a xts time series object which contains vectors as values. In
other words, I try to create something like this:
2009-01-01 => c('aa', 'bb', 'dd')
...
2010-02-01 => c('mm')
I have figured out parts of separately. Here's what works (new xts
time-series with
2008 Nov 21
1
How can I access the list argument within a "for" function call
Greetings,
I have been playing around with the R/Parallel package, which can farm out the computation of a for-loop among multiple worker processes. Each worker gets a chunk of the for-loop iterations; for example, if you have two workers and for(x in 1:1000){...}, one worker would typically get iterations 1:500, while the second does 501:1000.
I would like to be able to preallocate matrices to
2018 Mar 12
7
Equivalent of gtools::mixedsort in R base
Hi,
Searching for functions that would order strings that mix characters and numbers in a "natural" way (ie, "a1 a2 a10" instead of "a1 a10 a2"), I found the mixedsort and mixedorder from the gtools package.
Problems:
1- mixedorder does not work in a "do.call(mixedorder, mydataframe)" call like the order function does
2- gtools has not been updated in 2.5
2007 Aug 12
1
How to store the parameter estimated by nls( ) to a variable?
Dear Colleagues.
I believe this should be a problem encountered by many:
nls( ) is a very useful and efficient function to use if we are just to
display the estimated value on screen. What if we need R to store the
estimated parameter in a variable?
For example:
x=rnorm(10, mean=1000, sd=10)
y=x^2+100+rnorm(10)
a=nls(y~(x^2+para),control=list(maxiter = 1000, minFactor=0.5