Displaying 20 results from an estimated 40000 matches similar to: "why should you set the mode in a vector?"
2005 Aug 25
2
S3 class question
Hi,
I have a class called "spss" containing prepared info from an SPSS file.
>...
>class(ret) = "spss"
>return(ret)
The function that returns this defined in a file that I source into R.
Also in that file is a function matSummary.spss.
I think I ought to be able to call
>matSummary(ret)
to run the function, but only
>matSummary.spss(ret)
will work.
What
2004 Nov 17
3
3d scatter plot with drop line
This is a follow up to my question from yesterday. I want to do in R
what is called a "3d scatter plot with drop lines" in S-PLUS.
Basically, it's a 3dscatterplot with lines connecting the x-y grid to
the z points.
The lines give a better perspective on the shape of the data surface.
How to?
Joel Bremson
UC Davis Statistics
2005 May 18
2
Fortran 95 in R ?
Is it possible to run Fortran 95 code from R? I don't think so, but
hopefully someone can prove me wrong.
Here is the test I tried:
A little fortran 95 subroutine:
subroutine allloc()
real, dimension(:, :), allocatable :: a
integer :: n
n = 10
allocate(a(n,n+1))
end
I then compiled:
>g95 -c allloc.f
>R CMD SHLIB allloc.o
Here is what happens when I try to dyn.load it in R 2.1.0
2005 May 18
2
Fortran 95 in R ?
Is it possible to run Fortran 95 code from R? I don't think so, but
hopefully someone can prove me wrong.
Here is the test I tried:
A little fortran 95 subroutine:
subroutine allloc()
real, dimension(:, :), allocatable :: a
integer :: n
n = 10
allocate(a(n,n+1))
end
I then compiled:
>g95 -c allloc.f
>R CMD SHLIB allloc.o
Here is what happens when I try to dyn.load it in R 2.1.0
2005 Sep 28
1
gfortran Makefile for cygwin
Hi all,
I'm porting a package that I've worked on for OS X to Cygwin/Windows.
This package requires a Makefile. My question is, how can I find out
(or what is), the link command?
Here is the OS X Makefile:
RLIB_LOC=${R_HOME}
F90_FILES=\
class_data_frame.f90 \
class_old_dbest.f90 \
class_cm_data.f90 \
class_cm.f90 \
class_bgw.f90 \
class_cm_mle.f90 \
cme.f90
FORTRAN_FILES=\
dgletc.f
2004 Nov 17
1
persp grid
I've got a 4x4 matrix of points from a 2-way ANOVA I'd like to plot.
The x,y correspond to the treatment groups and look like this
((1,1),(1,2),(1,3),(1,4),(2,1),...).
The z is the 4x4 matrix.
How can I get persp to grid the x,y axis with only the numbers 1-4 on both?
Regards,
Joel Bremson
UC Davis Statistics Dept.
2005 Oct 08
1
windows/g95 peculiarity
I'm not looking for an answer here, this is just a report of a
peculiar event I've observed
and can reproduce.
I'm developing a g95 (20050129) compiled package on windows xp pro
using R-2.1.1, and gcc-3.4.2 (mingw special). An older version of the
F95 package compiled and ran without problems. The new version of the
package includes extensive changes in the code.
The package has a
2005 Jul 27
1
spss.read factor reversal
Hi,
I'm having a problem with spss.read reversing my factor input.
Here is the input copied from the spss data editor:
color cost
1 2.30
2 2.40
3 3.00
1 2.10
1 1.00
1 2.00
2 4.00
2 3.20
2 2.33
3 2.44
3 2.55
For color, red=1, blue=2, and green = 3. It's type is 'String' and
>out=read.spss(file)
>out
$COLOR
[1] green blue red green green green blue blue blue red red
2005 May 20
1
using src/Makevars file
Hi all,
Thanks to all who offered advice on using F95 in R.
Now I'm trying to compile a test package using gfortran, Linux 2.4.21 and
R 2.1.0.
I was able to successfully compile and use a test F95 routine by setting my
environment variables as follows in bash:
export PATH=~/bin/:$PATH
export F77=gfortran
export LD_LIBRARY_PATH=~/bin/irun/lib
export GFORTRAN_STDIN_UNIT=-1
Now I'm
2005 Sep 28
3
gfortran Makefile for windows
Hi all,
(Originally posted to r-help)
I'm porting a package that I've worked on for OS X to Windows.
The package is written in F95 so I need to compile it with gfortran
and link it with gcc4.
I've been trying to build an R with gcc4 without luck so far. If there is
a binary of such a thing info would be appreciated.
This package requires a Makefile. My question is, how can I find
2005 Jun 06
1
segmentation fault - debugging
Hi all,
I'm trying to debug some fortran 95 code that I'm bringing in
with a dyn.load().
I'm compiling a number of files using g95 on intel linux w/ R 2.1.0.
The .so file loads without complaint, but when I try to call it I get a
seg fault. I was hoping I could get a core dump in order to get some
more clues about what is going on, but no luck.
I'm relatively new to fortran
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Hi, I seem to not be able to assign NULL to an element of a pairlist
without causing it to be coerced to a plain list. For example:
> x <- pairlist(1, 2)
> class(x)
[1] "pairlist"
> x[1] <- list(NULL)
> class(x)
[1] "list"
This actually true for all [()<- assignments regardless of list value, e.g.
> x <- pairlist(1, 2)
> x[1] <- list(0)
[1]
2009 Feb 09
2
Assigning to a vector while keeping the attributes
Hi,
I would like to know how to assign values to a whole vector while keeping
its attributes. For example, say I have
a <- structure(1:3,x=3)
and I want to change the values to 2:4. If I do, a <- 2:4, the attribute x
will be lost. I have a workaround for this case, which is to use subset
assignment
a[1:3] <- 2:4.
However, what if I want to also change the length of a? Then this workaround
2010 Nov 23
6
the first. from SAS in R
Is there any similar function in R to the first. in SAS?
What it dose is:
Lets say we have this table:
a b c
1 1 5
1 0 2
2 0 2
2 0 NA
2 9 2
3 1 3
and then I want do to do one thing the first time the number 1 appers in a
and something else the secund time 1 appers in a and so on.
so
something similar to:
if first.a {
a$d<-1
}else{
a$d<-0
}
This would give me
2005 Jun 23
1
mac osx, g95 package port problem
Hi all,
I have a working package for linux, including fortran 95 code compiled with
g95,
that I need to port to OS X. The package works on Linux and seems to load on
the Mac,
but when I try to run a function that calls C or Fortran I'm told that the
symbol is not loaded.
I'm developing via a shell account on an OS X system, I don't have access to
a desktop.
The set up is:
R
2008 Dec 22
1
imputing the numerical columns of a dataframe, returning the rest unchanged
Hi R-experts,
how can I apply a function to each numeric column of a data frame and return
the whole data frame with changes in numeric columns only?
In my case I want to do a median imputation of the numeric columns and
retain the other columns. My dataframe (DF) contains factors, characters and
numerics.
I tried the following but that does not work:
foo <- function(x){
2016 Oct 12
2
How to assign NULL value to pairlist element while keeping it a pairlist?
Hi Henrik,
It would help to understand your use case for pairlists.
Thanks,
Michael
On Wed, Oct 12, 2016 at 9:40 AM, Michael Lawrence <michafla at gene.com> wrote:
> The coercion is probably the most viable workaround for now, as it's
> consistent with what happens internally for calls. All pairlists/calls
> are converted to list for subassignment, but only calls are
2011 Nov 29
5
Why Numeric Values Become Factors in Data Frame
I have a data frame with 1 factor, one date, and 37 numeric values:
str(waterchem)
'data.frame': 3525 obs. of 39 variables:
site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 ...
$ sampdate : Date, format: "2007-12-12" "2008-03-15" ...
$ CO3 : num 1 1 6.7 1 1 1 1 1 1 1 ...
$ HCO3 : num 231 228 118 246
2010 Oct 31
3
extracting named vector from dataframe
Suppose df is a dataframe with one named row of numeric observations. I want
to coerce df into a named vector.
as.vector does not work as I expected: as.vector(df) returns the original
dataframe, while as.vector(df,mode="numeric") returns an unnamed vector of
NAs.
This works:
> v <- as.numeric(as.matrix(df)); names(v) <- names(df);
I just wanted check if there
2016 Oct 19
2
How to assign NULL value to pairlist element while keeping it a pairlist?
On Sat, Oct 15, 2016 at 2:00 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
>>>>>> Michael Lawrence <lawrence.michael at gene.com>
>>>>>> on Wed, 12 Oct 2016 15:21:13 -0700 writes:
>
> > Thanks, this was what I expected. There is a desire to
> > eliminate the usage of pairlist from user code, which
> >