Displaying 20 results from an estimated 9000 matches similar to: "newbie lapply question"
2008 Jul 30
2
System exit codes
Hi --
Is there a way of detecting the exit code while calling system or pipe?
eg (on Unix)
> system("perl -e 'print \"foo\\\n\";exit(-1);'")
foo
Any help appreciated,
Ranjan
2007 Oct 01
2
Idioms for empty dataframes
I'm fairly new to R, coming from a programming background -- it's quite
nice to work with dataframes, though, as opposed to explicit iteration.
One thing I've found, which is surprising is that zero-length dataframes
seem to cause errors:
> t <- data.frame(bob=c(100))
> order(t$bob)
[1] 1
> t1 <- t[t$bob < 50]
> order(t1$bob)
Error in order(na.last, decreasing,
2007 Oct 25
1
Indexes on dataframe columns?
Hi --
I'm working with some data frames with fairly high nrows (call it 8
columns, by 20,000 rows). Are there any indexes on these columns?
When I do a df[df$foo == 42,] [which I think is idiomatic], am I doing a linear
search or something better? If the column contents is ordered, I'd like
to at least be doing a naive binary search.
Thanks!
Ranjan
2008 Feb 16
3
Arithmetic bug? (found when use POSIXct) (PR#10776)
Full_Name: Bo Zhou
Version: 2.6.1 (2007-11-26)
OS: Windows XP
Submission from: (NULL) (207.237.54.242)
Hi,
I found an arithmetic problem when I'm doing something with POSIXct
The code to reproduce it is as follows (This is the recommended way of finding
out time zone difference on R News 2004-1 Page 32 URL
http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf)
a=Sys.time()
2011 Feb 07
2
as.list(subclassed function) -> cannot coerce type 'closure' to vector of type 'list'
I was looking for all the glm-related 'family' functions
in stats using the following predicate that returns TRUE
for any function whose first argument is called "link".
is.family <- function(object) is.function(object) &&
identical(names(as.list(object))[1], "link")
It threw an error when applied to SSfol
> is.family(SSfol)
Error in
2018 Mar 30
0
getting all circular arrangements without accounting for order
New function below is a bit faster due to more efficent memory handling.
for-loop FTW!
directionless_circular_permutations2 <- function( n ) {
n1 <- n - 1L
v <- seq.int( n1 )
ix <- combinations( n1, 2L )
jx <- permutations( n-3L, n-3L )
jxrows <- nrow( jx )
jxoffsets <- seq.int( jxrows )
result <- matrix( n, nrow = factorial( n1 )/2L, ncol = n )
k
2018 Mar 30
0
getting all circular arrangements without accounting for order
I don't know if this is more efficient than enumerating with distinct
directions and weeding... it seems kind of heavyweight to me:
#######
library(gtools)
directionless_circular_permutations <- function( n ) {
v <- seq.int( n-1 )
ix <- combinations( n-1, 2 )
jx <- permutations( n-3, n-3 )
x <- lapply( seq.int( nrow( ix ) )
, function( i ) {
2018 Mar 30
2
getting all circular arrangements without accounting for order
Jeff,
I wanted to let you know that your function is faster than generating the directional circular permutations and weeding.
Here is the time for n = 10. I compared with just doing the permutations, there is no point in proceeding further with the weeding since it is slower at the start itself.
system.time(directionless_circular_permutations(10))
user system elapsed
1.576 0.000
2014 Mar 03
2
Project: Weighting Schemes
Hello Sir,
I am Reetesh Ranjan, a 3rd year undergraduate student at the *INDIAN
INSTITUTE OF TECHNOLOGY BHU, Varanasi-*one of the premier engineering
colleges of India.
I have gone through your webpage thoroughly and I am very interested in the
work that you are undertaking on *Project: Weighting Schemes.*. I earnestly
wish to work under your guidance, learn and progress through this
experience.
2001 Feb 23
4
hclust question
Dear all,
I have a question with regard to the use of hclust. I would like to be
able to specify my own distance matrix instead of asking R to compute
the distance matrix for me. It is computationally easier for me this
way. My question is: How can I get hclust to accept this?
Thanks,
Ranjan
--
***************************************************************************
Ranjan
2018 Mar 30
3
getting all circular arrangements without accounting for order
Thanks!
Yes, however, this seems a bit wasteful. Just wondering if there are other, more efficient options possible.
Best wishes,
Ranjan
On Thu, 29 Mar 2018 22:20:19 -0400 Boris Steipe <boris.steipe at utoronto.ca> wrote:
> If one is equal to the reverse of another, keep only one of the pair.
>
> B.
>
>
>
> > On Mar 29, 2018, at 9:48 PM, Ranjan Maitra
2020 Aug 26
10
[Bug 3202] New: Ed25519 key on HSM is not getting listed in ssh-add -l command
https://bugzilla.mindrot.org/show_bug.cgi?id=3202
Bug ID: 3202
Summary: Ed25519 key on HSM is not getting listed in ssh-add -l
command
Product: Portable OpenSSH
Version: 8.2p1
Hardware: ARM64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P5
Component: ssh-add
2017 Jul 25
1
To Supporting graphpad prism in R, add external library to poratbleR
Hi Jeff,
1). I have tried install.packages( c("dplyr", "tidyr" ) ) into the r-script
file got below error:-
> install.packages( c("dplyr", "tidyr" ) )
Installing packages into
?/tmp/1776492876238396447/lib/portableR-master/site-library?
(as ?lib? is unspecified)
Error in install.packages(c("dplyr", "tidyr")) :
This version of R is
2018 Jan 18
1
reading lisp file in R
Thanks! I am trying to use it in R. (Actually, I try to give my students experiences with different kinds of files and I was wondering if there were tools available for such kinds of files. I don't know Lisp so I do not actually know what the lines towards the bottom of the file mean.(
Many thanks for your response!
Best wishes,
Ranjan
On Wed, 17 Jan 2018 20:59:48 -0800 David Winsemius
2018 Jan 18
0
reading lisp file in R
> On Jan 17, 2018, at 8:22 PM, Ranjan Maitra <maitra at email.com> wrote:
>
> Dear friends,
>
> Is there a way to read data files written in lisp into R?
>
> Here is the file: https://archive.ics.uci.edu/ml/machine-learning-databases/university/university.data
>
> I would like to read it into R. Any suggestions?
It's just a text file. What difficulties
2018 Mar 30
0
getting all circular arrangements without accounting for order
If one is equal to the reverse of another, keep only one of the pair.
B.
> On Mar 29, 2018, at 9:48 PM, Ranjan Maitra <maitra at email.com> wrote:
>
> Dear friends,
>
> I would like to get all possible arrangements of n objects listed 1:n on a circle.
>
> Now this is easy to do in R. Keep the last spot fixed at n and fill in the rest using permuations(n-1, n-1)
2005 Apr 02
4
factor to numeric in data.frame
Dear All,
Assume I have a data.frame that contains also factors and I would like to
get another data.frame containing the factors as numeric vectors, to apply
functions like sapply(..., median) on them.
I read the warning concerning as.numeric or unclass, but in my case this
makes sense, because the factor levels are properly ordered.
I can do it, if I write for each single column
2017 Jul 25
0
To Supporting graphpad prism in R, add external library to poratbleR
1) Definitely yes. They are on CRAN. Just type
install.packages( c("dplyr", "tidyr" ) )
at the R console.
2) Don't know, but most likely the answer is yes. Since all R packages on Linux are compiled by R when installed, you either need to activate your virtual machine, compile the packages, and save the state for future use, or you have to build the package library on
2018 Jan 18
0
reading lisp file in R
It seems the file contains records, with each record having 18 fields.
I would use awk (standard unix tool), creating an awk script to process the
file
into a new file with one line for each record, each line with 18 fields,
say comma-separated.
The csv file can then be easily read into R via the function read.csv.
HTH,
Eric
On Thu, Jan 18, 2018 at 6:22 AM, Ranjan Maitra <maitra at
2010 Apr 06
2
is.na<- doesn't seem to work with labelled variables?
Dear All,
I seem entirely unable to solve what should be a very simple problem. I
have imported a SPSS dataset into R using spss.get from Frank Harrell's
Hmisc library. The variables are imported classed as 'labelled': missing
values are coded as either the SPSS missing value code, 8 or 88. All are
imported correctly; 8 and 88 being identified as true numbers in the