Displaying 20 results from an estimated 5000 matches similar to: "read.table truncated data?"
2011 Aug 31
3
how to create data.frames from vectors with duplicates
Hi R users,
suppose I have two vectors,
> x=c(1,2,3,4,5)
> y=c('a','b','c','a','c')
How can I get a data.frame like this?
> xy
count
a 5
b 2
c 8
I know a few ways to fulfill the task. However, I have a huge number
of this kind calculations, so I'd like an efficient solution. Thanks
--
Best,
Zhenjiang
2011 Mar 15
3
how to reshape the data.frame from long to wide in a specific order
Hi,
For example, the data.frame like:
origdata.long <- read.table(header=T, con <- textConnection('
subject sex condition measurement
1 M control 7.9
1 M first 12.3
1 M second 10.7
2 F control 6.3
2 F first 10.6
2 F second 11.1
3 F control 9.5
3
2011 Aug 05
4
a question on list manipulation
Hi R users,
I have a list:
> x
$A
[1] "a" "b" "c"
$B
[1] "b" "c"
$C
[1] "c"
I want to convert it to a lowercase-to-uppercase list like this:
> y
$a
[1] "A"
$b
[1] "A" "B"
$c
[1] "A" "B" "C"
In a word, I want to reverse the list names and the elements under
each
2010 Aug 10
4
matrix problem
Hi,
I have a file like this:
1 2 0.1
2 3 0.2
3 1 0.3
And I want to read it to create a matrix like this:
[,1] [,2] [,3]
[1,] 0 0.1 0
[2,] 0 0 0.2
[3,] 0.3 0 0
How can I do it efficiently? Thanks.
--
Best,
Zhenjiang
[[alternative HTML version deleted]]
2011 Aug 02
2
how to control to save plots to which dev
Hi,
I have a for loop to make 2 types of plots and I'd like to save one
type of plots to a pdf file and the other to another pdf file. How can
I control which plot will be saved to which pdf? Thanks
--
Best,
Zhenjiang
2011 Apr 15
1
how to add two data.frame with the same column but different row numbers
Hi all,
Suppose I have 2 data.frame , a and b, how can I add them together to get c?
Thanks
> a
A
a 1
b 2
c 3
> b
A
a 6
c 1
> c
A
a 7
b 2
c 4
--
Best,
Zhenjiang
[[alternative HTML version deleted]]
2011 Aug 29
1
sum of two lists
Hi R users,
Suppose I have two lists and the names of list 'm' are a subset of those of
'n', how can I sum the two lists with corresponding elements added together
to get list 'o'?
> n = list("a"=1,"b"=3,"c"=5)
> m = list('b'=4)
> o
$a
[1] 1
$b
[1] 7
$c
[1] 5
Thanks
--
Best,
Zhenjiang
[[alternative HTML version
2010 Nov 10
1
ggplot2 problem in interacting mode
Hi all,
When running R interactively, I have the problem as following:
> library(ggplot2)
Loading required package: reshape
Loading required package: plyr
Attaching package: 'reshape'
The following object(s) are masked from 'package:plyr':
round_any
Loading required package: grid
Loading required package: proto
> data(VADeaths)
> pg <- ggplot(melt(VADeaths),
2011 Aug 31
1
counting the duplicates in an object of list
Hi all,
I have a list x:
?> x=list(a=c('1','2'),b=c('2','3'),c=c('1','2'),d=c('2','3'))
I can get the unique elements with unique(), but how can I get the
number of duplicates for each unique elements?
> unique(x)
[[1]]
[1] "1" "2"
[[2]]
[1] "2" "3"
Thanks
--
Best,
Zhenjiang
2010 Apr 20
1
the bar width of barchart plot in lattice package
Dear R users,
I am trying to use the following code to make a barchar plot. The bars in
the plot turn out to be a little narrow. Is there any way to modify the
width of the bars? Thank you!
library(lattice)
scores = gl(2, 5, label=c('Sensitivity', 'PPV'), length = 100)
sequences = gl(5, 1, label=c('Lemna minor', 'Dugesia japonica A',
'Gymnosporangium
2006 Dec 08
2
dyn.load and function calls without 'PACKAGE' argument
I'm writing a package that interfaces to the FAME database, via a
library of compiled C routines accessible through a Linux .so file. My
.onLoad() function loads the .so like this:
dyn.load("/opt/fame/timeiq/lib/linux_x86/libjchli.so", local = F)
and after that I also load my own fame.so via
library.dynam("fame", package = "fame")
The code in fame.so uses
2010 Apr 29
1
a question on autocorrelation acf
Hi R users,
where can I find the equations used by acf function to calculate
autocorrelation? I think I misunderstand acf. Doesn't acf use following
equation to calculate autocorrelation?
[image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} -
\mu)]}{\sigma^2}\, ,]
If it does, then the autocorrelation of a sine function should give a
cosine; however, the following code gives a
2010 Apr 22
1
how to reorder of groups and specify ylim for each row in lattice barchart
R experts,
Is there anyway to reorder inside each group? In the following example, the
bar of year 1932 is always plotted before the bar of year 1931, may I change
the order inside each groups of bars?
library(lattice)
barchart(yield ~ variety | site,data=barley, groups = year, layout =
c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space =
"right"),ylab = "Barley Yield
2009 Jan 20
1
Problem with FAME
Dear All,
I wonder whether anyone has an experience with FAME package written by Jeff Hallman. All my attempts to send him the following problem report did not succeed (the mail system says that my e-mail could not be delivered), so I turn for help to this list.
I tried to use your FAME package written for R, but somehow I cannot get it working. I am using Windows XP and the newest R
2007 Feb 02
2
Help with OS X (BSD) ps command
My fame package has a function that checks to see if a FAME SERVER process is
already running. On Linux, I can do this in one of two ways:
pid <- Sys.getpid()
user <- Sys.info()["user"]
cmd <- paste("pgrep -fU", user, "-P", pid, "'FAME SERVER'")
fameRunning <- as.logical(length(system(cmd, intern = T)))
or I can use
cmd
2007 Jun 05
1
Can configure.ac detect 64 bit R?
My fame package has to link to the libchli.so that comes with FAME.
However, FAME is now supplying both 32 and 64 bit versions of the
library. The 32-bit version is $FAME/hli/libchli.so while the 64-bit
version is $FAME/hli/64/libchli.so. To set the right flags, it seems
that I need to know, from within configure.ac, whether the R
installation is 32 bit or 64 bit. Is there a way to detect this?
2007 Jul 12
5
In creating a Windows binary package (zip), how do I make the installation configurable
I would like to create a binary package for Windows which when
installed will give the user an option of whether to install
one version or another.
Here is the problem, I have a package 'FAME' that can run
in two different modes on Windows. An old mode that uses
R to connect to a remote linux machine and a new way that
uses a locally installed database.
I would allow this decision to be
2008 Nov 17
2
Cannot quit R - fame package issue?
Hello list member:
I've recently had a problem in that I'm unable to quit an R Session. I
noticed this after the update to 2.8.0, but I believe I also noticed it
on another machine, in the previous version. It occurs on both linux
and Mac platforms. It only occurs when I start R in some particular
workspaces that have alot of objects in them; it does not occur if I
start R in an
2003 Mar 28
2
rsync ignoring some new files
I have found several instances where rsync refuses to copy a new file.
I am using it to sync changes from a staging web server to production
servers, and there are certain files that it just plain won't copy. The
file is totally new. No such name has ever existed on the target server(,
or on the source server until now).
In this instance, I added 3 completely new files to the same
2010 Sep 28
2
Reshape
Hello, helpeRs,
I've been trying, unsuccessfully, to change a dataframe from long to
wide format using reshape (the original). I would appreciate it if
someone could demonstrate the correct syntax. The script below will
create a toy example. The new wide data should have a column name
for each unique entry in the "fame" column. Under each column
should be either the