Displaying 20 results from an estimated 600 matches similar to: "assigning to data frames with whole columns of NAs"
2005 Oct 26
1
unexpected '[<-.data.frame' result
Is this a bug?
If not, I am curious to know why '[<-.data.frame' was designed to yield
a.frame$y != a.frame$z rather than refusing to carry out the operation at
all.
> a.frame <- data.frame( x=letters[1:5] )
> a.frame[ 2:5, "y" ] <- letters[2:5]
> a.frame[[ "z" ]][ 2:5 ] <- letters[2:5]
> a.frame
x y z
1 a b <NA>
2 b c
2013 Feb 20
0
Simultaneously adding rows and columns by '[<-.data.frame' may fail
I saw the following in R help page "Extract.data.frame".
The replacement methods can be used to add whole column(s) by
specifying non-existent column(s), in which case the column(s) are
added at the right-hand edge of the data frame and numerical
indices must be contiguous to existing indices. On the other
hand, rows can be added at any row after the current
2020 Aug 11
2
clarifying the handling of responses for virtio-rpmb
Hi,
The specification lists a number of commands that have responses:
The operation of a virtio RPMB device is driven by the requests placed
on the virtqueue. The type of request can be program key
(VIRTIO_RPMB_REQ_PROGRAM_KEY), get write counter
(VIRTIO_RPMB_REQ_GET_WRITE_COUNTER), write
(VIRTIO_RPMB_REQ_DATA_WRITE), and read (VIRTIO_RPMB_REQ_DATA_READ). A
program key or write
2012 Aug 27
3
Changing entries of column of type "factor"/Adding a new level to a factor
What is a smart way to change an entry inside a column of a dataframe or
matrix which is of type "factor"?
Here is my script incl. input data:
> #set working directory:
> setwd("K:/R")
>
> #read in data:
> input<-read.table("Exampleinput.txt", sep="\t", header=TRUE)
>
> #check data:
> input
Ind M1 M2 M3
1 1
2001 May 03
0
R and Ox
Hi David, I hope all is well w/ you. Co-operation beetwen R and
Ox would be most welcome. A possible problem lies in the fact that,
although free for academic use, Ox is not open source. I too have
been using Ox for computer-intensive programming. I also code some
of my programs in C, but I always try Ox first, and in most cases
it is efficient enough. For details, see
2001 May 09
1
Fortran subroutines dblepr, realpr, intpr
I am making my first attempts at using some Fortran code with R, and
so far it's going OK. To print from my Fortran programs, it seems I
need subroutines dblepr, realpr and intpr. From the excellent
"Writing R Extensions" document:
"Three subroutines are provided to ease the output of information
from FORTRAN code.
subroutine dblepr(label, nchar, data, ndata)
2002 Feb 04
2
ASCII characters: from decimal code to R octal?
Is there a straightforward way to convert character information from
decimal representation to the octal one used by R?
I'd like something like a function ascii(number,base=10), such that
> ascii(91)
[1] "\133"
I can easily do the mapping from 91 to 133, but what is a good way to
operate on 133 to deliver "\133"?
Would a lookup table be a better solution?
David
2003 Jul 10
1
RE: packaged datasets in .csv format (David Firth)
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 9 Jul 2003 10:53:27 +0100
> From: David Firth <david.firth at nuffield.oxford.ac.uk>
> Subject: [R] packaged datasets in .csv format
> To: r-help at stat.math.ethz.ch
> Message-ID:
> <307D34CE-B1F3-11D7-A8D2-0050E4C03977 at nuffield.oxford.ac.uk>
>
2009 Aug 12
1
inserting into data frame gives "invalid factor level, NAs generated"
I am calculating some values that I am inserting into a data frame. From
what I have read, creating the dataframe ahead of time is more efficient,
since rbind (so far the only solution I have found to appending to a data
frame) is not very fast.
What I am doing is the following:
# create data frame
goframe = data.frame(goA = character(10), goB = character(10), value =
numeric(10))
goframe[1,] =
2000 Oct 26
1
Rgui and tcltk
I am having a little problem in relation to sending output to the R
Console window, when a function is called by pushing a button in a Tk
window. Actually there seem to be two components to the problem:
-- the R prompt does not re-appear until <return> is pressed
-- text output to the R Console window *disappears* after <return> is pressed
The following, in R 1.1.1 under
2000 Nov 12
1
putting output from print() into a string?
Is there some neat way of storing the printed representation of an
object as a character string? I can see how it could be done via
disk using sink() and then scan(), but that's ugly.
Something like Lisp-Stat's "with-output-to-string" macro perhaps?
David Firth Phone +44 1865 278544
Nuffield College Fax +44 1865 278621
Oxford OX1
2001 Jul 12
0
density estimation from interval-censored data
I am aware of the nice R package "logspline", which does smooth
density estimation from interval-censored data (that is, values that
are known to lie in a specified interval rather than known exactly).
Function logspline.fit uses a maximum penalized likelihood method,
with the penalty related to the number of knots used in a cubic
regression-spline fit.
I need to be able to do some
2011 Apr 12
2
Assign Character Value to Data Frame
Dear R Helpers,
I am trying to write a character value to the row of a data frame and am
running into a problem that I don't have when I do this for numeric
arguments. For example, the following works just fine:
> test<-data.frame(number=numeric(1))
> test[1,]<-.5
> test
number
1 0.5
But the following bombs out:
> hold<-data.frame(symbol=character(1))
>
2018 Apr 18
3
How to replace numeric value in the column contains Text (Factor)?
Hi R user,
Would you mind to help me on how I can change a value in a specific column
and row in a big table? but the column of the table is a factor (not
numeric).
Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA>
do you have any suggestions for me?
dat<-structure(list(Sites = structure(1:5, .Label = c("Site1", "Site2",
2005 Jul 07
1
manupulating a data frame column
Could someone tell me how to fix the following error? It looks like
that the reason is that df$x is of the class "factor". Thanks!
> x1<-LETTERS[1:8]; x2<-letters[1:8]; x1[2]<-NA; x1[4]<-NA;
> df<-data.frame(x1=x1, x2=x2)
> idx<-which(is.na(df$x1))
> df[idx,1]<-df[idx,2]
Warning message:
invalid factor level, NAs generated in:
2006 Mar 12
1
finding warning point in function
Hi everyone,
I would like to find out when and where exactly I get the following
warning in a piece of code I've written:
Error in "[<-"(`*tmp*`, iseq, value = numeric(0)) :
nothing to replace with
The code is a for () loop performing a somewhat trivial calculation,
modulated by a number of logical if(){} else(){} conditions, involving
the creation of a number of
2012 Aug 01
3
Can any one help me on this Issue
Hi Friends,
I'm new to R ,I have a data frame Z16 which is genarated from another data
frame, and I want to add ?%? & ?$? in row 4 and 5 respectively. when I?m
trying using below logic, I?m getting warning message. I'm using R 2.14.2
Version
Can anyone help me out on this.
Note: Initially i used tranfrom function to do some calculations,where ever
it should give zero,its
2012 Jul 26
5
Getting warning message
Hi Friends,
I have a data frame X, and I want to add ?%? & ?$? in row 4 and 5
respectively. when I?m trying using below logic, I?m getting warning
message.
Can anyone help me out on this.
X:
Summary G Y R T
Accts 582 644 0 1226
AcctCov 230 165 0 395
Cov% 40 26 0 32
UnCov% 60 74 0 68
EqVol11$MM8.5 10.6 0 19.1
Using this logic:
2006 May 11
1
factors
Hi R-users,
I had a minor issue while demonstating R that I can't explain. I am hoping someone will have suggestions.
The only difference is a call to fix() in between that I made to ensure people were following me. However, that seems to have altered the way R code got executed.
I was wondeirng if people have any insights.
Arnab
# When it does work
x <-letters[1:10]
marks
2004 Nov 28
0
Re: [R-sig-finance] syntax for a loop
I don't think I understand you entirely, but here are a couple
things.
You need to shorten the loop so you don't run off the end.
You basically just write the code as you've stated it except that
"and" is && for single values and & for vectors
You don't say what should happen if the test is not true.
You can probably use "ifelse" instead of a