Free Access Week-  Data Engineering + BI
Data engineering and BI courses are free!
Free AI Access Week from June 2-8

translateSPSS2R (version 1.0.0)

xpssCompute: Creates data

Description

R implementation of the SPSS COMPUTE argument.

Usage

xpssCompute(x, variables = NULL, fun = NULL,...)

Arguments

x
input data .
variables
atomic character or character vector with the names of the variables.
fun
atomic character as functionname.
...
further arguments passed to or from other methods.

Value

Output is a created vector.

Details

Missing Fuctions:
Functionname
Output
computeMiss Computes missing values as logical (limited to one variable).
computeNmiss
Computes missing values as logical.
computeNvalid Computes valid values as logical.
computeSysmis
Computes the system missing values as logical.
Numeric Fuctions:
Functionname
Output
computeAbs Computes the absolute value.
computeArsin
Computes the arc-sine.
computeArtan Computes the arc-tan.
computeCos
Computes the cosinus.
computeExp Computes the exponential.
computeLn
Computes the logarithmus naturalis.
computeLg10 Computes the logarithmus base 10.
computeLngamma
Computes the logarithmus of the gamma function.
computeMax Computes the maxima.
computeMean
Computes the atithmetic mean.
computeMedian Computes the median value.
computeMin
Computes the minima.
computeMod Computes the remainder of a division.
computeRnd
Computes rounded values.
computeSd Computes the standard deviation.

Character Fuctions:

Functionname
Output
computeChar_index Returns the position of the first occurence of a pattern.
computeChar_length
Computes the length of a string in characters.
computeChar_lpad Returns an expanded strings.
computeChar_mblen
Computes the byte per character or sign.
computeChar_rindex Returns the position of the last occurence of a pattern.
computeChar_rpad
Returns an expanded strings.
computeConcat Returns a concatenated string.
computeLength
Computes Number of bytes in a string.
computeLower Returns the input data to lower-case.
computeLtrim
Returns a trimmed string (left side trimmed).
computeNtrim Returns the values of the input data.
computeReplace
Replaces a pattern in a string.
computeRtrim Returns a trimmed string (right side trimmed).
computeStrunc
Returns a truncated string.
Lag Fuction:
Functionname
Output
Date Fuctions:
Functionname
Output
computeCtime_days Computes the difference of time between two dates in days.
computeCtime_hours
Computes the difference of time between two dates in hours.
computeCtime_minutes Computes the difference of time between two dates in minutes.
computeCtime_seconds
Computes the difference of time between two dates in seconds.
computeDate_dmy Computes a date with the format day-month-year.
computeDate_mdy
Computes a date with the format month-day-year.
computeDate_moyr Computes a date with the format month-year.
computeDate_qyr
Computes a date with the format year/quarter.
computeDate_wkyr Computes a date with the format year/calendar week.
computeDate_yrday
Computes a date with the format year/yearday.
computeTime_days Computes the number of passed hours on basis of the given days
computeTime_hms
Computes a date with the format Hour-Minute-Second

computeXdate_date Extracts the date out of a date string. computeXdate_hour Extracts the hour value out of a given date. computeXdate_jday Computes the date of year on basis of a given date. computeXdate_mday Extracts the date of month on basis of a given date. computeXdate_minute Extracts the minute component on basis of a given date. computeXdate_month Extracts the month component on basis of a given date. computeXdate_quarter Computes the quarter on basis of a given date. computeXdate_second Extracts the second on basis of a given date. computeXdate_tday Computes the difference of days between the entered date and October 14, 1582. computeXdate_time Extracts the time componente on basis of a given date. computeXdate_week Calcualtes the calendar week on basis of a given date. computeXdate_wkday Calcualtes the day of week on basis of a given date.

Be careful about the input format of the numeric values in your data. It is possible to specify values which are outside the of valid range. Those failures are called Domain Errors. For example:

Function
Output
** A negative number to a noninteger power.
/
A divisor of 0.
computeArsin An argument whose absolute value exceeds 1.
computeExp
An argument that produces a result too large to be represented on the computer.
computeLg10 A negative or 0 argument.
computeLn
A negative or 0 argument.
computeMod A divisor of 0.

See Also

Related Functions xpssNumeric xpssString

Examples

Run this code
data(fromXPSS)

xpssCompute(x=fromXPSS, variables="V7_2",fun="computeValue")

xpssCompute(x=fromXPSS, variables=c("V5","V7_2"),fun="computeMean", na.rm=T)

Run the code above in your browser using DataLab