Displaying 20 results from an estimated 10000 matches similar to: "check for new files in a given directory"
2009 Jul 27
1
read binary file seek()
I want to read in a binary file using the readBin() function. In order to
skip uninformative parts of the file I use the seek() function, I need to
specify the number of bits to skip rather than the number of bytes to skip.
E.g. seek(to.read,origin="current",blockSize)
with blockSize giving the number of bits
Does anybody know if this works? Any help would be highly
2008 Jun 05
2
Creating a list of functions
I've been trying to create a list of function where function[[i]] should actually return the value of i.
trying:
func <- vector("list",2)
i <- 1
while (i <= 2)
{
func[[i]] <- function()
{
i
}
i <- i+1
}
however only returned the last value of i for each function. Any help how to achieve the solution intended would be greatly appreciated.
thanks in advance,
andreas
2004 Jun 25
2
Sweave: R code in self defined TeX-commands
Hi,
I need to produce a standard report for several variables in Sweave
and thus would need the possibility to define a TeX-command which includes
R-code like
\newcommand{\meansd}[1]{The mean is \Sexpr{mean(#1)} and the standard
deviation is \Sexpr{sd(#1)} .
}
and then just write
\meansd{age}
in the latex code to get the whole sentence.
The above does not work, since
2012 Jan 01
3
rep() inside of lm()?
HI all,
I'm new to R.
Say I have a multi-layered list called newlist.
############
> str(newlist)
List of 2
$ :List of 5
..$ : num [1:8088] NA 464 482 535 557 ...
..$ : num [1:8088, 1:2] NA 464 482 535 557 ...
..$ : num [1:8088, 1:3] NA 464 482 535 557 ...
..$ : num [1:8088, 1:4] NA 464 482 535 557 ...
..$ : num [1:8088, 1:5] NA 464 482 535 557 ...
$ :List of 3
..$ : num
2003 Mar 23
12
Shorewall 1.4.1
This is a minor release of Shorewall.
WARNING: This release introduces incompatibilities with prior releases.
See http://www.shorewall.net/upgrade_issues.htm.
Changes are:
a) There is now a new NONE policy specifiable in
/etc/shorewall/policy. This policy will cause Shorewall to assume that
there will never be any traffic between the source and destination
zones.
b) Shorewall no longer
2013 Feb 12
3
grabbing from elements of a list without a loop
Hello!
# I have a list with several data frames:
mylist<-list(data.frame(a=1:2,b=2:3),
data.frame(a=3:4,b=5:6),data.frame(a=7:8,b=9:10))
(mylist)
# I want to grab only one specific column from each list element
neededcolumns<-c(1,2,0) # number of the column I need from each element of
the list
# Below, I am doing it using a loop:
newlist<-NULL
for(i in 1:length(mylist) ) {
2004 Sep 02
3
Traffic shapping Bug ?
hello ,
i''m currently trying to set-up Traffic Shapping with Shorewall and I have strong
feelings that I found a bug.
I may be mistaken, but I tried everything and can''t get it to work.
I''ve turned ON TC_ENABLED=Yes and CLEAR_TC=Yes
when i start shorewall ( shorewall start ), i get this message :
Setting up Traffic Control Rules...
TC Rule "2 eth1 0.0.0.0/0 tcp
2010 Jun 29
2
how to remove "numeric(0)" component from a list
like this, the list is below, I want to remove the last one . not using
newlist[-2], but using the function detect its component is numeric(0) and
then remove it from the list.
newlist
[[1]]
[1] 2 3
[[2]]
[1] numeric(0)
[[3]]
[1] 7
[[alternative HTML version deleted]]
2011 Feb 17
1
Populate a list / recursively set list values to NA
Hello all,
Maybe I'm being thick, but I was trying to figure out a simple way to create
a list with the same dimension of another list, but populated with NA
values.
masterlist = list(
aa=list(
a=matrix(rnorm(100),10,10),
b=matrix(rnorm(130),13,10),
c=matrix(rnorm(140),14,10)),
bb=list(
2010 Jun 28
2
ask a question about list in R project
my list al is as below:
mylist=list(c(2,3),5,7)
> mylist
[[1]]
[1] 2 3
[[2]]
[1] 5
[[3]]
[1] 7
How could I get the following FOUR lists:
First one
[[1]]
[1] 3
[[2]]
[1] 5
[[3]]
[1] 7
Second one
[[1]]
[1] 2
[[2]]
[1] 5
[[3]]
[1] 7
Third One
[[1]]
[1] 2 3
[[2]]
[1] 7
Last one
[[1]]
[1] 2 3
[[2]]
[1] 5
Do I have to use 'for' loops? Please give me sone suggestions!
Thank you
2006 May 05
4
str() with attr(*, "names") is extremely slow for long vectors
Hi,
I noticed some time ago that, for instance, named vectors that are
really makes str() really slow when displaying the names attribute. I
don't know exactly when this started, but it wasn't the case say 1-2
years ago. Example (on a WinXP 1.8GHz):
> s <- 1:1000; names(s) <- s
> system.time(str(s))
Named int [1:1000] 1 2 3 4 5 6 7 8 9 10 ...
- attr(*, "names")=
2004 Sep 12
2
boxplot() from list
I have a list containing 48 objects (each with 30 rows and 4 columns, all
numeric), and wish to produce 4 boxplot series (with 48 plots in each) ,
one for each column of each object.
Basically I want a boxplot from boxplot(mylist[[]][,i])
for i in 1:4. It seems that I can create a boxplot of length 48 from the
entire list, but I don't seem able to subscript to return 4 boxplots from
the list
2012 Nov 11
4
Multiplying elements of a list by rows of a matrix
Hi all,
I have the following code:
set.seed(1)
x1 <- matrix(sample(1:12), ncol=3)
x2 <- matrix(sample(1:12), ncol=3)
x3 <- matrix(sample(1:12), ncol=3)
X <- list(x1,x2,x3)
tt <- matrix(round(runif(5*4),2), ncol=4)
Is there a way I can construct a new list where
newlist[[i]] = tt[i,] %*% X[[i]]
without using a for loop? Each element of newlist will be 3 x 1 vector.
Thanks
--
Tina
2011 Feb 02
2
Indexing from two variables
Hello, thank you all for your patience and time
I am essentially trying to get disorganised data into long form for linear modelling.
I have 2 dataframes "rec" and "book"
Each row in "book" needs to be pasted onto the end of several of the rows of "rec" according to two variables in the row:" MRN" and "COURSE" which match.
I have
2005 Feb 01
4
Shorewall problem
I am getting the following message when Shorewall stops can anybody shed
any light on this message and where I should be looking? Thanks
root@bobshost:~# shorewall stop
Loading /usr/share/shorewall/functions...
Processing /etc/shorewall/params ...
Processing /etc/shorewall/shorewall.conf...
Loading Modules...
Stopping Shorewall...Processing /etc/shorewall/stop ...
IP Forwarding Enabled
2009 Mar 12
2
R grep & gsub issue - sign seems to be causing an issue...
I would like to use grep and gsub to manipulate a vector to make the names used consistent, i.e. reduce a level or two.
However, here is what I found when I attempted to use grep and gsub:
> tmp_test<-c("House 1 Plot Plus +100","House 2 Plot Plus +100","House 3 Plot Plus -100","House 4 Plot Plus -100","House 1 Plus +100","House 2
2012 Dec 10
3
use variable in for loop to name output files
Hi,
This question should be simple to answer. I am a new R user.
I have a data.frame called appended. I would like to break it into 7 smaller
datasets based on the value of a categorical variable dp (which has values
1:7). I would like to name the smaller datasets set1, set2, set3,....,set7.
I don't know how to refer to the variable in the for loop, when naming the
output datasets. In STATA
2010 Jul 16
2
Storing processed results back into original objects
Hi all,
There are matrices with same column names but arranged in different orders
and I desire columns of these matrices to have same order.
For example, below are 2 arbitrary data sets with columns arranged in
different order. I require columns of these to have same order as specified
in "columns" object and the results stored in the original object names.
I know this can be done
2009 Nov 02
1
Using processed objects as arguments of a function
Dear R users,
I wish to utilise processed and saved objects as arguments of a function.
Specifically, I have created objects using *"assign"* & *"paste"* functions
with an incremental index i, the names of the objects are:
fund1, fund2, fund3,....., fund80,..... (where the numerical value
increments according to the index i & class of these objects are
2007 Oct 15
1
The "condition has length > 1" issue for lists
I have the following code:
list1 <- list()
for (i in list.files(pattern="filename1")){
x <- read.table(i)
list1[[i]] <- x
}
list2 <- list()
for (i in list.files(pattern="filename2*")){
x <- read.table(i)
list2[[i]] <- x
}
anslist <- vector('list', length(list1))
for(i in 1:length(list1))
if (list1[[i]] & list2[[i]] >1)